diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-13 19:37:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-13 19:37:44 +0300 |
commit | c1d0f9179d4972eeb85fc8c5e182708ab7385930 (patch) | |
tree | cfbf0846eba173f049d0efcb6b605d955fb43ad5 /source/blender | |
parent | 91352006c4ba8276ff2c7c8ae21461d16cf3f702 (diff) |
fix for error with property getattro in recent commit which broke autocomp.
active base/bone & editbone were not converted to property srna
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 81 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 34 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 6 |
3 files changed, 85 insertions, 36 deletions
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 25d602a8b2e..45710f11a4e 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -623,10 +623,64 @@ static void rna_def_edit_bone(BlenderRNA *brna) 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 @@ static void rna_def_armature(BlenderRNA *brna) 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", ""); - - { /* 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); - } + rna_def_armature_bones(brna, prop); 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); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 0f64210420e..3f3697f5af2 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2222,6 +2222,29 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) } +/* 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,16 +2297,7 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "base", NULL); RNA_def_property_struct_type(prop, "ObjectBase"); RNA_def_property_ui_text(prop, "Bases", ""); - - { /* 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); - } + rna_def_scene_bases(brna, prop); prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "base", NULL); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 865be249fb1..5bf0f5c7ed6 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1494,14 +1494,16 @@ static PyObject *pyrna_prop_getattro( BPy_PropertyRNA *self, PyObject *pyname ) 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; + } } } |