improve unregister error check not to loop over parent classes properties (would...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 25 Jan 2011 07:31:11 +0000 (07:31 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 25 Jan 2011 07:31:11 +0000 (07:31 +0000)
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_access.c
source/blender/python/intern/bpy_rna.c

index 56b7cdc6c95785b818036282c84ac036b18d4f14..3d6559878df2246708534763771165df6641e94a 100644 (file)
@@ -623,7 +623,7 @@ const struct ListBase *RNA_struct_type_properties(StructRNA *srna);
 PropertyRNA *RNA_struct_type_find_property(StructRNA *srna, const char *identifier);
 
 FunctionRNA *RNA_struct_find_function(PointerRNA *ptr, const char *identifier);
-const struct ListBase *RNA_struct_defined_functions(StructRNA *srna);
+const struct ListBase *RNA_struct_type_functions(StructRNA *srna);
 
 char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen);
 
index 15a26711d1c94baf10aa21acd02e3d71ba537a43..e6802d03ec48afb6a270d4f2d1bff24c1138bd29 100644 (file)
@@ -616,7 +616,7 @@ FunctionRNA *RNA_struct_find_function(PointerRNA *ptr, const char *identifier)
 #endif
 }
 
-const struct ListBase *RNA_struct_defined_functions(StructRNA *srna)
+const struct ListBase *RNA_struct_type_functions(StructRNA *srna)
 {
        return &srna->functions;
 }
index b57683742fc89b9b24fe2f83b345228f120e1bd3..217d0c9e1bf7fcccfcc001b3e31c00f2f439e0ac 100644 (file)
@@ -5166,7 +5166,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
        }
 
        /* verify callback functions */
-       lb= RNA_struct_defined_functions(srna);
+       lb= RNA_struct_type_functions(srna);
        i= 0;
        for(link=lb->first; link; link=link->next) {
                func= (FunctionRNA*)link;
@@ -5668,26 +5668,25 @@ static PyObject *pyrna_basetype_register(PyObject *UNUSED(self), PyObject *py_cl
 
 static int pyrna_srna_contains_pointer_prop_srna(StructRNA *srna_props, StructRNA *srna, const char **prop_identifier)
 {
-       PointerRNA tptr;
-       PropertyRNA *iterprop;
-       RNA_pointer_create(NULL, &RNA_Struct, srna_props, &tptr);
-       
-       iterprop= RNA_struct_find_property(&tptr, "properties");
+       PropertyRNA *prop;
+       LinkData *link;
 
-       RNA_PROP_BEGIN(&tptr, itemptr, iterprop) {
-               PropertyRNA *prop= itemptr.data;
-               if(RNA_property_type(prop) == PROP_POINTER) {
-                       if (strcmp(RNA_property_identifier(prop), "rna_type") == 0) {
-                               /* pass */
-                       }
-                       else if(RNA_property_pointer_type(&tptr, prop) == srna) {
+       /* verify properties */
+       const ListBase *lb= RNA_struct_type_properties(srna);
+
+       for(link=lb->first; link; link=link->next) {
+               prop= (PropertyRNA*)link;
+               if(RNA_property_type(prop) == PROP_POINTER && !(RNA_property_flag(prop) & PROP_BUILTIN)) {
+                       PointerRNA tptr;
+                       RNA_pointer_create(NULL, &RNA_Struct, srna_props, &tptr);
+
+                       if(RNA_property_pointer_type(&tptr, prop) == srna) {
                                *prop_identifier= RNA_property_identifier(prop);
                                return 1;
                        }
                }
        }
-       RNA_PROP_END;
-       
+
        return 0;
 }