diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_ops.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index b1a34a09eec..61869f3da41 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1023,7 +1023,43 @@ bool UI_context_copy_to_selected_check(PointerRNA *ptr, return false; } - if ((lprop != prop)) { + /* Skip non-existing properties on link. This was previously covered with the lprop != prop check + * but we are now more permissive when it comes to ID properties, see below. */ + if (lprop == NULL) { + return false; + } + + if (RNA_property_type(lprop) != RNA_property_type(prop)) { + return false; + } + + /* Check property pointers matching + * For ID properties, these pointers match + * - if the property is API defined on an existing class (and they are equally named) + * - never for ID properties on specific ID (even if they are equally named) + * - never for NodesModifierSettings properties (even if they are equally named) + * + * Be permissive on ID properties in the following cases: + * - NodesModifierSettings properties + * - (special check: only if the nodegroup matches, since the 'Input_n' properties are name + * based and similar on potentionally very different nodegroups) + * - ID properties on specific ID + * - (no special check, copying seems OK [even if type does not match -- does not do anything + * then]) + */ + bool ignore_prop_eq = RNA_property_is_idprop(lprop) && RNA_property_is_idprop(prop); + if (RNA_struct_is_a(lptr.type, &RNA_NodesModifier) && + RNA_struct_is_a(ptr->type, &RNA_NodesModifier)) { + ignore_prop_eq = false; + + NodesModifierData *nmd_link = (NodesModifierData *)lptr.data; + NodesModifierData *nmd_src = (NodesModifierData *)ptr->data; + if (nmd_link->node_group == nmd_src->node_group) { + ignore_prop_eq = true; + } + } + + if ((lprop != prop) && !ignore_prop_eq) { return false; } |