- In the context, EditBones and Bases were set as 'RNA_UnknownType', replaced with...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 11 Nov 2009 09:16:53 +0000 (09:16 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 11 Nov 2009 09:16:53 +0000 (09:16 +0000)
- renamed RNA_Base to RNA_ObjectBase
- only include id_data for the python api's autocomplete if it has an ID type set.

release/scripts/modules/bpy_types.py
source/blender/editors/screen/screen_context.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_scene.c
source/blender/python/intern/bpy_rna.c

index 23862c5c840f6bceec9e08d8aeee088e9477b43c..5a8b46c92d652241ce869afe90c72bcf319187a4 100644 (file)
@@ -26,8 +26,9 @@ class Context(StructRNA):
     
     def copy(self):
         new_context = {}
+        generic_keys = StructRNA.__dict__.keys()
         for item in dir(self):
-            if item not in StructRNA.__dict__ and item != "id_data":
+            if item not in generic_keys:
                 new_context[item] = getattr(self, item)
             
         return new_context
index 1a1def70717d6561dfd05af7741e402ea59baed2..1672f8f332505de99a8227705acd534a03f42472 100644 (file)
@@ -84,7 +84,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
                                if(selected_objects)
                                        CTX_data_id_list_add(result, &base->object->id);
                                else
-                                       CTX_data_list_add(result, &scene->id, &RNA_UnknownType, base);
+                                       CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
                        }
                }
 
@@ -100,7 +100,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
                                                if(selected_editable_objects)
                                                        CTX_data_id_list_add(result, &base->object->id);
                                                else
-                                                       CTX_data_list_add(result, &scene->id, &RNA_UnknownType, base);
+                                                       CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
                                        }
                                }
                        }
@@ -131,18 +131,18 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
                                        if (editable_bones) {
                                                /* only selected + editable */
                                                if (EBONE_EDITABLE(ebone)) {
-                                                       CTX_data_list_add(result, &arm->id, &RNA_UnknownType, ebone);
+                                                       CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
                                                
                                                        if ((flipbone) && !(flipbone->flag & BONE_SELECTED))
-                                                               CTX_data_list_add(result, &arm->id, &RNA_UnknownType, flipbone);
+                                                               CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
                                                }
                                        }
                                        else {
                                                /* only include bones if visible */
-                                               CTX_data_list_add(result, &arm->id, &RNA_UnknownType, ebone);
+                                               CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
                                                
                                                if ((flipbone) && EBONE_VISIBLE(arm, flipbone)==0)
-                                                       CTX_data_list_add(result, &arm->id, &RNA_UnknownType, flipbone);
+                                                       CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
                                        }
                                }
                        }       
@@ -173,18 +173,18 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
                                        if (selected_editable_bones) {
                                                /* only selected + editable */
                                                if (EBONE_EDITABLE(ebone)) {
-                                                       CTX_data_list_add(result, &arm->id, &RNA_UnknownType, ebone);
+                                                       CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
                                                
                                                        if ((flipbone) && !(flipbone->flag & BONE_SELECTED))
-                                                               CTX_data_list_add(result, &arm->id, &RNA_UnknownType, flipbone);
+                                                               CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
                                                }
                                        }
                                        else {
                                                /* only include bones if selected */
-                                               CTX_data_list_add(result, &arm->id, &RNA_UnknownType, ebone);
+                                               CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
                                                
                                                if ((flipbone) && !(flipbone->flag & BONE_SELECTED))
-                                                       CTX_data_list_add(result, &arm->id, &RNA_UnknownType, flipbone);
+                                                       CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
                                        }
                                }
                        }       
@@ -251,7 +251,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
        }
        else if(CTX_data_equals(member, "active_base")) {
                if(base)
-                       CTX_data_pointer_set(result, &scene->id, &RNA_UnknownType, base);
+                       CTX_data_pointer_set(result, &scene->id, &RNA_ObjectBase, base);
 
                return 1;
        }
