[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31659] trunk/blender/source/blender: fix for resolving rna paths, RNA_path_resolve could return a property which was the parent of the pointer (when it would normally be assumed to be the child).
Campbell Barton
ideasman42 at gmail.com
Mon Aug 30 11:18:21 CEST 2010
Revision: 31659
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31659
Author: campbellbarton
Date: 2010-08-30 11:18:21 +0200 (Mon, 30 Aug 2010)
Log Message:
-----------
fix for resolving rna paths, RNA_path_resolve could return a property which was the parent of the pointer (when it would normally be assumed to be the child).
also change pythons struct_rna.path_resolve to return StructRNA's or Properties when the property isnt NULL.
Modified Paths:
--------------
trunk/blender/source/blender/makesrna/intern/rna_access.c
trunk/blender/source/blender/python/intern/bpy_rna.c
Modified: trunk/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_access.c 2010-08-30 08:44:36 UTC (rev 31658)
+++ trunk/blender/source/blender/makesrna/intern/rna_access.c 2010-08-30 09:18:21 UTC (rev 31659)
@@ -2993,8 +2993,10 @@
case PROP_POINTER:
nextptr= RNA_property_pointer_get(&curptr, prop);
- if(nextptr.data)
+ if(nextptr.data) {
curptr= nextptr;
+ prop= NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
+ }
else
return 0;
@@ -3033,8 +3035,10 @@
}
}
- if(nextptr.data)
+ if(nextptr.data) {
curptr= nextptr;
+ prop= NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
+ }
else
return 0;
}
Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c 2010-08-30 08:44:36 UTC (rev 31658)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c 2010-08-30 09:18:21 UTC (rev 31659)
@@ -2306,11 +2306,16 @@
return NULL;
if (RNA_path_resolve(&self->ptr, path, &r_ptr, &r_prop)) {
- if(coerce == Py_False) {
- return pyrna_prop_CreatePyObject(&r_ptr, r_prop);
+ if(r_prop) {
+ if(coerce == Py_False) {
+ return pyrna_prop_CreatePyObject(&r_ptr, r_prop);
+ }
+ else {
+ return pyrna_prop_to_py(&r_ptr, r_prop);
+ }
}
else {
- return pyrna_prop_to_py(&r_ptr, r_prop);
+ return pyrna_struct_CreatePyObject(&r_ptr);
}
}
else {
More information about the Bf-blender-cvs
mailing list