diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-08-30 13:18:21 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-08-30 13:18:21 +0400 |
commit | 92f6dd73b339d99d2c47afe46b1ca1b817626bf7 (patch) | |
tree | f1f88faa02f162c4bfca45b180e7fbd6345f1ab8 /source | |
parent | e5b1e646e6afcd89999cb36cb0892e068324a6c2 (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 8 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 11 |
2 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 8d3d9a0c747..ce3ace0ae1f 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2993,8 +2993,10 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, 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 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, } } - 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; } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 6cc191757ed..cc7f9c0007c 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -2306,11 +2306,16 @@ static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args) 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 { |