diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-08-31 04:46:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-08-31 05:06:47 +0300 |
commit | 3e4d720ae4836783db978b0a378e97b47dcaca87 (patch) | |
tree | cb53100de53f0aa4de38f9e69eb5221b9e8c98fd /source/blender/makesrna/intern/rna_access.c | |
parent | aabe6e3b457f1d4f1b860ed510bf2630a818465e (diff) |
Fix logical error resolving RNA paths
Only append RNA_path_from_ID_to_struct to context attributes if those
paths resolve to ID types.
Also simplify creating RNA paths by adding utility functions:
- WM_context_path_resolve_property_full
- WM_context_path_resolve_full
Part of fix for T90723.
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index a2905018cc7..51e20eb9e7f 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -5690,7 +5690,7 @@ char *RNA_path_from_struct_to_idproperty(PointerRNA *ptr, IDProperty *needle) return NULL; } -static char *rna_path_from_ID_to_idpgroup(PointerRNA *ptr) +static char *rna_path_from_ID_to_idpgroup(const PointerRNA *ptr) { PointerRNA id_ptr; @@ -5775,7 +5775,7 @@ static char *rna_prepend_real_ID_path(Main *bmain, ID *id, char *path, ID **r_re return prefix[0] != '\0' ? BLI_strdup(prefix) : NULL; } -char *RNA_path_from_ID_to_struct(PointerRNA *ptr) +char *RNA_path_from_ID_to_struct(const PointerRNA *ptr) { char *ptrpath = NULL; @@ -5786,7 +5786,7 @@ char *RNA_path_from_ID_to_struct(PointerRNA *ptr) if (!RNA_struct_is_ID(ptr->type)) { if (ptr->type->path) { /* if type has a path to some ID, use it */ - ptrpath = ptr->type->path(ptr); + ptrpath = ptr->type->path((PointerRNA *)ptr); } else if (ptr->type->nested && RNA_struct_is_ID(ptr->type->nested)) { PointerRNA parentptr; @@ -6156,7 +6156,7 @@ char *RNA_path_struct_property_py(PointerRNA *ptr, PropertyRNA *prop, int index) * Get the struct.property as a python representation, eg: * some_prop[10] */ -char *RNA_path_property_py(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int index) +char *RNA_path_property_py(const PointerRNA *UNUSED(ptr), PropertyRNA *prop, int index) { char *ret; |