View 3D: the select operator now uses the cancel flag on failure
Needed so mapping selection to click doesn't pass the click event through to setting the 3D cursor for e.g. While this doesn't happen with the default key-map, setting selection to LMB-click would set the 3D cursor as well (when the selection fell through to nothing).
This commit is contained in:
parent
859c062a2a
commit
3017585ebf
|
@ -2832,13 +2832,16 @@ static int view3d_select_exec(bContext *C, wmOperator *op)
|
|||
changed = ed_object_select_pick(C, mval, ¶ms, center, enumerate, object);
|
||||
}
|
||||
|
||||
/* Pass-through flag may be cleared, see #WM_operator_flag_only_pass_through_on_press. */
|
||||
|
||||
/* Pass-through allows tweaks
|
||||
* FINISHED to signal one operator worked */
|
||||
if (changed) {
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED;
|
||||
}
|
||||
return OPERATOR_PASS_THROUGH; /* nothing selected, just passthrough */
|
||||
/* Nothing selected, just passthrough. */
|
||||
return OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static int view3d_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
|
|
|
@ -32,9 +32,15 @@
|
|||
|
||||
int WM_operator_flag_only_pass_through_on_press(int retval, const struct wmEvent *event)
|
||||
{
|
||||
if ((event->val != KM_PRESS) &&
|
||||
((retval & OPERATOR_PASS_THROUGH) && (retval & OPERATOR_FINISHED))) {
|
||||
retval &= ~OPERATOR_PASS_THROUGH;
|
||||
if (event->val != KM_PRESS) {
|
||||
if (retval & OPERATOR_PASS_THROUGH) {
|
||||
/* Operators that use this function should either finish or cancel,
|
||||
* otherwise non-press events will be passed through to other key-map items. */
|
||||
BLI_assert((retval & ~OPERATOR_PASS_THROUGH) != 0);
|
||||
if (retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED)) {
|
||||
retval &= ~OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue