From 2499768e071965dc6e743cf540966a33e07e5d63 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 30 Mar 2022 12:27:35 +1100 Subject: 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. --- .../keyconfig/keymap_data/blender_default.py | 26 ++++++++++++++++++++-- .../blender/editors/space_view3d/view3d_select.c | 5 ----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index d307c3d0f0a..b626f6a237a 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -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 [( diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 30282df8026..54a335f98ed 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -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. */ -- cgit v1.2.3