diff options
author | Campbell Barton <campbell@blender.org> | 2022-05-10 16:04:37 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-05-10 16:04:37 +0300 |
commit | b4b85c5ce2752ea9241cbcfa1ddc3f639ad64262 (patch) | |
tree | 967bf4f3baaa9a6be6ff59b8ad300625eb8beace /release/scripts/presets/keyconfig/keymap_data/blender_default.py | |
parent | de71cdb35df4790e2596fde12168d849206c663b (diff) | |
parent | 4c3e91e5f565b81dd79b5d42f55be5b93662d410 (diff) |
Merge branch 'blender-v3.2-release'
Diffstat (limited to 'release/scripts/presets/keyconfig/keymap_data/blender_default.py')
-rw-r--r-- | release/scripts/presets/keyconfig/keymap_data/blender_default.py | 68 |
1 files changed, 40 insertions, 28 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 99563c83bf9..3e0d3dadcf1 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -2023,37 +2023,20 @@ def km_node_editor(params): {"items": items}, ) - def node_select_ops(select_mouse): - return [ - ("node.select", {"type": select_mouse, "value": 'PRESS'}, - {"properties": [("deselect_all", True)]}), - ("node.select", {"type": select_mouse, "value": 'PRESS', "ctrl": True}, None), - ("node.select", {"type": select_mouse, "value": 'PRESS', "alt": True}, None), - ("node.select", {"type": select_mouse, "value": 'PRESS', "ctrl": True, "alt": True}, None), - ("node.select", {"type": select_mouse, "value": 'PRESS', "shift": True}, - {"properties": [("extend", True)]}), - ("node.select", {"type": select_mouse, "value": 'PRESS', "shift": True, "ctrl": True}, - {"properties": [("extend", True)]}), - ("node.select", {"type": select_mouse, "value": 'PRESS', "shift": True, "alt": True}, - {"properties": [("extend", True)]}), - ("node.select", {"type": select_mouse, "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, - {"properties": [("extend", True)]}), - ] - - # Allow node selection with both for RMB select if not params.legacy: + items.extend(_template_node_select(type=params.select_mouse, + value=params.select_mouse_value, select_passthrough=True)) + # Allow node selection with both for RMB select. if params.select_mouse == 'RIGHTMOUSE': - items.extend(node_select_ops('LEFTMOUSE')) - items.extend(node_select_ops('RIGHTMOUSE')) - else: - items.extend(node_select_ops('LEFTMOUSE')) + items.extend(_template_node_select(type='LEFTMOUSE', value='PRESS', select_passthrough=True)) else: - items.extend(node_select_ops('RIGHTMOUSE')) + items.extend(_template_node_select( + type='RIGHTMOUSE', value=params.select_mouse_value, select_passthrough=False)) items.extend([ ("node.select", {"type": 'LEFTMOUSE', "value": 'PRESS'}, {"properties": [("deselect_all", False)]}), ("node.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, - {"properties": [("extend", True)]}), + {"properties": [("toggle", True)]}), ]) items.extend([ @@ -4788,6 +4771,35 @@ def _template_view3d_gpencil_select(*, type, value, legacy, use_select_mouse=Tru ] +def _template_node_select(*, type, value, select_passthrough): + items = [ + ("node.select", {"type": type, "value": value}, + {"properties": [("deselect_all", True), ("select_passthrough", True)]}), + ("node.select", {"type": type, "value": value, "ctrl": True}, None), + ("node.select", {"type": type, "value": value, "alt": True}, None), + ("node.select", {"type": type, "value": value, "ctrl": True, "alt": True}, None), + ("node.select", {"type": type, "value": value, "shift": True}, + {"properties": [("toggle", True)]}), + ("node.select", {"type": type, "value": value, "shift": True, "ctrl": True}, + {"properties": [("toggle", True)]}), + ("node.select", {"type": type, "value": value, "shift": True, "alt": True}, + {"properties": [("toggle", True)]}), + ("node.select", {"type": type, "value": value, "shift": True, "ctrl": True, "alt": True}, + {"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(( + "node.select", + {"type": type, "value": 'CLICK'}, + {"properties": [("deselect_all", True)]}, + )) + + return items + + def _template_uv_select(*, type, value, select_passthrough, legacy): # See: `use_tweak_select_passthrough` doc-string. @@ -6549,10 +6561,8 @@ def km_node_editor_tool_select(params, *, fallback): _fallback_id("Node Tool: Tweak", fallback), {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, {"items": [ - *([] if (fallback and (params.select_mouse == 'RIGHTMOUSE')) else [ - ("node.select", {"type": params.select_mouse, "value": 'PRESS'}, - {"properties": [("deselect_all", not params.legacy)]}), - ]), + *([] if (fallback and (params.select_mouse == 'RIGHTMOUSE')) else + _template_node_select(type=params.select_mouse, value='PRESS', select_passthrough=True)), ]}, ) @@ -6569,6 +6579,8 @@ def km_node_editor_tool_select_box(params, *, fallback): params.tool_tweak_event), properties=[("tweak", True)], )), + *([] if (params.select_mouse == 'RIGHTMOUSE') else + _template_node_select(type='LEFTMOUSE', value='PRESS', select_passthrough=True)), ]}, ) |