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
This commit is contained in:
Philipp Oeser
2023-06-07 11:19:05 +02:00
committed by Philipp Oeser
parent c0bfb81e04
commit c51467cd4c

View File

@@ -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