[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24550] trunk/blender/source/blender: fix for error with property getattro in recent commit which broke autocomp .
Campbell Barton
ideasman42 at gmail.com
Fri Nov 13 17:37:45 CET 2009
Revision: 24550
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24550
Author: campbellbarton
Date: 2009-11-13 17:37:44 +0100 (Fri, 13 Nov 2009)
Log Message:
-----------
fix for error with property getattro in recent commit which broke autocomp.
active base/bone & editbone were not converted to property srna
Modified Paths:
--------------
trunk/blender/source/blender/makesrna/intern/rna_armature.c
trunk/blender/source/blender/makesrna/intern/rna_scene.c
trunk/blender/source/blender/python/intern/bpy_rna.c
Modified: trunk/blender/source/blender/makesrna/intern/rna_armature.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_armature.c 2009-11-13 16:08:03 UTC (rev 24549)
+++ trunk/blender/source/blender/makesrna/intern/rna_armature.c 2009-11-13 16:37:44 UTC (rev 24550)
@@ -623,10 +623,64 @@
RNA_define_verify_sdna(1);
}
+
+/* armature.bones.* */
+static void rna_def_armature_bones(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+// FunctionRNA *func;
+// PropertyRNA *parm;
+
+ srna= RNA_def_struct(brna, "ArmatureBones", NULL);
+ RNA_def_struct_sdna(srna, "bArmature");
+ RNA_def_struct_ui_text(srna, "Armature Bones", "Collection of armature bones.");
+
+ RNA_def_property_srna(cprop, "ArmatureBones");
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Bone");
+ RNA_def_property_pointer_sdna(prop, NULL, "act_bone");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Bone", "Armatures active bone.");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_bone_set", NULL);
+
+ /* todo, redraw */
+// RNA_def_property_collection_active(prop, prop_act);
+}
+
+/* armature.bones.* */
+static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+// FunctionRNA *func;
+// PropertyRNA *parm;
+
+ srna= RNA_def_struct(brna, "ArmatureEditBones", NULL);
+ RNA_def_struct_sdna(srna, "bArmature");
+ RNA_def_struct_ui_text(srna, "Armature EditBones", "Collection of armature edit bones.");
+
+ RNA_def_property_srna(cprop, "ArmatureEditBones");
+
+ prop= RNA_def_property(srna, "edit_bones", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "EditBone");
+ RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone.");
+ //RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL);
+
+ /* todo, redraw */
+// RNA_def_property_collection_active(prop, prop_act);
+}
+
static void rna_def_armature(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop, *prop_act;
+ PropertyRNA *prop;
static EnumPropertyItem prop_drawtype_items[] = {
{ARM_OCTA, "OCTAHEDRAL", 0, "Octahedral", "Display bones as octahedral shape (default)."},
@@ -666,34 +720,13 @@
RNA_def_property_collection_funcs(prop, 0, "rna_Armature_bones_next", 0, 0, 0, 0, 0);
RNA_def_property_struct_type(prop, "Bone");
RNA_def_property_ui_text(prop, "Bones", "");
+ rna_def_armature_bones(brna, prop);
- { /* Collection active property */
- prop_act= RNA_def_property(srna, "bones__active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop_act, "Bone");
- RNA_def_property_pointer_sdna(prop_act, NULL, "act_bone");
- RNA_def_property_flag(prop_act, PROP_EDITABLE);
- RNA_def_property_ui_text(prop_act, "Active Bone", "Armatures active bone.");
- RNA_def_property_pointer_funcs(prop_act, NULL, "rna_Armature_act_bone_set", NULL);
-
- /* todo, redraw */
-// RNA_def_property_collection_active(prop, prop_act);
- }
-
prop= RNA_def_property(srna, "edit_bones", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "edbo", NULL);
RNA_def_property_struct_type(prop, "EditBone");
RNA_def_property_ui_text(prop, "Edit Bones", "");
-
- { /* Collection active property */
- prop_act= RNA_def_property(srna, "edit_bones__active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop_act, "EditBone");
- RNA_def_property_pointer_sdna(prop_act, NULL, "act_edbone");
- RNA_def_property_flag(prop_act, PROP_EDITABLE);
- RNA_def_property_ui_text(prop_act, "Active EditBone", "Armatures active edit bone.");
- //RNA_def_property_update(prop_act, 0, "rna_Armature_act_editbone_update");
- RNA_def_property_pointer_funcs(prop_act, NULL, "rna_Armature_act_edit_bone_set", NULL);
-// RNA_def_property_collection_active(prop, prop_act);
- }
+ rna_def_armature_edit_bones(brna, prop);
/* Enum values */
// prop= RNA_def_property(srna, "rest_position", PROP_BOOLEAN, PROP_NONE);
Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c 2009-11-13 16:08:03 UTC (rev 24549)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c 2009-11-13 16:37:44 UTC (rev 24550)
@@ -2222,6 +2222,29 @@
}
+/* scene.bases.* */
+static void rna_def_scene_bases(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+// FunctionRNA *func;
+// PropertyRNA *parm;
+
+ srna= RNA_def_struct(brna, "SceneBases", NULL);
+ RNA_def_struct_sdna(srna, "Scene");
+ RNA_def_struct_ui_text(srna, "Scene Bases", "Collection of scene bases.");
+
+ RNA_def_property_srna(cprop, "SceneBases");
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ObjectBase");
+ RNA_def_property_pointer_sdna(prop, NULL, "basact");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Base", "Active object base in the scene.");
+ RNA_def_property_update(prop, NC_SCENE|ND_OB_ACTIVE, NULL);
+}
+
void RNA_def_scene(BlenderRNA *brna)
{
StructRNA *srna;
@@ -2274,17 +2297,8 @@
RNA_def_property_collection_sdna(prop, NULL, "base", NULL);
RNA_def_property_struct_type(prop, "ObjectBase");
RNA_def_property_ui_text(prop, "Bases", "");
+ rna_def_scene_bases(brna, prop);
- { /* Collection active property */
- prop_act= RNA_def_property(srna, "bases__active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop_act, "ObjectBase");
- RNA_def_property_pointer_sdna(prop_act, NULL, "basact");
- RNA_def_property_flag(prop_act, PROP_EDITABLE);
- RNA_def_property_ui_text(prop_act, "Active Base", "Active object base in the scene.");
- RNA_def_property_update(prop_act, NC_SCENE|ND_OB_ACTIVE, NULL);
-// RNA_def_property_collection_active(prop, prop_act);
- }
-
prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "base", NULL);
RNA_def_property_struct_type(prop, "Object");
Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c 2009-11-13 16:08:03 UTC (rev 24549)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c 2009-11-13 16:37:44 UTC (rev 24550)
@@ -1494,14 +1494,16 @@
if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
if ((prop = RNA_struct_find_property(&r_ptr, name))) {
ret = pyrna_prop_to_py(&r_ptr, prop);
+
+ return ret;
}
else if ((func = RNA_struct_find_function(&r_ptr, name))) {
PyObject *self_collection= pyrna_struct_CreatePyObject(&r_ptr);
ret = pyrna_func_to_py((BPy_DummyPointerRNA *)self_collection, func);
Py_DECREF(self_collection);
+
+ return ret;
}
-
- return ret;
}
}
More information about the Bf-blender-cvs
mailing list