Fix T86867: Node Editor: Avoid deselect-all triggering on every box-

select

In 'Set/Replace' mode this is not a problem, but 'Extend' or 'Subtract'
modes were useless with the current behavior.
The problem here is that 'node.select' fires before 'node.select_box'
(which is fine) but deselects immediately on click.

This issue has come up before in other editors, see
{T70457}
{rB395dfff103e1}
{rBa8ea1ea1b7d5}

Now delay deselection in empty space to mouse release (same as done in
before mentioned report).

also related:
ref T57918
ref T63994

Maniphest Task: T86867

Differential Revision: https://developer.blender.org/D10801
This commit is contained in:
Philipp Oeser 2021-03-24 12:13:14 +01:00
parent 25c4118651
commit 926f7612fd
Notes: blender-bot 2023-02-14 05:00:07 +01:00
Referenced by issue #86867, Node Editors "Select Box" ignores the select modes Extend and Subtract from Active Tool settings
Referenced by issue #63994, Node Editor: Move All Selected Nodes when dragging
Referenced by issue #57918, Tweaks & Fixes for Improved Left Click Select Support (Parent task)
1 changed files with 12 additions and 4 deletions

View File

@ -568,11 +568,19 @@ static int node_mouse_select(bContext *C,
}
}
else if (deselect_all && node == NULL) {
/* Deselect in empty space. */
for (tnode = snode->edittree->nodes.first; tnode; tnode = tnode->next) {
nodeSetSelected(tnode, false);
/* Rather than deselecting others, users may want to drag to box-select (drag from empty
* space) or tweak-translate an already selected item. If these cases may apply, delay
* deselection. */
if (wait_to_deselect_others) {
ret_value = OPERATOR_RUNNING_MODAL;
}
else {
/* Deselect in empty space. */
for (tnode = snode->edittree->nodes.first; tnode; tnode = tnode->next) {
nodeSetSelected(tnode, false);
}
ret_value = OPERATOR_FINISHED;
}
ret_value = OPERATOR_FINISHED;
}
else if (node != NULL) {
/* When clicking on an already selected node, we want to wait to deselect