diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-11 20:12:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-11 20:12:48 +0300 |
commit | f356ea764d46a922065660f66c1d1b4e676638ea (patch) | |
tree | d663a4cd07c73f5306329d5db0ccda71c20f40ca | |
parent | bc6190f3e370d21aff0bd9d96fd43d92382c6466 (diff) |
- use double underscores to hide members in python (removes them from dir() therefor autocomp.)
- collection functions rename eg. bones_active -> bones__active, add_object -> objects__add since these should be accessed from the collections only.
- fix warnings in last commit
-rw-r--r-- | source/blender/blenkernel/intern/group.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fcurve.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fcurve_api.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_group.c | 16 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 4 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 20 |
7 files changed, 32 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index 77bf5859385..3ab02a576d0 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -51,6 +51,7 @@ #include "BKE_library.h" #include "BKE_main.h" #include "BKE_object.h" +#include "BKE_scene.h" /* object_in_scene */ #ifdef HAVE_CONFIG_H #include <config.h> diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index e79d8091917..f73ac517213 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -668,7 +668,7 @@ static void rna_def_armature(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Bones", ""); { /* Collection active property */ - prop_act= RNA_def_property(srna, "bones_active", PROP_POINTER, PROP_NONE); + 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); @@ -685,7 +685,7 @@ static void rna_def_armature(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Edit Bones", ""); { /* Collection active property */ - prop_act= RNA_def_property(srna, "edit_bones_active", PROP_POINTER, PROP_NONE); + 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); diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index cdaebb2a3db..294f38cf3f7 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -611,7 +611,7 @@ static void rna_def_channeldriver(BlenderRNA *brna) /* Collections */ prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "targets", NULL); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "add_target", "remove_target"); + RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "targets__add", "targets__remove"); RNA_def_property_struct_type(prop, "DriverTarget"); RNA_def_property_ui_text(prop, "Target Variables", "Properties acting as targets for this driver."); diff --git a/source/blender/makesrna/intern/rna_fcurve_api.c b/source/blender/makesrna/intern/rna_fcurve_api.c index 12ffb3e26fb..0abb5e8e499 100644 --- a/source/blender/makesrna/intern/rna_fcurve_api.c +++ b/source/blender/makesrna/intern/rna_fcurve_api.c @@ -71,7 +71,7 @@ void RNA_api_drivers(StructRNA *srna) PropertyRNA *parm; /* add target */ - func= RNA_def_function(srna, "add_target", "rna_Driver_add_target"); + func= RNA_def_function(srna, "targets__add", "rna_Driver_add_target"); RNA_def_function_ui_description(func, "Add a new target for the driver."); /* return type */ parm= RNA_def_pointer(func, "target", "DriverTarget", "", "Newly created Driver Target."); @@ -80,7 +80,7 @@ void RNA_api_drivers(StructRNA *srna) parm= RNA_def_string(func, "name", "", 64, "Name", "Name to use in scripted expressions/functions. (No spaces or dots are allowed. Also, must not start with a symbol or digit)"); /* remove target */ - func= RNA_def_function(srna, "remove_target", "rna_Driver_remove_target"); + func= RNA_def_function(srna, "targets__remove", "rna_Driver_remove_target"); RNA_def_function_ui_description(func, "Remove an existing target from the driver."); /* target to remove*/ parm= RNA_def_pointer(func, "target", "DriverTarget", "", "Target to remove from the driver."); diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c index 8f6a5f1005c..8babb9593a0 100644 --- a/source/blender/makesrna/intern/rna_group.c +++ b/source/blender/makesrna/intern/rna_group.c @@ -38,6 +38,9 @@ #include "BKE_group.h" +#include "WM_api.h" +#include "WM_types.h" + static PointerRNA rna_Group_objects_get(CollectionPropertyIterator *iter) { ListBaseIterator *internal= iter->internal; @@ -48,11 +51,13 @@ static PointerRNA rna_Group_objects_get(CollectionPropertyIterator *iter) static int rna_Group_objects_add(Group *group, bContext *C, Object *object) { + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, &object->id); return add_to_group(group, object, CTX_data_scene(C), NULL); } static int rna_Group_objects_remove(Group *group, bContext *C, Object *object) { + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, &object->id); return rem_from_group(group, object, CTX_data_scene(C), NULL); } @@ -63,6 +68,9 @@ void RNA_def_group(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; + FunctionRNA *func; + PropertyRNA *parm; + srna= RNA_def_struct(brna, "Group", "ID"); RNA_def_struct_ui_text(srna, "Group", "Group of Object datablocks."); RNA_def_struct_ui_icon(srna, ICON_GROUP); @@ -79,9 +87,7 @@ void RNA_def_group(BlenderRNA *brna) /* add object */ - FunctionRNA *func; - PropertyRNA *parm; - func= RNA_def_function(srna, "add_object", "rna_Group_objects_add"); + func= RNA_def_function(srna, "objects__add", "rna_Group_objects_add"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_function_ui_description(func, "Add this object to a group"); /* return type */ @@ -92,7 +98,7 @@ void RNA_def_group(BlenderRNA *brna) RNA_def_property_flag(parm, PROP_REQUIRED); /* remove object */ - func= RNA_def_function(srna, "remove_object", "rna_Group_objects_remove"); + func= RNA_def_function(srna, "objects__remove", "rna_Group_objects_remove"); RNA_def_function_ui_description(func, "Remove this object to a group"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); /* return type */ @@ -106,7 +112,7 @@ void RNA_def_group(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "gobject", NULL); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Objects", "A collection of this groups objects."); - RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Group_objects_get", 0, 0, 0, "add_object", "remove_object"); + RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Group_objects_get", 0, 0, 0, "objects__add", "objects__remove"); } #endif diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 6d198e10b38..943d559133f 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2225,7 +2225,7 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Bases", ""); { /* Collection active property */ - prop_act= RNA_def_property(srna, "base_active", PROP_POINTER, PROP_NONE); + 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); @@ -2241,7 +2241,7 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Scene_objects_get", 0, 0, 0, 0, 0); { /* Collection active property */ - prop_act= RNA_def_property(srna, "objects_active", PROP_POINTER, PROP_NONE); + prop_act= RNA_def_property(srna, "objects__active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop_act, "Object"); RNA_def_property_pointer_funcs(prop_act, "rna_Scene_active_object_get", "rna_Scene_active_object_set", NULL); RNA_def_property_flag(prop_act, PROP_EDITABLE); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index b47214bdded..3dcb47a0905 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1306,10 +1306,11 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA * self) nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name)); if(nameptr) { - pystring = PyUnicode_FromString(nameptr); - PyList_Append(ret, pystring); - Py_DECREF(pystring); - + if(strstr(nameptr, "__")==NULL) { /* __ for hidden props, used for active object for eg. */ + pystring = PyUnicode_FromString(nameptr); + PyList_Append(ret, pystring); + Py_DECREF(pystring); + } if(name != nameptr) MEM_freeN(nameptr); } @@ -1323,14 +1324,19 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA * self) * Collect RNA function items */ PointerRNA tptr; + const char *idname; RNA_pointer_create(NULL, &RNA_Struct, self->ptr.type, &tptr); iterprop= RNA_struct_find_property(&tptr, "functions"); RNA_PROP_BEGIN(&tptr, itemptr, iterprop) { - pystring = PyUnicode_FromString(RNA_function_identifier(itemptr.data)); - PyList_Append(ret, pystring); - Py_DECREF(pystring); + idname= RNA_function_identifier(itemptr.data); + + if(strstr(idname, "__")==NULL) { /* __ for hidden function members, used for collection add/remove for eg. */ + pystring = PyUnicode_FromString(idname); + PyList_Append(ret, pystring); + Py_DECREF(pystring); + } } RNA_PROP_END; } |