UI: re-enable alt-key for editing selection

Fixes T53950 where changing node layers applies to all selected nodes.
This commit is contained in:
2018-01-31 11:54:04 +11:00
parent d8059a5f11
commit 807713e4f2

View File

@@ -185,6 +185,7 @@ typedef struct uiSelectContextStore {
uiSelectContextElem *elems;
int elems_len;
bool do_free;
bool is_enabled;
/* When set, simply copy values (don't apply difference).
* Rules are:
* - dragging numbers uses delta.
@@ -200,9 +201,7 @@ static void ui_selectcontext_apply(
bContext *C, uiBut *but, struct uiSelectContextStore *selctx_data,
const double value, const double value_orig);
#if 0
#define IS_ALLSELECT_EVENT(event) ((event)->alt != 0)
#endif
/** just show a tinted color so users know its activated */
#define UI_BUT_IS_SELECT_CONTEXT UI_BUT_NODE_ACTIVE
@@ -1180,11 +1179,14 @@ static void ui_multibut_states_apply(bContext *C, uiHandleButtonData *data, uiBl
ui_but_execute_begin(C, ar, but, &active_back);
#ifdef USE_ALLSELECT
if (mbut_state->select_others.elems_len == 0) {
ui_selectcontext_begin(C, but, &mbut_state->select_others);
}
if (mbut_state->select_others.elems_len == 0) {
mbut_state->select_others.elems_len = -1;
if (data->select_others.is_enabled) {
/* init once! */
if (mbut_state->select_others.elems_len == 0) {
ui_selectcontext_begin(C, but, &mbut_state->select_others);
}
if (mbut_state->select_others.elems_len == 0) {
mbut_state->select_others.elems_len = -1;
}
}
/* needed so we apply the right deltas */
@@ -2067,7 +2069,12 @@ static void ui_apply_but(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
else
# endif
if (data->select_others.elems_len == 0) {
ui_selectcontext_begin(C, but, &data->select_others);
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;
}
}
if (data->select_others.elems_len == 0) {
/* dont check again */
@@ -3070,7 +3077,11 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
#ifdef USE_ALLSELECT
if (is_num_but) {
data->select_others.is_copy = true;
if (IS_ALLSELECT_EVENT(win->eventstate)) {
data->select_others.is_enabled = true;
data->select_others.is_copy = true;
}
}
#endif
@@ -3675,6 +3686,15 @@ static void ui_block_open_begin(bContext *C, uiBut *but, uiHandleButtonData *dat
data->menu->popup = but->block->handle->popup;
}
#ifdef USE_ALLSELECT
{
wmWindow *win = CTX_wm_window(C);
if (IS_ALLSELECT_EVENT(win->eventstate)) {
data->select_others.is_enabled = true;
}
}
#endif
/* this makes adjacent blocks auto open from now on */
//if (but->block->auto_open == 0) but->block->auto_open = 1;
}