[Bf-blender-cvs] [18f4182e983] master: LibOverride: Fixed bug in removing override op operator.

Bastien Montagne noreply at git.blender.org
Fri Aug 23 15:55:06 CEST 2019


Commit: 18f4182e983f2c99e09f0a9203be91b53c161e22
Author: Bastien Montagne
Date:   Fri Aug 23 15:39:19 2019 +0200
Branches: master
https://developer.blender.org/rB18f4182e983f2c99e09f0a9203be91b53c161e22

LibOverride: Fixed bug in removing override op operator.

In case the property is a RNA pointer, `RNA_path_resolve()` will try to
resolve it and return that pointer, instead of returning expected
container... That is a bad inconsistency in the rNA path API, but no
proper way to solve it for now...

===================================================================

M	source/blender/editors/interface/interface_ops.c
M	source/blender/makesrna/intern/rna_access.c

===================================================================

diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 819ec4fc2d3..0afd67e5e66 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -629,8 +629,9 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
   /* We need source (i.e. linked data) to restore values of deleted overrides...
    * If this is an override template, we obviously do not need to restore anything. */
   if (!is_template) {
+    PropertyRNA *src_prop;
     RNA_id_pointer_create(id->override_library->reference, &id_refptr);
-    if (!RNA_path_resolve(&id_refptr, oprop->rna_path, &src, NULL)) {
+    if (!RNA_path_resolve_property(&id_refptr, oprop->rna_path, &src, &src_prop)) {
       BLI_assert(0 && "Failed to create matching source (linked data) RNA pointer");
     }
   }
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index d44020a52a1..8327456f460 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -5360,6 +5360,10 @@ static bool rna_path_parse(PointerRNA *ptr,
  * Resolve the given RNA Path to find the pointer and/or property
  * indicated by fully resolving the path.
  *
+ * \warning Unlike \a RNA_path_resolve_property(), that one *will* try to follow RNAPointers,
+ * e.g. the path 'parent' applied to a RNAObject \a ptr will return the object.parent in \a r_ptr,
+ * and a NULL \a r_prop...
+ *
  * \note Assumes all pointers provided are valid
  * \return True if path can be resolved to a valid "pointer + property" OR "pointer only"
  */



More information about the Bf-blender-cvs mailing list