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...
This commit is contained in:
2019-08-23 15:39:19 +02:00
parent 6d64da1e67
commit 18f4182e98
2 changed files with 6 additions and 1 deletions

View File

@@ -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");
}
}

View File

@@ -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"
*/