diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-03-11 17:57:11 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2014-03-11 17:58:53 +0400 |
commit | a6bdad699c77209a6ff84a2ec80693feaf9012d0 (patch) | |
tree | 3bc4e29ae64ea8efd151664e45eef6943c5ce64e /source/blender/makesrna/RNA_access.h | |
parent | 89c793f70f2cc65c7ae2a903a8b747a3fb799f38 (diff) |
Fix T39080: copy-to-selected operator fails for pointer properties.
The copy-to-selected operator for RNA buttons uses paths for copying
object pointer properties. Copying other ID data blocks is deliberately
disabled:
https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/interface/interface_ops.c$274
However, the RNA_path_resolve_full function is not properly working for
retrieving pointer properties: it always will dereference pointer
properties in anticipation of further path elements.
In fact the return value of RNA_path_resolve_full has a conflicting
double meaning. It returns `false` when
* the RNA path is invalid
* any of the pointer properties is NULL
This means that it is not capable of returning pointer properties at all.
To make this possible, there is now an internal function for path
parsing, which returns false //only// if the the path is invalid.
On top of this there are 4 wrapper functions for retrieving either
actual property values (RNA_path_resolve, RNA_path_resolve_full) and for
retrieving pointer+property pairs (RNA_path_resolve_property,
RNA_path_resolve_property_full). The latter 2 variants will **not**
dereference pointer properties at the end of the path, so callers can
actually get the property itself. The `***_full` variants include an
array index return value.
Differential Revision: https://developer.blender.org/D396
Diffstat (limited to 'source/blender/makesrna/RNA_access.h')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index ed33098858f..f385d61601a 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -914,14 +914,14 @@ bool RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop); bool RNA_path_resolve_full(PointerRNA *ptr, const char *path, - PointerRNA *r_ptr, PropertyRNA **r_prop, int *index); + PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index); /* path_resolve_property() variants ensure that pointer + property both exist */ bool RNA_path_resolve_property(PointerRNA *ptr, const char *path, - PointerRNA *r_ptr, PropertyRNA **r_prop); + PointerRNA *r_ptr, PropertyRNA **r_prop); bool RNA_path_resolve_property_full(PointerRNA *ptr, const char *path, - PointerRNA *r_ptr, PropertyRNA **r_prop, int *index); + PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index); char *RNA_path_from_ID_to_struct(PointerRNA *ptr); char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop); |