diff --git a/source/blender/editors/interface/interface_ops.cc b/source/blender/editors/interface/interface_ops.cc index 78fbcbb830e..ef9f584a00f 100644 --- a/source/blender/editors/interface/interface_ops.cc +++ b/source/blender/editors/interface/interface_ops.cc @@ -1346,6 +1346,7 @@ bool UI_context_copy_to_selected_list(bContext *C, return false; } + /* Account for properties only being available for some sequence types. */ if (ensure_list_items_contain_prop) { const char *prop_id = RNA_property_identifier(prop); LISTBASE_FOREACH_MUTABLE (CollectionPointerLink *, link, r_lb) { @@ -1358,6 +1359,19 @@ bool UI_context_copy_to_selected_list(bContext *C, } } + /* Similarly account for custom properties only being available for some members in selection. */ + if (RNA_property_is_idprop(prop)) { + PointerRNA dummy_ptr; + PropertyRNA *dummy_prop; + const char *prop_py = RNA_path_property_py(ptr, prop, -1); + LISTBASE_FOREACH_MUTABLE (CollectionPointerLink *, link, r_lb) { + if (!RNA_path_resolve_property(&link->ptr, prop_py, &dummy_ptr, &dummy_prop)) { + BLI_remlink(r_lb, link); + MEM_freeN(link); + } + } + } + return true; } @@ -1388,6 +1402,9 @@ bool UI_context_copy_to_selected_check(PointerRNA *ptr, RNA_path_resolve_property(ptr_link, path, &lptr, &lprop); } else { + /* This assumes the property is valid on link (not necessarily the case for custom properties + * on e.g. bones though). But non-existing custom properties get filtered out in + * UI_context_copy_to_selected_list(). */ lptr = *ptr_link; lprop = prop; }