Keymap: "Mouse Select & Move" now uses click to de-select others

While it's useful for click-drag to leave the selection as-is
(when clicking on items that are already selected), it's useful
for a single click to de-select all other elements.

This also removes the need for the initial selection to set the object
as active since this is possible by clicking on it.
This commit is contained in:
Campbell Barton 2022-03-30 12:27:35 +11:00
parent 400ea40dca
commit 2499768e07
2 changed files with 24 additions and 7 deletions

View File

@ -4690,7 +4690,7 @@ def _template_paint_radial_control(paint, rotation=False, secondary_rotation=Fal
def _template_view3d_select(*, type, value, legacy, select_passthrough, exclude_mod=None):
# NOTE: `exclude_mod` is needed since we don't want this tool to exclude Control-RMB actions when this is used
# as a tool key-map with RMB-select and `use_fallback_tool_rmb` is enabled. See T92467.
return [(
items = [(
"view3d.select",
{"type": type, "value": value, **{m: True for m in mods}},
{"properties": [(c, True) for c in props]},
@ -4706,6 +4706,17 @@ def _template_view3d_select(*, type, value, legacy, select_passthrough, exclude_
(("toggle", "center", "enumerate"), ("shift", "ctrl", "alt")),
) if exclude_mod is None or exclude_mod not in mods]
if select_passthrough and (value == 'PRESS'):
# Add an additional click item to de-select all other items,
# needed so pass-through is able to de-select other items.
items.append((
"view3d.select",
{"type": type, "value": 'CLICK'},
{"properties": [("deselect_all", True)]},
))
return items
def _template_view3d_gpencil_select(*, type, value, legacy, use_select_mouse=True):
return [
@ -4723,7 +4734,7 @@ def _template_view3d_gpencil_select(*, type, value, legacy, use_select_mouse=Tru
def _template_uv_select(*, type, value, select_passthrough, legacy):
return [
items = [
("uv.select", {"type": type, "value": value},
{"properties": [
*((("deselect_all", True),) if not legacy else ()),
@ -4733,6 +4744,17 @@ def _template_uv_select(*, type, value, select_passthrough, legacy):
{"properties": [("toggle", True)]}),
]
if select_passthrough and (value == 'PRESS'):
# Add an additional click item to de-select all other items,
# needed so pass-through is able to de-select other items.
items.append((
"uv.select",
{"type": type, "value": 'CLICK'},
{"properties": [("deselect_all", True)]},
))
return items
def _template_sequencer_generic_select(*, type, value, legacy):
return [(

View File

@ -2747,11 +2747,6 @@ static bool ed_object_select_pick(bContext *C,
if (params->sel_op == SEL_OP_SET) {
if ((found && params->select_passthrough) && (basact->flag & BASE_SELECTED)) {
found = false;
/* NOTE(@campbellbarton): Experimental behavior to set active even keeping the selection
* without this it's inconvenient to set the active object. */
if (basact != oldbasact) {
use_activate_selected_base = true;
}
}
else if (found || params->deselect_all) {
/* Deselect everything. */