From 3e4d720ae4836783db978b0a378e97b47dcaca87 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 31 Aug 2021 11:46:47 +1000 Subject: 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. --- source/blender/makesrna/intern/rna_access.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/makesrna/intern/rna_access.c') 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; -- cgit v1.2.3