index d470774f76ad5c5f9d8e7b0a6e2ffaa0f1fe70e8..a755c8ffe76016eb3306b239b44fbf4ae469eb59 100644 (file)
@@ -676,7 +676,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
                                        if(selected_objects)
                                                CTX_data_id_list_add(result, &base->object->id);
                                        else
-                                               CTX_data_list_add(result, &scene->id, &RNA_UnknownType, base);
+                                               CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
                                }
                        }
                }
@@ -693,7 +693,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
                                                if(selected_editable_objects)
                                                        CTX_data_id_list_add(result, &base->object->id);
                                                else
-                                                       CTX_data_list_add(result, &scene->id, &RNA_UnknownType, base);
+                                                       CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
                                        }
                                }
                        }
@@ -710,7 +710,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
                                        if(visible_objects)
                                                CTX_data_id_list_add(result, &base->object->id);
                                        else
-                                               CTX_data_list_add(result, &scene->id, &RNA_UnknownType, base);
+                                               CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
                                }
                        }
                }
@@ -726,7 +726,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
                                        if(selectable_objects)
                                                CTX_data_id_list_add(result, &base->object->id);
                                        else
-                                               CTX_data_list_add(result, &scene->id, &RNA_UnknownType, base);
+                                               CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
                                }
                        }
                }
@@ -736,7 +736,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
        else if(CTX_data_equals(member, "active_base")) {
                if(scene->basact && (scene->basact->lay & lay))
                        if((scene->basact->object->restrictflag & OB_RESTRICT_VIEW)==0)
-                               CTX_data_pointer_set(result, &scene->id, &RNA_UnknownType, scene->basact);
+                               CTX_data_pointer_set(result, &scene->id, &RNA_ObjectBase, scene->basact);
                
                return 1;
        }
index b20914181c8645570c9efabeb3fc1359a38f5d5d..8d3c3168e003ea85be37171981c36359a682659f 100644 (file)
@@ -315,6 +315,7 @@ extern StructRNA RNA_NoiseTexture;
 extern StructRNA RNA_NorController;
 extern StructRNA RNA_Nurb;
 extern StructRNA RNA_Object;
+extern StructRNA RNA_ObjectBase;
 extern StructRNA RNA_ObstacleFluidSettings;
 extern StructRNA RNA_Operator;
 extern StructRNA RNA_OperatorFileListElement;
index a02dcb7d9a2e3ed6c70b1703401211d3a634ba87..63a7d68a0cdcffbcabcbdf670261391546853a26 100644 (file)
@@ -1763,7 +1763,7 @@ static void rna_def_base(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
-       srna= RNA_def_struct(brna, "Base", NULL);
+       srna= RNA_def_struct(brna, "ObjectBase", NULL);
        RNA_def_struct_sdna(srna, "Base");
        RNA_def_struct_ui_text(srna, "Object Base", "An objects instance in a scene.");
        RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
index 1ea342de163a3e0f0dc5b68f25a4064edf01e404..6d198e10b38bd8e91ee2ec292cfcf75bc38987c1 100644 (file)
@@ -2221,12 +2221,12 @@ void RNA_def_scene(BlenderRNA *brna)
        /* Bases/Objects */
        prop= RNA_def_property(srna, "bases", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "base", NULL);
-       RNA_def_property_struct_type(prop, "Base");
+       RNA_def_property_struct_type(prop, "ObjectBase");
        RNA_def_property_ui_text(prop, "Bases", "");
 
        { /* Collection active property */
                prop_act= RNA_def_property(srna, "base_active", PROP_POINTER, PROP_NONE);
-               RNA_def_property_struct_type(prop_act, "Base");
+               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 in the scene.");
index c06931feedb7156ef4e65db7ec93db4b1060409f..76a1b860520129b2fa0c0bb62f6d7bf91257dbf8 100644 (file)
@@ -1349,7 +1349,7 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA * self)
        }
        
        /* Hard coded names */
-       {
+       if(self->ptr.id.data) {
                pystring = PyUnicode_FromString("id_data");
                PyList_Append(ret, pystring);
                Py_DECREF(pystring);