From c51467cd4c4cdce3833641f63b7cc2f49ea3a1a8 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Wed, 7 Jun 2023 11:19:05 +0200 Subject: [PATCH] Fix #108096: UI: copy-paste buttons can change source properties Pasting numerical array buttons happens with `Ctrl + Alt + V`. Holding `Alt` also triggers uiSelectContext, so having other nodes/ objects etc. selected while doing this would try to copy the pasted values back to other objects (possibly to the ones you pasted from) and that happens relative to the original value, so the value actually changes. NOTE: the `Ctrl + Alt + V` shortcut can also be used on non-array buttons, so was an issue for them as well. To prevent the "copy-to-selected" behavior, refine the `IS_ALLSELECT_EVENT` macro to be more specific. Pull Request: https://projects.blender.org/blender/blender/pulls/108270 --- source/blender/editors/interface/interface_handlers.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_handlers.cc b/source/blender/editors/interface/interface_handlers.cc index 050bf05550c..5cf4cc40365 100644 --- a/source/blender/editors/interface/interface_handlers.cc +++ b/source/blender/editors/interface/interface_handlers.cc @@ -276,7 +276,13 @@ static void ui_selectcontext_apply(bContext *C, const double value, const double value_orig); -# define IS_ALLSELECT_EVENT(event) (((event)->modifier & KM_ALT) != 0) +/** + * Only respond to events which are expected to be used for multi button editing, + * e.g. ALT is also used for button array pasting, see #108096. + */ +# define IS_ALLSELECT_EVENT(event) \ + (((event)->modifier & KM_ALT) != 0 && \ + (ISMOUSE((event)->type) || ELEM((event)->type, EVT_RETKEY, EVT_PADENTER))) /** just show a tinted color so users know its activated */ # define UI_BUT_IS_SELECT_CONTEXT UI_BUT_NODE_ACTIVE