diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-08-23 16:39:19 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-08-23 16:55:00 +0300 |
commit | 18f4182e983f2c99e09f0a9203be91b53c161e22 (patch) | |
tree | 9b9a6dba022b858eb012fc4a0719160b1fa6faef | |
parent | 6d64da1e67e319e826450cefc1f6541b0fbb57e9 (diff) |
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...
-rw-r--r-- | source/blender/editors/interface/interface_ops.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 4 |
2 files changed, 6 insertions, 1 deletions
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" */ |