[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56502] branches/vgroup_modifiers/source/ blender/makesrna/intern/rna_space.c: Tsst?\226?\128? \166 Just discovered RNA_enum_items_add_value(), a much better way to generate dynamic enumitems from static one!

Bastien Montagne montagne29 at wanadoo.fr
Sun May 5 17:39:37 CEST 2013


Revision: 56502
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56502
Author:   mont29
Date:     2013-05-05 15:39:37 +0000 (Sun, 05 May 2013)
Log Message:
-----------
Tsst?\226?\128?\166 Just discovered RNA_enum_items_add_value(), a much better way to generate dynamic enumitems from static one!

Modified Paths:
--------------
    branches/vgroup_modifiers/source/blender/makesrna/intern/rna_space.c

Modified: branches/vgroup_modifiers/source/blender/makesrna/intern/rna_space.c
===================================================================
--- branches/vgroup_modifiers/source/blender/makesrna/intern/rna_space.c	2013-05-05 05:56:48 UTC (rev 56501)
+++ branches/vgroup_modifiers/source/blender/makesrna/intern/rna_space.c	2013-05-05 15:39:37 UTC (rev 56502)
@@ -131,7 +131,6 @@
 };
 
 /* Actually populated dynamically trough a function, but helps for context-less access (e.g. doc, i18n...). */
-/* Beware of order! num ID are also used as array index! */
 static EnumPropertyItem buttons_texture_context_items[] = {
 	{SB_TEXC_MATERIAL, "MATERIAL", ICON_MATERIAL, "", "Show material textures"},
 	{SB_TEXC_WORLD, "WORLD", ICON_WORLD, "", "Show world textures"},
@@ -1130,22 +1129,22 @@
 	int totitem = 0;
 
 	if (ED_texture_context_check_world(C)) {
-		RNA_enum_item_add(&item, &totitem, &buttons_texture_context_items[SB_TEXC_WORLD]);
+		RNA_enum_items_add_value(&item, &totitem, buttons_texture_context_items, SB_TEXC_WORLD);
 	}
 
 	if (ED_texture_context_check_lamp(C)) {
-		RNA_enum_item_add(&item, &totitem, &buttons_texture_context_items[SB_TEXC_LAMP]);
+		RNA_enum_items_add_value(&item, &totitem, buttons_texture_context_items, SB_TEXC_LAMP);
 	}
 	else if (ED_texture_context_check_material(C)) {
-		RNA_enum_item_add(&item, &totitem, &buttons_texture_context_items[SB_TEXC_MATERIAL]);
+		RNA_enum_items_add_value(&item, &totitem, buttons_texture_context_items, SB_TEXC_MATERIAL);
 	}
 
 	if (ED_texture_context_check_particles(C)) {
-		RNA_enum_item_add(&item, &totitem, &buttons_texture_context_items[SB_TEXC_PARTICLES]);
+		RNA_enum_items_add_value(&item, &totitem, buttons_texture_context_items, SB_TEXC_PARTICLES);
 	}
 
 	if (ED_texture_context_check_others(C)) {
-		RNA_enum_item_add(&item, &totitem, &buttons_texture_context_items[SB_TEXC_OTHER]);
+		RNA_enum_items_add_value(&item, &totitem, buttons_texture_context_items, SB_TEXC_OTHER);
 	}
 
 	RNA_enum_item_end(&item, &totitem);




More information about the Bf-blender-cvs mailing list