Fix #112028: Ctrl+Alt+Scroll not working on all selected objects

Regression from c51467cd4c.

Above commit made the IS_ALLSELECT_EVENT more strict and now excluded
mousewheel events.

Refining IS_ALLSELECT_EVENT even further (to respect mousewheel there)
is unfortunately not easily possible since mouswheel events are excluded
from `win->eventstate` (could only be retrieved from `win->event_queue`
but that is not reliable either since it might have events that are not
handled yet).

Possible solutions:
___
Adding mouswheel events to `win->eventstate`
- seemed to risky (could not forsee all possible consequences this would
have, e.g. double-click behavior)
___
Moving shortcuts for button array copy/paste from ALT to SHIFT
- downside: breaking user habits
- upside: additionally holding ALT could open the door for pasting on
all selected items
-- downside: without further work to make paste to multiple work better,
it would bring back #108096
___

So propose to do what was first suggested in #108270 as a third
solution:

Instead of refining IS_ALLSELECT_EVENT, bring it back to the state
before c51467cd4c (So `Ctrl + Alt + V` would still pass this test), but
specifically "filter out `Ctrl + Alt + V` right after in ui_apply_but().

Pull Request: https://projects.blender.org/blender/blender/pulls/112095
This commit is contained in:
Philipp Oeser
2023-09-11 15:33:36 +02:00
committed by Philipp Oeser
parent 81c6eb9c7f
commit 397a0a0e7e

View File

@@ -278,12 +278,12 @@ static void ui_selectcontext_apply(bContext *C,
const double value_orig);
/**
* 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)))
* Ideally we would only respond to events which are expected to be used for multi button editing
* (additionally checking if this is a mouse[wheel] or returnkey event to avoid the ALT conflict
* with button array pasting, see #108096, but unfortunately wheel events are not part of
* win->eventstate with modifiers held down. Instead, the conflict is avoided by specifically
* filtering out CTRL ALT V in ui_apply_but(). */
# define IS_ALLSELECT_EVENT(event) (((event)->modifier & KM_ALT) != 0)
/** just show a tinted color so users know its activated */
# define UI_BUT_IS_SELECT_CONTEXT UI_BUT_NODE_ACTIVE
@@ -2267,10 +2267,17 @@ static void ui_apply_but(
if (data->select_others.elems_len == 0)
{
wmWindow *win = CTX_wm_window(C);
/* may have been enabled before activating */
if (data->select_others.is_enabled || IS_ALLSELECT_EVENT(win->eventstate)) {
ui_selectcontext_begin(C, but, &data->select_others);
data->select_others.is_enabled = true;
wmEvent *event = win->eventstate;
/* May have been enabled before activating, dont do for array pasting. */
if (data->select_others.is_enabled || IS_ALLSELECT_EVENT(event)) {
/* See comment for IS_ALLSELECT_EVENT why this needs to be filtered here. */
const bool is_array_paste = (event->val == KM_PRESS) &&
(event->modifier & (KM_CTRL | KM_OSKEY)) &&
(event->modifier & KM_SHIFT) == 0 && (event->type == EVT_VKEY);
if (!is_array_paste) {
ui_selectcontext_begin(C, but, &data->select_others);
data->select_others.is_enabled = true;
}
}
}
if (data->select_others.elems_len == 0) {