[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24503] trunk/blender/source/blender: - use double underscores to hide members in python (removes them from dir( ) therefor autocomp.)
Campbell Barton
ideasman42 at gmail.com
Wed Nov 11 18:12:48 CET 2009
Revision: 24503
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24503
Author: campbellbarton
Date: 2009-11-11 18:12:48 +0100 (Wed, 11 Nov 2009)
Log Message:
-----------
- 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
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/group.c
trunk/blender/source/blender/makesrna/intern/rna_armature.c
trunk/blender/source/blender/makesrna/intern/rna_fcurve.c
trunk/blender/source/blender/makesrna/intern/rna_fcurve_api.c
trunk/blender/source/blender/makesrna/intern/rna_group.c
trunk/blender/source/blender/makesrna/intern/rna_scene.c
trunk/blender/source/blender/python/intern/bpy_rna.c
Modified: trunk/blender/source/blender/blenkernel/intern/group.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/group.c 2009-11-11 16:28:53 UTC (rev 24502)
+++ trunk/blender/source/blender/blenkernel/intern/group.c 2009-11-11 17:12:48 UTC (rev 24503)
@@ -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>
Modified: trunk/blender/source/blender/makesrna/intern/rna_armature.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_armature.c 2009-11-11 16:28:53 UTC (rev 24502)
+++ trunk/blender/source/blender/makesrna/intern/rna_armature.c 2009-11-11 17:12:48 UTC (rev 24503)
@@ -668,7 +668,7 @@
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 @@
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);
Modified: trunk/blender/source/blender/makesrna/intern/rna_fcurve.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_fcurve.c 2009-11-11 16:28:53 UTC (rev 24502)
+++ trunk/blender/source/blender/makesrna/intern/rna_fcurve.c 2009-11-11 17:12:48 UTC (rev 24503)
@@ -611,7 +611,7 @@
/* 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.");
Modified: trunk/blender/source/blender/makesrna/intern/rna_fcurve_api.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_fcurve_api.c 2009-11-11 16:28:53 UTC (rev 24502)
+++ trunk/blender/source/blender/makesrna/intern/rna_fcurve_api.c 2009-11-11 17:12:48 UTC (rev 24503)
@@ -71,7 +71,7 @@
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 @@
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.");
Modified: trunk/blender/source/blender/makesrna/intern/rna_group.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_group.c 2009-11-11 16:28:53 UTC (rev 24502)
+++ trunk/blender/source/blender/makesrna/intern/rna_group.c 2009-11-11 17:12:48 UTC (rev 24503)
@@ -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 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 @@
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 @@
/* 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 @@
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 @@
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
Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c 2009-11-11 16:28:53 UTC (rev 24502)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c 2009-11-11 17:12:48 UTC (rev 24503)
@@ -2225,7 +2225,7 @@
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 @@
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);
Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c 2009-11-11 16:28:53 UTC (rev 24502)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c 2009-11-11 17:12:48 UTC (rev 24503)
@@ -1306,10 +1306,11 @@
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 @@
* 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;
}
More information about the Bf-blender-cvs
mailing list