diff options
Diffstat (limited to 'release/scripts/presets/keyconfig/keymap_data/blender_default.py')
-rw-r--r-- | release/scripts/presets/keyconfig/keymap_data/blender_default.py | 149 |
1 files changed, 105 insertions, 44 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..623ca2340d1 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -463,6 +463,7 @@ def _template_items_tool_select( # Always use the cursor operator where possible, # needed for time-line views where we always want to be able to scrub time. cursor_prioritize=False, + operator_props=(), fallback=False, ): if not params.legacy and not fallback: @@ -479,11 +480,11 @@ def _template_items_tool_select( if select_passthrough: return [ (operator, {"type": 'LEFTMOUSE', "value": 'PRESS'}, - {"properties": [("deselect_all", True), ("select_passthrough", True)]}), + {"properties": [("deselect_all", True), ("select_passthrough", True), *operator_props]}), (operator, {"type": 'LEFTMOUSE', "value": 'CLICK'}, - {"properties": [("deselect_all", True)]}), + {"properties": [("deselect_all", True), *operator_props]}), (operator, {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, - {"properties": [("deselect_all", False), ("toggle", True)]}), + {"properties": [("deselect_all", False), ("toggle", True), *operator_props]}), ("transform.translate", {"type": 'LEFTMOUSE', "value": 'CLICK_DRAG'}, {"properties": [("release_confirm", True)]}), ] @@ -497,9 +498,9 @@ def _template_items_tool_select( # the tool without selecting elements under the cursor. return [ (operator, {"type": 'LEFTMOUSE', "value": 'CLICK' if fallback else 'PRESS'}, - {"properties": [("deselect_all", True)]}), + {"properties": [("deselect_all", True), *operator_props]}), (operator, {"type": 'LEFTMOUSE', "value": 'CLICK' if fallback else 'PRESS', "shift": True}, - {"properties": [("toggle", True)]}), + {"properties": [("toggle", True), *operator_props]}), # Fallback key-map must transform as the primary tool is expected # to be accessed via gizmos in this case. See: T96885. @@ -1264,6 +1265,7 @@ def km_uv_editor(params): {"properties": [("deselect", True)]}), ("uv.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None), ("uv.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None), + ("uv.select_similar", {"type": 'G', "value": 'PRESS', "shift": True}, None), *_template_items_select_actions(params, "uv.select_all"), *_template_items_hide_reveal_actions("uv.hide", "uv.reveal"), ("uv.select_pinned", {"type": 'P', "value": 'PRESS', "shift": True}, None), @@ -2023,38 +2025,17 @@ 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([ - ("node.select", {"type": 'LEFTMOUSE', "value": 'PRESS'}, - {"properties": [("deselect_all", False)]}), - ("node.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, - {"properties": [("extend", True)]}), - ]) + items.extend(_template_node_select( + type='RIGHTMOUSE', value=params.select_mouse_value, select_passthrough=True)) + items.extend(_template_node_select( + type='LEFTMOUSE', value='PRESS', select_passthrough=True)) items.extend([ ("node.select_box", {"type": params.select_mouse, "value": 'CLICK_DRAG'}, @@ -2243,6 +2224,7 @@ def km_file_browser(params): ("file.smoothscroll", {"type": 'TIMER1', "value": 'ANY', "any": True}, None), ("file.bookmark_add", {"type": 'B', "value": 'PRESS', "ctrl": True}, None), ("file.start_filter", {"type": 'F', "value": 'PRESS', "ctrl": True}, None), + ("file.edit_directory_path", {"type": 'L', "value": 'PRESS', "ctrl": True}, None), ("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "repeat": True}, {"properties": [("increment", 1)]}), ("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": True, "repeat": True}, @@ -3033,7 +3015,7 @@ def km_sequencerpreview(params): return keymap -def km_sequencer_channels(params): +def km_sequencer_channels(_params): items = [] keymap = ( "Sequencer Channels", @@ -4741,6 +4723,10 @@ def _template_view3d_select(*, type, value, legacy, select_passthrough, exclude_ # 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. + props_vert_without_handles = () + if select_passthrough: + props_vert_without_handles = ("vert_without_handles",) + # See: `use_tweak_select_passthrough` doc-string. if select_passthrough and (value in {'CLICK', 'RELEASE'}): select_passthrough = False @@ -4750,9 +4736,9 @@ def _template_view3d_select(*, type, value, legacy, select_passthrough, exclude_ {"type": type, "value": value, **{m: True for m in mods}}, {"properties": [(c, True) for c in props]}, ) for props, mods in ( - ((("deselect_all", "select_passthrough") if select_passthrough else - ("deselect_all",)) if not legacy else (), ()), - (("toggle",), ("shift",)), + ((("deselect_all", "select_passthrough", *props_vert_without_handles) if select_passthrough else + ("deselect_all", *props_vert_without_handles)) if not legacy else (), ()), + (("toggle", *props_vert_without_handles), ("shift",)), (("center", "object"), ("ctrl",)), (("enumerate",), ("alt",)), (("toggle", "center"), ("shift", "ctrl")), @@ -4767,7 +4753,10 @@ def _template_view3d_select(*, type, value, legacy, select_passthrough, exclude_ items.append(( "view3d.select", {"type": type, "value": 'CLICK'}, - {"properties": [("deselect_all", True)]}, + {"properties": [ + (c, True) + for c in ("deselect_all", *props_vert_without_handles) + ]}, )) return items @@ -4788,6 +4777,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", select_passthrough)]}), + ("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. @@ -5573,6 +5591,18 @@ def km_font(params): return keymap +# Curves edit mode. +def km_curves(params): + items = [] + keymap = ( + "Curves", + {"space_type": 'EMPTY', "region_type": 'WINDOW'}, + {"items": items}, + ) + + return keymap + + def km_sculpt_curves(params): items = [] keymap = ( @@ -5586,7 +5616,14 @@ def km_sculpt_curves(params): {"properties": [("mode", 'NORMAL')]}), ("sculpt_curves.brush_stroke", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, {"properties": [("mode", 'INVERT')]}), + ("sculpt_curves.brush_stroke", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, + {"properties": [("mode", 'SMOOTH')]}), + ("curves.set_selection_domain", {"type": 'ONE', "value": 'PRESS'}, {"properties": [("domain", 'POINT')]}), + ("curves.set_selection_domain", {"type": 'TWO', "value": 'PRESS'}, {"properties": [("domain", 'CURVE')]}), + ("curves.disable_selection", {"type": 'ONE', "value": 'PRESS', "alt": True}, None), + ("curves.disable_selection", {"type": 'TWO', "value": 'PRESS', "alt": True}, None), *_template_paint_radial_control("curves_sculpt"), + *_template_items_select_actions(params, "sculpt_curves.select_all"), ]) return keymap @@ -5901,6 +5938,8 @@ def km_standard_modal_map(_params): ("APPLY", {"type": 'NUMPAD_ENTER', "value": 'PRESS', "any": True}, None), ("SNAP", {"type": 'LEFT_CTRL', "value": 'PRESS', "any": True}, None), ("SNAP_OFF", {"type": 'LEFT_CTRL', "value": 'RELEASE', "any": True}, None), + ("SNAP", {"type": 'RIGHT_CTRL', "value": 'PRESS', "any": True}, None), + ("SNAP_OFF", {"type": 'RIGHT_CTRL', "value": 'RELEASE', "any": True}, None), ]) return keymap @@ -6047,10 +6086,16 @@ def km_view3d_fly_modal(_params): ("AXIS_LOCK_Z", {"type": 'Z', "value": 'PRESS'}, None), ("PRECISION_ENABLE", {"type": 'LEFT_ALT', "value": 'PRESS', "any": True}, None), ("PRECISION_DISABLE", {"type": 'LEFT_ALT', "value": 'RELEASE', "any": True}, None), + ("PRECISION_ENABLE", {"type": 'RIGHT_ALT', "value": 'PRESS', "any": True}, None), + ("PRECISION_DISABLE", {"type": 'RIGHT_ALT', "value": 'RELEASE', "any": True}, None), ("PRECISION_ENABLE", {"type": 'LEFT_SHIFT', "value": 'PRESS', "any": True}, None), ("PRECISION_DISABLE", {"type": 'LEFT_SHIFT', "value": 'RELEASE', "any": True}, None), + ("PRECISION_ENABLE", {"type": 'RIGHT_SHIFT', "value": 'PRESS', "any": True}, None), + ("PRECISION_DISABLE", {"type": 'RIGHT_SHIFT', "value": 'RELEASE', "any": True}, None), ("FREELOOK_ENABLE", {"type": 'LEFT_CTRL', "value": 'PRESS', "any": True}, None), ("FREELOOK_DISABLE", {"type": 'LEFT_CTRL', "value": 'RELEASE', "any": True}, None), + ("FREELOOK_ENABLE", {"type": 'RIGHT_CTRL', "value": 'PRESS', "any": True}, None), + ("FREELOOK_DISABLE", {"type": 'RIGHT_CTRL', "value": 'RELEASE', "any": True}, None), ]) return keymap @@ -6072,8 +6117,12 @@ def km_view3d_walk_modal(_params): ("CONFIRM", {"type": 'NUMPAD_ENTER', "value": 'PRESS', "any": True}, None), ("FAST_ENABLE", {"type": 'LEFT_SHIFT', "value": 'PRESS', "any": True}, None), ("FAST_DISABLE", {"type": 'LEFT_SHIFT', "value": 'RELEASE', "any": True}, None), + ("FAST_ENABLE", {"type": 'RIGHT_SHIFT', "value": 'PRESS', "any": True}, None), + ("FAST_DISABLE", {"type": 'RIGHT_SHIFT', "value": 'RELEASE', "any": True}, None), ("SLOW_ENABLE", {"type": 'LEFT_ALT', "value": 'PRESS', "any": True}, None), ("SLOW_DISABLE", {"type": 'LEFT_ALT', "value": 'RELEASE', "any": True}, None), + ("SLOW_ENABLE", {"type": 'RIGHT_ALT', "value": 'PRESS', "any": True}, None), + ("SLOW_DISABLE", {"type": 'RIGHT_ALT', "value": 'RELEASE', "any": True}, None), ("FORWARD", {"type": 'W', "value": 'PRESS', "any": True}, None), ("BACKWARD", {"type": 'S', "value": 'PRESS', "any": True}, None), ("LEFT", {"type": 'A', "value": 'PRESS', "any": True}, None), @@ -6123,6 +6172,8 @@ def km_view3d_rotate_modal(_params): ("CONFIRM", {"type": 'ESC', "value": 'PRESS', "any": True}, None), ("AXIS_SNAP_ENABLE", {"type": 'LEFT_ALT', "value": 'PRESS', "any": True}, None), ("AXIS_SNAP_DISABLE", {"type": 'LEFT_ALT', "value": 'RELEASE', "any": True}, None), + ("AXIS_SNAP_ENABLE", {"type": 'RIGHT_ALT', "value": 'PRESS', "any": True}, None), + ("AXIS_SNAP_DISABLE", {"type": 'RIGHT_ALT', "value": 'RELEASE', "any": True}, None), ]) return keymap @@ -6212,6 +6263,7 @@ def km_sculpt_expand_modal(_params): *((e, {"type": NUMBERS_1[i], "value": 'PRESS', "any": True}, None) for i, e in enumerate( ("FALLOFF_GEODESICS", "FALLOFF_TOPOLOGY", "FALLOFF_TOPOLOGY_DIAGONALS", "FALLOFF_SPHERICAL"))), ("SNAP_TOGGLE", {"type": 'LEFT_CTRL', "value": 'ANY'}, None), + ("SNAP_TOGGLE", {"type": 'RIGHT_CTRL', "value": 'ANY'}, None), ("LOOP_COUNT_INCREASE", {"type": 'W', "value": 'PRESS', "any": True, "repeat": True}, None), ("LOOP_COUNT_DECREASE", {"type": 'Q', "value": 'PRESS', "any": True, "repeat": True}, None), ("BRUSH_GRADIENT_TOGGLE", {"type": 'B', "value": 'PRESS', "any": True}, None), @@ -6549,10 +6601,11 @@ 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)]}), - ]), + # The node key-map already selects, leave this empty. + # NOTE: intentionally don't check `fallback` here (unlike other tweak tool checks). + # as this should only be used on LMB select which would otherwise activate on click, not press. + *([] if (params.select_mouse == 'RIGHTMOUSE') else + _template_node_select(type=params.select_mouse, value='PRESS', select_passthrough=True)), ]}, ) @@ -6569,6 +6622,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)), ]}, ) @@ -6630,12 +6685,17 @@ def km_3d_view_tool_cursor(params): def km_3d_view_tool_select(params, *, fallback): + if params.use_tweak_select_passthrough: + operator_props = (("vert_without_handles", True),) + else: + operator_props = () + return ( _fallback_id("3D View Tool: Tweak", fallback), {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ *([] if (fallback and (params.select_mouse == 'RIGHTMOUSE')) else _template_items_tool_select( - params, "view3d.select", "view3d.cursor3d", fallback=fallback)), + params, "view3d.select", "view3d.cursor3d", operator_props=operator_props, fallback=fallback)), *([] if (not params.use_fallback_tool_rmb) else _template_view3d_select( type=params.select_mouse, value=params.select_mouse_value, @@ -7967,6 +8027,7 @@ def generate_keymaps(params=None): km_lattice(params), km_particle(params), km_font(params), + km_curves(params), km_sculpt_curves(params), km_object_non_modal(params), |