[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19649] branches/blender2.5/blender/source /blender/makesrna: RNA:

Brecht Van Lommel brecht at blender.org
Sat Apr 11 03:43:54 CEST 2009


Revision: 19649
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19649
Author:   blendix
Date:     2009-04-11 03:43:50 +0200 (Sat, 11 Apr 2009)

Log Message:
-----------
RNA:
* Added REQUIRED flag for function parameters.
* Made dupliframes/verts/faces/groups an enum, and make it editable.
* Enum bitflags were broken, fixed.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
    branches/blender2.5/blender/source/blender/makesrna/RNA_types.h
    branches/blender2.5/blender/source/blender/makesrna/intern/Makefile
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_ID.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c

Modified: branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/RNA_access.h	2009-04-11 00:29:21 UTC (rev 19648)
+++ branches/blender2.5/blender/source/blender/makesrna/RNA_access.h	2009-04-11 01:43:50 UTC (rev 19649)
@@ -348,6 +348,7 @@
 const char *RNA_property_identifier(PointerRNA *ptr, PropertyRNA *prop);
 PropertyType RNA_property_type(PointerRNA *ptr, PropertyRNA *prop);
 PropertySubType RNA_property_subtype(PointerRNA *ptr, PropertyRNA *prop);
+int RNA_property_flag(PointerRNA *ptr, PropertyRNA *prop);
 
 int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop);
 

Modified: branches/blender2.5/blender/source/blender/makesrna/RNA_types.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/RNA_types.h	2009-04-11 00:29:21 UTC (rev 19648)
+++ branches/blender2.5/blender/source/blender/makesrna/RNA_types.h	2009-04-11 01:43:50 UTC (rev 19649)
@@ -89,6 +89,9 @@
 	 * and collections */
 	PROP_ANIMATEABLE = 2,
 
+	/* function paramater flags */
+	PROP_REQUIRED = 4,
+
 	/* internal flags */
 	PROP_BUILTIN = 128,
 	PROP_EXPORT = 256,

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/Makefile
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/Makefile	2009-04-11 00:29:21 UTC (rev 19648)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/Makefile	2009-04-11 01:43:50 UTC (rev 19649)
@@ -77,7 +77,7 @@
 # we want the .o's to be in the makesrna/ directory, but the
 # .c's are in the editors/*/ directories
 
-$(DIR)/$(DEBUG_DIR)%_api.o: ../../editors/interface/*_api.c
+$(DIR)/$(DEBUG_DIR)%_api.o: ../../editors/interface/%_api.c
     ifdef NAN_DEPEND
 	@set -e; $(CC) -M $(CPPFLAGS) $< 2>/dev/null \
 		| sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_ID.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_ID.c	2009-04-11 00:29:21 UTC (rev 19648)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_ID.c	2009-04-11 01:43:50 UTC (rev 19649)
@@ -198,7 +198,8 @@
 	/* XXX temporary for testing */
 	func= RNA_def_function(srna, "rename", "rename_id");
 	RNA_def_function_ui_description(func, "Rename this ID datablock.");
-	RNA_def_string(func, "name", "", 0, "", "New name for the datablock.");
+	prop= RNA_def_string(func, "name", "", 0, "", "New name for the datablock.");
+	RNA_def_property_flag(prop, PROP_REQUIRED);
 }
 
 static void rna_def_library(BlenderRNA *brna)

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c	2009-04-11 00:29:21 UTC (rev 19648)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c	2009-04-11 01:43:50 UTC (rev 19649)
@@ -401,6 +401,13 @@
 	return prop->subtype;
 }
 
+int RNA_property_flag(PointerRNA *ptr, PropertyRNA *prop)
+{
+	rna_idproperty_check(&prop, ptr);
+
+	return prop->flag;
+}
+
 int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
 {
 	IDProperty *idprop;

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c	2009-04-11 00:29:21 UTC (rev 19648)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c	2009-04-11 01:43:50 UTC (rev 19649)
@@ -1404,7 +1404,7 @@
 	dp= rna_find_struct_property_def(prop);
 
 	if(dp)
-		dp->booleannegative= 1;
+		dp->enumbitflags= 1;
 }
 
 void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c	2009-04-11 00:29:21 UTC (rev 19648)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c	2009-04-11 01:43:50 UTC (rev 19649)
@@ -48,6 +48,12 @@
 	DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB);
 }
 
+static void rna_Object_scene_update(bContext *C, PointerRNA *ptr)
+{
+	DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB);
+	DAG_scene_sort(CTX_data_scene(C));
+}
+
 static int rna_VertexGroup_index_get(PointerRNA *ptr)
 {
 	Object *ob= (Object*)ptr->id.data;
@@ -483,6 +489,14 @@
 		{1, "OBJECT", "Object", ""},
 		{0, NULL, NULL, NULL}};
 
+	static EnumPropertyItem dupli_items[] = {
+		{0, "NONE", "None", ""},
+		{OB_DUPLIFRAMES, "FRAMES", "Frames", "Make copy of object for every frame."},
+		{OB_DUPLIVERTS, "VERTS", "Verts", "Duplicate child objects on all vertices."},
+		{OB_DUPLIFACES, "FACES", "Faces", "Duplicate child objects on all faces."},
+		{OB_DUPLIGROUP, "GROUP", "Group", "Enable group instancing."},
+		{0, NULL, NULL, NULL}};
+
 	srna= RNA_def_struct(brna, "Object", "ID");
 	RNA_def_struct_ui_text(srna, "Object", "Object datablock defining an object in a scene..");
 
@@ -720,26 +734,12 @@
 	RNA_def_property_boolean_sdna(prop, NULL, "partype", PARSLOW);
 	RNA_def_property_ui_text(prop, "Slow Parent", "Create a delay in the parent relationship.");
 
-	prop= RNA_def_property(srna, "dupli_frames", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIFRAMES);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE); // clear other flags
-	RNA_def_property_ui_text(prop, "Dupli Frames", "Make copy of object for every frame.");
+	prop= RNA_def_property(srna, "dupli_type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag");
+	RNA_def_property_enum_items(prop, dupli_items);
+	RNA_def_property_ui_text(prop, "Dupli Type", "If not None, object duplication method to use.");
+	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_scene_update");
 
-	prop= RNA_def_property(srna, "dupli_verts", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIVERTS);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE); // clear other flags
-	RNA_def_property_ui_text(prop, "Dupli Verts", "Duplicate child objects on all vertices.");
-
-	prop= RNA_def_property(srna, "dupli_faces", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIFACES);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE); // clear other flags
-	RNA_def_property_ui_text(prop, "Dupli Faces", "Duplicate child objects on all faces.");
-
-	prop= RNA_def_property(srna, "use_dupli_group", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIGROUP);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE); // clear other flags
-	RNA_def_property_ui_text(prop, "Use Dupli Group", "Enable group instancing.");
-
 	prop= RNA_def_property(srna, "dupli_frames_no_speed", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED);
 	RNA_def_property_ui_text(prop, "Dupli Frames No Speed", "Set dupliframes to still, regardless of frame.");





More information about the Bf-blender-cvs mailing list