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 | 1152 |
1 files changed, 783 insertions, 369 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 847fc757f48..5ecbe7715e3 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -46,6 +46,8 @@ class Params: "use_select_all_toggle", # Activate gizmo on drag (which support it). "use_gizmo_drag", + # Use the fallback tool instead of tweak for RMB select. + "use_fallback_tool", # Use pie menu for tab by default (swap 'Tab/Ctrl-Tab'). "use_v3d_tab_menu", # Use extended pie menu for shading. @@ -54,11 +56,24 @@ class Params: "use_v3d_mmb_pan", # Alt click to access tools. "use_alt_click_leader", + # Transform keys G/S/R activate tools instead of immediately transforming. + "use_key_activate_tools", + # Optionally use a modifier to access tools. + "tool_modifier", # Experimental option. "use_pie_click_drag", "v3d_tilde_action", # Alt-MMB axis switching 'RELATIVE' or 'ABSOLUTE' axis switching. "v3d_alt_mmb_drag_action", + + # Convenience variables: + # (derived from other settings). + # + # This case needs to be checked often, + # convenience for: `params.use_fallback_tool if params.select_mouse == 'RIGHT' else False`. + "use_fallback_tool_rmb", + # Convenience for: `'CLICK' if params.use_fallback_tool_rmb else params.select_mouse_value`. + "select_mouse_value_fallback", ) def __init__( @@ -70,11 +85,14 @@ class Params: # User preferences. spacebar_action='TOOL', + use_key_activate_tools=False, use_select_all_toggle=False, use_gizmo_drag=True, + use_fallback_tool=False, use_v3d_tab_menu=False, use_v3d_shade_ex_pie=False, use_v3d_mmb_pan=False, + use_alt_tool=False, use_alt_click_leader=False, use_pie_click_drag=False, v3d_tilde_action='VIEW', @@ -96,6 +114,10 @@ class Params: self.context_menu_event = {"type": 'W', "value": 'PRESS'} self.cursor_set_event = {"type": 'LEFTMOUSE', "value": 'CLICK'} self.cursor_tweak_event = None + self.use_fallback_tool = use_fallback_tool + self.use_fallback_tool_rmb = use_fallback_tool + self.select_mouse_value_fallback = 'CLICK' if self.use_fallback_tool_rmb else self.select_mouse_value + self.tool_modifier = {} else: # Left mouse select uses Click event for selection. This is a little # less immediate, but is needed to distinguish between click and tweak @@ -115,11 +137,21 @@ class Params: self.cursor_set_event = {"type": 'RIGHTMOUSE', "value": 'PRESS', "shift": True} self.cursor_tweak_event = {"type": 'EVT_TWEAK_R', "value": 'ANY', "shift": True} + self.use_fallback_tool = True + self.use_fallback_tool_rmb = False + self.select_mouse_value_fallback = self.select_mouse_value + + if use_alt_tool: + # Allow `Alt` to be pressed or not. + self.tool_modifier = {"alt": -1} + else: + self.tool_modifier = {} self.use_mouse_emulate_3_button = use_mouse_emulate_3_button # User preferences self.spacebar_action = spacebar_action + self.use_key_activate_tools = use_key_activate_tools self.use_gizmo_drag = use_gizmo_drag self.use_select_all_toggle = use_select_all_toggle @@ -148,6 +180,15 @@ NUMBERS_0 = ('ZERO', 'ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIG # ------------------------------------------------------------------------------ +# Generic Utilities + +def _fallback_id(text, fallback): + if fallback: + return text + " (fallback)" + return text + + +# ------------------------------------------------------------------------------ # Keymap Item Wrappers def op_menu(menu, kmi_args): @@ -170,6 +211,16 @@ def op_tool_cycle(tool, kmi_args): return ("wm.tool_set_by_id", kmi_args, {"properties": [("name", tool), ("cycle", True)]}) +# Utility to select between an operator and a tool, +# without having to duplicate key map item arguments. +def op_tool_optional(op_args, tool_pair, params): + if params.use_key_activate_tools: + kmi_args = op_args[1] + op_tool_fn, tool_id = tool_pair + return op_tool_fn(tool_id, kmi_args) + return op_args + + # ------------------------------------------------------------------------------ # Keymap Templates @@ -230,6 +281,14 @@ def _template_items_select_actions(params, operator): ] +def _template_items_hide_reveal_actions(op_hide, op_reveal): + return [ + (op_reveal, {"type": 'H', "value": 'PRESS', "alt": True}, None), + (op_hide, {"type": 'H', "value": 'PRESS'}, {"properties": [("unselected", False)]}), + (op_hide, {"type": 'H', "value": 'PRESS', "shift": True}, {"properties": [("unselected", True)]}), + ] + + def _template_items_object_subdivision_set(): return [ ("object.subdivision_set", @@ -764,10 +823,14 @@ def km_property_editor(_params): ("object.modifier_copy", {"type": 'D', "value": 'PRESS', "shift": True}, None), ("object.modifier_apply", {"type": 'A', "value": 'PRESS', "ctrl": True}, {"properties": [("report", True)]}), # Grease pencil modifier panels - ("object.gpencil_modifier_remove", {"type": 'X', "value": 'PRESS'}, {"properties": [("report", True)]}), - ("object.gpencil_modifier_remove", {"type": 'DEL', "value": 'PRESS'}, {"properties": [("report", True)]}), - ("object.gpencil_modifier_copy", {"type": 'D', "value": 'PRESS', "shift": True}, None), - ("object.gpencil_modifier_apply", {"type": 'A', "value": 'PRESS', "ctrl": True}, {"properties": [("report", True)]}), + ("object.gpencil_modifier_remove", + {"type": 'X', "value": 'PRESS'}, {"properties": [("report", True)]}), + ("object.gpencil_modifier_remove", + {"type": 'DEL', "value": 'PRESS'}, {"properties": [("report", True)]}), + ("object.gpencil_modifier_copy", + {"type": 'D', "value": 'PRESS', "shift": True}, None), + ("object.gpencil_modifier_apply", + {"type": 'A', "value": 'PRESS', "ctrl": True}, {"properties": [("report", True)]}), # ShaderFX panels ("object.shaderfx_remove", {"type": 'X', "value": 'PRESS'}, {"properties": [("report", True)]}), ("object.shaderfx_remove", {"type": 'DEL', "value": 'PRESS'}, {"properties": [("report", True)]}), @@ -882,27 +945,38 @@ def km_uv_editor(params): items.extend([ # Selection modes. *_template_items_uv_select_mode(params), + *_template_uv_select( + type=params.select_mouse, + value=('CLICK' if params.use_fallback_tool_rmb else params.select_mouse_value), + legacy=params.legacy, + ), ("uv.mark_seam", {"type": 'E', "value": 'PRESS', "ctrl": True}, None), - ("uv.select", {"type": params.select_mouse, "value": params.select_mouse_value}, - {"properties": [("deselect_all", not params.legacy)]}), - ("uv.select", {"type": params.select_mouse, "value": params.select_mouse_value, "shift": True}, - {"properties": [("extend", True)]}), - ("uv.select_loop", {"type": params.select_mouse, "value": params.select_mouse_value, "alt": True}, None), - ("uv.select_loop", {"type": params.select_mouse, "value": params.select_mouse_value, "shift": True, "alt": True}, + ("uv.select_loop", + {"type": params.select_mouse, "value": params.select_mouse_value, "alt": True}, None), + ("uv.select_loop", + {"type": params.select_mouse, "value": params.select_mouse_value, "shift": True, "alt": True}, {"properties": [("extend", True)]}), - ("uv.select_edge_ring", {"type": params.select_mouse, "value": params.select_mouse_value, "ctrl": True, "alt": True}, None), - ("uv.select_edge_ring", {"type": params.select_mouse, "value": params.select_mouse_value, "ctrl": True, "shift": True, "alt": True}, + ("uv.select_edge_ring", + {"type": params.select_mouse, "value": params.select_mouse_value, "ctrl": True, "alt": True}, None), + ("uv.select_edge_ring", + {"type": params.select_mouse, "value": params.select_mouse_value, "ctrl": True, "shift": True, "alt": True}, {"properties": [("extend", True)]}), - ("uv.shortest_path_pick", {"type": params.select_mouse, "value": params.select_mouse_value, "ctrl": True}, + ("uv.shortest_path_pick", + {"type": params.select_mouse, "value": params.select_mouse_value_fallback, "ctrl": True}, {"properties": [("use_fill", False)]}), - ("uv.shortest_path_pick", {"type": params.select_mouse, "value": params.select_mouse_value, "ctrl": True, "shift": True}, + ("uv.shortest_path_pick", + {"type": params.select_mouse, "value": params.select_mouse_value_fallback, "ctrl": True, "shift": True}, {"properties": [("use_fill", True)]}), ("uv.select_split", {"type": 'Y', "value": 'PRESS'}, None), - ("uv.select_box", {"type": 'B', "value": 'PRESS'}, - {"properties": [("pinned", False)]}), + op_tool_optional( + ("uv.select_box", {"type": 'B', "value": 'PRESS'}, + {"properties": [("pinned", False)]}), + (op_tool, "builtin.select_box"), params), ("uv.select_box", {"type": 'B', "value": 'PRESS', "ctrl": True}, {"properties": [("pinned", True)]}), - ("uv.select_circle", {"type": 'C', "value": 'PRESS'}, None), + op_tool_optional( + ("uv.select_circle", {"type": 'C', "value": 'PRESS'}, None), + (op_tool, "builtin.select_circle"), params), ("uv.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True}, {"properties": [("mode", 'ADD')]}), ("uv.select_lasso", {"type": params.action_tweak, "value": 'ANY', "shift": True, "ctrl": True}, @@ -915,6 +989,7 @@ def km_uv_editor(params): ("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), *_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), op_menu("IMAGE_MT_uvs_merge", {"type": 'M', "value": 'PRESS'}), op_menu("IMAGE_MT_uvs_split", {"type": 'M', "value": 'PRESS', "alt": True}), @@ -926,11 +1001,6 @@ def km_uv_editor(params): ("uv.pin", {"type": 'P', "value": 'PRESS', "alt": True}, {"properties": [("clear", True)]}), op_menu("IMAGE_MT_uvs_unwrap", {"type": 'U', "value": 'PRESS'}), - ("uv.hide", {"type": 'H', "value": 'PRESS'}, - {"properties": [("unselected", False)]}), - ("uv.hide", {"type": 'H', "value": 'PRESS', "shift": True}, - {"properties": [("unselected", True)]}), - ("uv.reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None), ( op_menu_pie("IMAGE_MT_uvs_snap_pie", {"type": 'S', "value": 'PRESS', "shift": True}) if not params.legacy else @@ -939,10 +1009,16 @@ def km_uv_editor(params): op_menu("IMAGE_MT_uvs_select_mode", {"type": 'TAB', "value": 'PRESS', "ctrl": True}), *_template_items_proportional_editing( params, connected=False, toggle_data_path='tool_settings.use_proportional_edit'), - ("transform.translate", {"type": 'G', "value": 'PRESS'}, None), ("transform.translate", {"type": params.select_tweak, "value": 'ANY'}, None), - ("transform.rotate", {"type": 'R', "value": 'PRESS'}, None), - ("transform.resize", {"type": 'S', "value": 'PRESS'}, None), + op_tool_optional( + ("transform.translate", {"type": 'G', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.move"), params), + op_tool_optional( + ("transform.rotate", {"type": 'R', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.rotate"), params), + op_tool_optional( + ("transform.resize", {"type": 'S', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.scale"), params), ("transform.shear", {"type": 'S', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None), ("transform.mirror", {"type": 'M', "value": 'PRESS', "ctrl": True}, None), ("wm.context_toggle", {"type": 'TAB', "value": 'PRESS', "shift": True}, @@ -1196,26 +1272,21 @@ def km_view3d(params): ("view3d.view_axis", {"type": 'NDOF_BUTTON_TOP', "value": 'PRESS', "shift": True}, {"properties": [("type", 'TOP'), ("align_active", True)]}), # Selection. - *(( - "view3d.select", - {"type": params.select_mouse, "value": params.select_mouse_value, **{m: True for m in mods}}, - {"properties": [(c, True) for c in props]}, - ) for props, mods in ( - (("deselect_all",) if not params.legacy else (), ()), - (("toggle",), ("shift",)), - (("center", "object"), ("ctrl",)), - (("enumerate",), ("alt",)), - (("toggle", "center"), ("shift", "ctrl")), - (("center", "enumerate"), ("ctrl", "alt")), - (("toggle", "enumerate"), ("shift", "alt")), - (("toggle", "center", "enumerate"), ("shift", "ctrl", "alt")), - )), - ("view3d.select_box", {"type": 'B', "value": 'PRESS'}, None), + *_template_view3d_select( + type=params.select_mouse, + value=params.select_mouse_value_fallback, + legacy=params.legacy, + ), + op_tool_optional( + ("view3d.select_box", {"type": 'B', "value": 'PRESS'}, None), + (op_tool, "builtin.select_box"), params), ("view3d.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True}, {"properties": [("mode", 'ADD')]}), ("view3d.select_lasso", {"type": params.action_tweak, "value": 'ANY', "shift": True, "ctrl": True}, {"properties": [("mode", 'SUB')]}), - ("view3d.select_circle", {"type": 'C', "value": 'PRESS'}, None), + op_tool_optional( + ("view3d.select_circle", {"type": 'C', "value": 'PRESS'}, None), + (op_tool, "builtin.select_circle"), params), # Borders. ("view3d.clip_border", {"type": 'B', "value": 'PRESS', "alt": True}, None), ("view3d.zoom_border", {"type": 'B', "value": 'PRESS', "shift": True}, None), @@ -1228,23 +1299,37 @@ def km_view3d(params): ("view3d.copybuffer", {"type": 'C', "value": 'PRESS', "ctrl": True}, None), ("view3d.pastebuffer", {"type": 'V', "value": 'PRESS', "ctrl": True}, None), # Transform. - ("transform.translate", {"type": 'G', "value": 'PRESS'}, None), ("transform.translate", {"type": params.select_tweak, "value": 'ANY'}, None), - ("transform.rotate", {"type": 'R', "value": 'PRESS'}, None), - ("transform.resize", {"type": 'S', "value": 'PRESS'}, None), + op_tool_optional( + ("transform.translate", {"type": 'G', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.move"), params), + op_tool_optional( + ("transform.rotate", {"type": 'R', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.rotate"), params), + op_tool_optional( + ("transform.resize", {"type": 'S', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.scale"), params), + op_tool_optional( + ("transform.tosphere", {"type": 'S', "value": 'PRESS', "shift": True, "alt": True}, None), + (op_tool_cycle, "builtin.to_sphere"), params), + op_tool_optional( + ("transform.shear", {"type": 'S', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None), + (op_tool_cycle, "builtin.shear"), params), ("transform.bend", {"type": 'W', "value": 'PRESS', "shift": True}, None), - ("transform.tosphere", {"type": 'S', "value": 'PRESS', "shift": True, "alt": True}, None), - ("transform.shear", {"type": 'S', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None), ("transform.mirror", {"type": 'M', "value": 'PRESS', "ctrl": True}, None), ("object.transform_axis_target", {"type": 'T', "value": 'PRESS', "shift": True}, None), ("transform.skin_resize", {"type": 'A', "value": 'PRESS', "ctrl": True}, None), # Snapping. ("wm.context_toggle", {"type": 'TAB', "value": 'PRESS', "shift": True}, {"properties": [("data_path", 'tool_settings.use_snap')]}), - op_panel("VIEW3D_PT_snapping", {"type": 'TAB', "value": 'PRESS', "shift": True, "ctrl": True}, [("keep_open", True)]), + op_panel( + "VIEW3D_PT_snapping", + {"type": 'TAB', "value": 'PRESS', "shift": True, "ctrl": True}, + [("keep_open", True)], + ), ( op_menu_pie("VIEW3D_MT_snap_pie", {"type": 'S', "value": 'PRESS', "shift": True}) - if not params.legacy else + if not params.legacy else op_menu("VIEW3D_MT_snap", {"type": 'S', "value": 'PRESS', "shift": True}) ), ]) @@ -1321,11 +1406,17 @@ def km_view3d(params): {"properties": [("data_path", 'tool_settings.transform_pivot_point'), ("value", 'ACTIVE_ELEMENT')]}), # Old shading. ("wm.context_toggle_enum", {"type": 'Z', "value": 'PRESS'}, - {"properties": [("data_path", 'space_data.shading.type'), ("value_1", 'WIREFRAME'), ("value_2", 'SOLID')]}), + {"properties": [ + ("data_path", 'space_data.shading.type'), ("value_1", 'WIREFRAME'), ("value_2", 'SOLID'), + ]}), ("wm.context_toggle_enum", {"type": 'Z', "value": 'PRESS', "shift": True}, - {"properties": [("data_path", 'space_data.shading.type'), ("value_1", 'RENDERED'), ("value_2", 'SOLID')]}), + {"properties": [ + ("data_path", 'space_data.shading.type'), ("value_1", 'RENDERED'), ("value_2", 'SOLID'), + ]}), ("wm.context_toggle_enum", {"type": 'Z', "value": 'PRESS', "alt": True}, - {"properties": [("data_path", 'space_data.shading.type'), ("value_1", 'MATERIAL'), ("value_2", 'SOLID')]}), + {"properties": [ + ("data_path", 'space_data.shading.type'), ("value_1", 'MATERIAL'), ("value_2", 'SOLID'), + ]}), ]) if params.select_mouse == 'LEFTMOUSE' and not params.legacy: @@ -1380,17 +1471,14 @@ def km_mask_editing(params): {"properties": [("mode", 'SUB')]}), ("mask.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None), ("mask.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None), - ("mask.hide_view_clear", {"type": 'H', "value": 'PRESS', "alt": True}, None), - ("mask.hide_view_set", {"type": 'H', "value": 'PRESS'}, - {"properties": [("unselected", False)]}), - ("mask.hide_view_set", {"type": 'H', "value": 'PRESS', "shift": True}, - {"properties": [("unselected", True)]}), + *_template_items_hide_reveal_actions("mask.hide_view_set", "mask.hide_view_clear"), ("clip.select", {"type": params.select_mouse, "value": 'PRESS', "ctrl": True}, None), ("mask.cyclic_toggle", {"type": 'C', "value": 'PRESS', "alt": True}, None), ("mask.slide_point", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), ("mask.slide_spline_curvature", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), ("mask.handle_type_set", {"type": 'V', "value": 'PRESS'}, None), - ("mask.normals_make_consistent", {"type": 'N', "value": 'PRESS', "ctrl" if params.legacy else "shift": True}, None), + ("mask.normals_make_consistent", + {"type": 'N', "value": 'PRESS', "ctrl" if params.legacy else "shift": True}, None), ("mask.parent_set", {"type": 'P', "value": 'PRESS', "ctrl": True}, None), ("mask.parent_clear", {"type": 'P', "value": 'PRESS', "alt": True}, None), ("mask.shape_key_insert", {"type": 'I', "value": 'PRESS'}, None), @@ -1501,11 +1589,7 @@ def km_graph_editor_generic(_params): ), ("graph.extrapolation_type", {"type": 'E', "value": 'PRESS', "shift": True}, None), ("anim.channels_find", {"type": 'F', "value": 'PRESS', "ctrl": True}, None), - ("graph.hide", {"type": 'H', "value": 'PRESS'}, - {"properties": [("unselected", False)]}), - ("graph.hide", {"type": 'H', "value": 'PRESS', "shift": True}, - {"properties": [("unselected", True)]}), - ("graph.reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None), + *_template_items_hide_reveal_actions("graph.hide", "graph.reveal"), ("wm.context_set_enum", {"type": 'TAB', "value": 'PRESS', "ctrl": True}, {"properties": [("data_path", 'area.type'), ("value", 'DOPESHEET_EDITOR')]}), ]) @@ -1832,14 +1916,22 @@ def km_node_editor(params): {"properties": [("mode", 'ADD')]}), ("node.select_lasso", {"type": 'EVT_TWEAK_L', "value": 'ANY', "shift": True, "ctrl": True, "alt": True}, {"properties": [("mode", 'SUB')]}), - ("node.select_circle", {"type": 'C', "value": 'PRESS'}, None), + op_tool_optional( + ("node.select_box", {"type": 'B', "value": 'PRESS'}, + {"properties": [("tweak", False)]}), + (op_tool, "builtin.select_box"), params), + op_tool_optional( + ("node.select_circle", {"type": 'C', "value": 'PRESS'}, None), + (op_tool, "builtin.select_circle"), params), ("node.link", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, {"properties": [("detach", False)]}), ("node.link", {"type": 'EVT_TWEAK_L', "value": 'ANY', "ctrl": True}, {"properties": [("detach", True)]}), ("node.resize", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, None), - ("node.add_reroute", {"type": 'EVT_TWEAK_L' if params.legacy else 'EVT_TWEAK_R', "value": 'ANY', "shift": True}, None), - ("node.links_cut", {"type": 'EVT_TWEAK_L' if params.legacy else 'EVT_TWEAK_R', "value": 'ANY', "ctrl": True}, None), + ("node.add_reroute", + {"type": 'EVT_TWEAK_L' if params.legacy else 'EVT_TWEAK_R', "value": 'ANY', "shift": True}, None), + ("node.links_cut", + {"type": 'EVT_TWEAK_L' if params.legacy else 'EVT_TWEAK_R', "value": 'ANY', "ctrl": True}, None), ("node.links_mute", {"type": 'EVT_TWEAK_R', "value": 'ANY', "ctrl": True, "alt": True}, None), ("node.select_link_viewer", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "ctrl": True}, None), ("node.backimage_move", {"type": 'MIDDLEMOUSE', "value": 'PRESS', "alt": True}, None), @@ -1866,8 +1958,6 @@ def km_node_editor(params): ("node.view_all", {"type": 'HOME', "value": 'PRESS'}, None), ("node.view_all", {"type": 'NDOF_BUTTON_FIT', "value": 'PRESS'}, None), ("node.view_selected", {"type": 'NUMPAD_PERIOD', "value": 'PRESS'}, None), - ("node.select_box", {"type": 'B', "value": 'PRESS'}, - {"properties": [("tweak", False)]}), ("node.delete", {"type": 'X', "value": 'PRESS'}, None), ("node.delete", {"type": 'DEL', "value": 'PRESS'}, None), ("node.delete_reconnect", {"type": 'X', "value": 'PRESS', "ctrl": True}, None), @@ -1896,9 +1986,15 @@ def km_node_editor(params): ("node.clipboard_paste", {"type": 'V', "value": 'PRESS', "ctrl": True}, None), ("node.viewer_border", {"type": 'B', "value": 'PRESS', "ctrl": True}, None), ("node.clear_viewer_border", {"type": 'B', "value": 'PRESS', "ctrl": True, "alt": True}, None), - ("node.translate_attach", {"type": 'G', "value": 'PRESS'}, {"properties": [("TRANSFORM_OT_translate", [("view2d_edge_pan", True)])]}), - ("node.translate_attach", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, {"properties": [("TRANSFORM_OT_translate", [("view2d_edge_pan", True)])]}), - ("node.translate_attach", {"type": params.select_tweak, "value": 'ANY'}, {"properties": [("TRANSFORM_OT_translate", [("view2d_edge_pan", True)])]}), + ("node.translate_attach", + {"type": 'G', "value": 'PRESS'}, + {"properties": [("TRANSFORM_OT_translate", [("view2d_edge_pan", True)])]}), + ("node.translate_attach", + {"type": 'EVT_TWEAK_L', "value": 'ANY'}, + {"properties": [("TRANSFORM_OT_translate", [("view2d_edge_pan", True)])]}), + ("node.translate_attach", + {"type": params.select_tweak, "value": 'ANY'}, + {"properties": [("TRANSFORM_OT_translate", [("view2d_edge_pan", True)])]}), ("transform.translate", {"type": 'G', "value": 'PRESS'}, {"properties": [("view2d_edge_pan", True)]}), ("transform.translate", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, {"properties": [("release_confirm", True), ("view2d_edge_pan", True)]}), @@ -1906,9 +2002,15 @@ def km_node_editor(params): {"properties": [("release_confirm", True), ("view2d_edge_pan", True)]}), ("transform.rotate", {"type": 'R', "value": 'PRESS'}, None), ("transform.resize", {"type": 'S', "value": 'PRESS'}, None), - ("node.move_detach_links", {"type": 'D', "value": 'PRESS', "alt": True}, {"properties": [("TRANSFORM_OT_translate", [("view2d_edge_pan", True)])]}), - ("node.move_detach_links_release", {"type": params.action_tweak, "value": 'ANY', "alt": True}, {"properties": [("NODE_OT_translate_attach", [("TRANSFORM_OT_translate", [("view2d_edge_pan", True)])])]}), - ("node.move_detach_links", {"type": params.select_tweak, "value": 'ANY', "alt": True}, {"properties": [("TRANSFORM_OT_translate", [("view2d_edge_pan", True)])]}), + ("node.move_detach_links", + {"type": 'D', "value": 'PRESS', "alt": True}, + {"properties": [("TRANSFORM_OT_translate", [("view2d_edge_pan", True)])]}), + ("node.move_detach_links_release", + {"type": params.action_tweak, "value": 'ANY', "alt": True}, + {"properties": [("NODE_OT_translate_attach", [("TRANSFORM_OT_translate", [("view2d_edge_pan", True)])])]}), + ("node.move_detach_links", + {"type": params.select_tweak, "value": 'ANY', "alt": True}, + {"properties": [("TRANSFORM_OT_translate", [("view2d_edge_pan", True)])]}), ("wm.context_toggle", {"type": 'TAB', "value": 'PRESS', "shift": True}, {"properties": [("data_path", 'tool_settings.use_snap')]}), ("wm.context_menu_enum", {"type": 'TAB', "value": 'PRESS', "shift": True, "ctrl": True}, @@ -1958,7 +2060,7 @@ def km_file_browser(params): toolbar_key={"type": 'T', "value": 'PRESS'}, ), ("wm.context_toggle", {"type": 'N', "value": 'PRESS'}, - {"properties": [("data_path", 'space_data.show_region_tool_props')]}), + {"properties": [("data_path", 'space_data.show_region_tool_props')]}), ("file.parent", {"type": 'UP_ARROW', "value": 'PRESS', "alt": True}, None), ("file.previous", {"type": 'LEFT_ARROW', "value": 'PRESS', "alt": True}, None), ("file.next", {"type": 'RIGHT_ARROW', "value": 'PRESS', "alt": True}, None), @@ -1991,7 +2093,10 @@ def km_file_browser(params): # Select file under cursor before spawning the context menu. ("file.select", {"type": 'RIGHTMOUSE', "value": 'PRESS'}, - {"properties": [("open", False), ("only_activate_if_selected", params.select_mouse == 'LEFTMOUSE'), ("pass_through", True)]}), + {"properties": [ + ("open", False), + ("only_activate_if_selected", params.select_mouse == 'LEFTMOUSE'), ("pass_through", True), + ]}), *_template_items_context_menu("FILEBROWSER_MT_context_menu", params.context_menu_event), *_template_items_context_menu("ASSETBROWSER_MT_context_menu", params.context_menu_event), ]) @@ -2117,17 +2222,23 @@ def km_dopesheet(params): ) items.extend([ - ("action.clickselect", {"type": params.select_mouse, "value": 'PRESS'}, + ("action.clickselect", + {"type": params.select_mouse, "value": 'PRESS'}, {"properties": [("deselect_all", not params.legacy)]}), - ("action.clickselect", {"type": params.select_mouse, "value": 'PRESS', "alt": True}, + ("action.clickselect", + {"type": params.select_mouse, "value": 'PRESS', "alt": True}, {"properties": [("column", True)]}), - ("action.clickselect", {"type": params.select_mouse, "value": 'PRESS', "shift": True}, + ("action.clickselect", + {"type": params.select_mouse, "value": 'PRESS', "shift": True}, {"properties": [("extend", True)]}), - ("action.clickselect", {"type": params.select_mouse, "value": 'PRESS', "shift": True, "alt": True}, + ("action.clickselect", + {"type": params.select_mouse, "value": 'PRESS', "shift": True, "alt": True}, {"properties": [("extend", True), ("column", True)]}), - ("action.clickselect", {"type": params.select_mouse, "value": 'PRESS', "ctrl": True, "alt": True}, + ("action.clickselect", + {"type": params.select_mouse, "value": 'PRESS', "ctrl": True, "alt": True}, {"properties": [("channel", True)]}), - ("action.clickselect", {"type": params.select_mouse, "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, + ("action.clickselect", + {"type": params.select_mouse, "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, {"properties": [("extend", True), ("channel", True)]}), ("action.select_leftright", {"type": params.select_mouse, "value": 'PRESS' if params.legacy else 'CLICK', "ctrl": True}, @@ -2524,6 +2635,9 @@ def km_sequencercommon(params): ("wm.context_toggle_enum", {"type": 'TAB', "value": 'PRESS', "ctrl": True}, {"properties": [("data_path", 'space_data.view_type'), ("value_1", 'SEQUENCER'), ("value_2", 'PREVIEW')]}), ("sequencer.refresh_all", {"type": 'R', "value": 'PRESS', "ctrl": True}, None), + ("sequencer.select", {"type": params.select_mouse, "value": 'PRESS'}, None), + ("sequencer.select", {"type": params.select_mouse, "value": 'PRESS', "shift": True}, + {"properties": [("extend", True)]}), ]) if params.select_mouse == 'LEFTMOUSE' and not params.legacy: @@ -2606,9 +2720,6 @@ def km_sequencer(params): for i in range(10) ) ), - ("sequencer.select", {"type": params.select_mouse, "value": 'PRESS'}, None), - ("sequencer.select", {"type": params.select_mouse, "value": 'PRESS', "shift": True}, - {"properties": [("extend", True)]}), ("sequencer.select", {"type": params.select_mouse, "value": 'PRESS', "alt": True}, {"properties": [("linked_handle", True)]}), ("sequencer.select", {"type": params.select_mouse, "value": 'PRESS', "shift": True, "alt": True}, @@ -2685,6 +2796,21 @@ def km_sequencerpreview(params): ("sequencer.view_zoom_ratio", {"type": 'NUMPAD_8', "value": 'PRESS'}, {"properties": [("ratio", 0.125)]}), ("sequencer.sample", {"type": params.action_mouse, "value": 'PRESS'}, None), + op_tool_optional( + ("transform.translate", {"type": 'G', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.move"), params), + op_tool_optional( + ("transform.rotate", {"type": 'R', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.rotate"), params), + op_tool_optional( + ("transform.resize", {"type": 'S', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.scale"), params), + ("sequencer.strip_transform_clear", {"type": 'G', "alt": True, "value": 'PRESS'}, + {"properties": [("property", 'POSITION')]}), + ("sequencer.strip_transform_clear", {"type": 'S', "alt": True, "value": 'PRESS'}, + {"properties": [("property", 'SCALE')]}), + ("sequencer.strip_transform_clear", {"type": 'R', "alt": True, "value": 'PRESS'}, + {"properties": [("property", 'ROTATION')]}), ]) return keymap @@ -2867,11 +2993,7 @@ def km_clip_editor(params): {"properties": [("action", 'LOCK')]}), ("clip.lock_tracks", {"type": 'L', "value": 'PRESS', "alt": True}, {"properties": [("action", 'UNLOCK')]}), - ("clip.hide_tracks", {"type": 'H', "value": 'PRESS'}, - {"properties": [("unselected", False)]}), - ("clip.hide_tracks", {"type": 'H', "value": 'PRESS', "shift": True}, - {"properties": [("unselected", True)]}), - ("clip.hide_tracks_clear", {"type": 'H', "value": 'PRESS', "alt": True}, None), + *_template_items_hide_reveal_actions("clip.hide_tracks", "clip.hide_tracks_clear"), ("clip.slide_plane_marker", {"type": 'LEFTMOUSE', "value": 'CLICK_DRAG'}, None), ("clip.keyframe_insert", {"type": 'I', "value": 'PRESS'}, None), ("clip.keyframe_delete", {"type": 'I', "value": 'PRESS', "alt": True}, None), @@ -2987,6 +3109,7 @@ def km_clip_dopesheet_editor(_params): return keymap + def km_spreadsheet_generic(_params): items = [] keymap = ( @@ -3175,7 +3298,7 @@ def km_animation_channels(params): # Modes -def km_grease_pencil(_params): +def km_grease_pencil(params): items = [] keymap = ( "Grease Pencil", @@ -3183,34 +3306,48 @@ def km_grease_pencil(_params): {"items": items}, ) - items.extend([ - # Draw - ("gpencil.annotate", {"type": 'LEFTMOUSE', "value": 'PRESS', "key_modifier": 'D'}, - {"properties": [("mode", 'DRAW'), ("wait_for_input", False)]}), - ("gpencil.annotate", {"type": 'LEFTMOUSE', "value": 'PRESS', "key_modifier": 'D', "shift": True}, - {"properties": [("mode", 'DRAW'), ("wait_for_input", False)]}), - # Draw - straight lines - ("gpencil.annotate", {"type": 'LEFTMOUSE', "value": 'PRESS', "alt": True, "key_modifier": 'D'}, - {"properties": [("mode", 'DRAW_STRAIGHT'), ("wait_for_input", False)]}), - # Draw - poly lines - ("gpencil.annotate", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "alt": True, "key_modifier": 'D'}, - {"properties": [("mode", 'DRAW_POLY'), ("wait_for_input", False)]}), - # Erase - ("gpencil.annotate", {"type": 'RIGHTMOUSE', "value": 'PRESS', "key_modifier": 'D'}, - {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}), - ]) + if params.use_key_activate_tools: + items.extend([ + op_tool_cycle("builtin.annotate", {"type": 'D', "value": 'PRESS'}), + ]) + else: + items.extend([ + # Draw + ("gpencil.annotate", + {"type": 'LEFTMOUSE', "value": 'PRESS', "key_modifier": 'D'}, + {"properties": [("mode", 'DRAW'), ("wait_for_input", False)]}), + ("gpencil.annotate", + {"type": 'LEFTMOUSE', "value": 'PRESS', "key_modifier": 'D', "shift": True}, + {"properties": [("mode", 'DRAW'), ("wait_for_input", False)]}), + # Draw - straight lines + ("gpencil.annotate", + {"type": 'LEFTMOUSE', "value": 'PRESS', "alt": True, "key_modifier": 'D'}, + {"properties": [("mode", 'DRAW_STRAIGHT'), ("wait_for_input", False)]}), + # Draw - poly lines + ("gpencil.annotate", + {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "alt": True, "key_modifier": 'D'}, + {"properties": [("mode", 'DRAW_POLY'), ("wait_for_input", False)]}), + # Erase + ("gpencil.annotate", + {"type": 'RIGHTMOUSE', "value": 'PRESS', "key_modifier": 'D'}, + {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}), + ]) return keymap -def _grease_pencil_selection(params): +def _grease_pencil_selection(params, use_select_mouse=True): return [ # Select all *_template_items_select_actions(params, "gpencil.select_all"), # Circle select - ("gpencil.select_circle", {"type": 'C', "value": 'PRESS'}, None), + op_tool_optional( + ("gpencil.select_circle", {"type": 'C', "value": 'PRESS'}, None), + (op_tool, "builtin.select_circle"), params), # Box select - ("gpencil.select_box", {"type": 'B', "value": 'PRESS'}, None), + op_tool_optional( + ("gpencil.select_box", {"type": 'B', "value": 'PRESS'}, None), + (op_tool, "builtin.select_box"), params), # Lasso select ("gpencil.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True}, {"properties": [("mode", 'ADD')]}), @@ -3221,17 +3358,18 @@ def _grease_pencil_selection(params): # There probably isn't too much harm adding this for other editors too # as part of standard GP editing keymap. This hotkey combo doesn't seem # to see much use under standard scenarios? - ("gpencil.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True, "alt": True}, + ("gpencil.select_lasso", + {"type": params.action_tweak, "value": 'ANY', "ctrl": True, "alt": True}, {"properties": [("mode", 'ADD')]}), - ("gpencil.select_lasso", {"type": params.action_tweak, "value": 'ANY', "shift": True, "ctrl": True, "alt": True}, + ("gpencil.select_lasso", + {"type": params.action_tweak, "value": 'ANY', "shift": True, "ctrl": True, "alt": True}, {"properties": [("mode", 'SUB')]}), - ("gpencil.select", {"type": params.select_mouse, "value": params.select_mouse_value, "shift": True}, - {"properties": [("extend", True), ("toggle", True)]}), - # Whole stroke select - ("gpencil.select", {"type": params.select_mouse, "value": params.select_mouse_value, "alt": True}, - {"properties": [("entire_strokes", True)]}), - ("gpencil.select", {"type": params.select_mouse, "value": params.select_mouse_value, "shift": True, "alt": True}, - {"properties": [("extend", True), ("entire_strokes", True)]}), + *_template_view3d_gpencil_select( + type=params.select_mouse, + value=params.select_mouse_value_fallback, + legacy=params.legacy, + use_select_mouse=use_select_mouse, + ), # Select linked ("gpencil.select_linked", {"type": 'L', "value": 'PRESS'}, None), ("gpencil.select_linked", {"type": 'L', "value": 'PRESS', "ctrl": True}, None), @@ -3264,17 +3402,18 @@ def km_grease_pencil_stroke_edit_mode(params): items.extend([ # Interpolation - ("gpencil.interpolate", {"type": 'E', "value": 'PRESS', "ctrl": True}, None), + op_tool_optional( + ("gpencil.interpolate", {"type": 'E', "value": 'PRESS', "ctrl": True}, None), + (op_tool_cycle, "builtin.interpolate"), params), ("gpencil.interpolate_sequence", {"type": 'E', "value": 'PRESS', "shift": True, "ctrl": True}, None), - # Normal select - ("gpencil.select", {"type": params.select_mouse, "value": params.select_mouse_value}, - {"properties": [("deselect_all", not params.legacy)]}), # Selection *_grease_pencil_selection(params), # Duplicate and move selected points ("gpencil.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None), # Extrude and move selected points - ("gpencil.extrude_move", {"type": 'E', "value": 'PRESS'}, None), + op_tool_optional( + ("gpencil.extrude_move", {"type": 'E', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.extrude"), params), # Delete op_menu("VIEW3D_MT_edit_gpencil_delete", {"type": 'X', "value": 'PRESS'}), op_menu("VIEW3D_MT_edit_gpencil_delete", {"type": 'DEL', "value": 'PRESS'}), @@ -3304,11 +3443,7 @@ def km_grease_pencil_stroke_edit_mode(params): op_menu("GPENCIL_MT_snap", {"type": 'S', "value": 'PRESS', "shift": True}) ), # Show/hide - ("gpencil.reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None), - ("gpencil.hide", {"type": 'H', "value": 'PRESS'}, - {"properties": [("unselected", False)]}), - ("gpencil.hide", {"type": 'H', "value": 'PRESS', "shift": True}, - {"properties": [("unselected", True)]}), + *_template_items_hide_reveal_actions("gpencil.hide", "gpencil.reveal"), ("gpencil.selection_opacity_toggle", {"type": 'H', "value": 'PRESS', "ctrl": True}, None), # Display *_grease_pencil_display(), @@ -3319,16 +3454,30 @@ def km_grease_pencil_stroke_edit_mode(params): # Merge Layer ("gpencil.layer_merge", {"type": 'M', "value": 'PRESS', "shift": True, "ctrl": True}, None), # Transform tools - ("transform.translate", {"type": 'G', "value": 'PRESS'}, None), ("transform.translate", {"type": params.select_tweak, "value": 'ANY'}, None), - ("transform.rotate", {"type": 'R', "value": 'PRESS'}, None), - ("transform.resize", {"type": 'S', "value": 'PRESS'}, None), + op_tool_optional( + ("transform.translate", {"type": 'G', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.move"), params), + op_tool_optional( + ("transform.rotate", {"type": 'R', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.rotate"), params), + op_tool_optional( + ("transform.resize", {"type": 'S', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.scale"), params), + op_tool_optional( + ("transform.tosphere", {"type": 'S', "value": 'PRESS', "shift": True, "alt": True}, None), + (op_tool_cycle, "builtin.to_sphere"), params), + op_tool_optional( + ("transform.shear", {"type": 'S', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None), + (op_tool_cycle, "builtin.shear"), params), ("transform.mirror", {"type": 'M', "value": 'PRESS', "ctrl": True}, None), - ("transform.bend", {"type": 'W', "value": 'PRESS', "shift": True}, None), - ("transform.tosphere", {"type": 'S', "value": 'PRESS', "shift": True, "alt": True}, None), - ("transform.shear", {"type": 'S', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None), - ("transform.transform", {"type": 'S', "value": 'PRESS', "alt": True}, - {"properties": [("mode", 'GPENCIL_SHRINKFATTEN')]}), + op_tool_optional( + ("transform.bend", {"type": 'W', "value": 'PRESS', "shift": True}, None), + (op_tool_cycle, "builtin.bend"), params), + op_tool_optional( + ("transform.transform", {"type": 'S', "value": 'PRESS', "alt": True}, + {"properties": [("mode", 'GPENCIL_SHRINKFATTEN')]}), + (op_tool_cycle, "builtin.radius"), params), ("transform.transform", {"type": 'F', "value": 'PRESS', "shift": True}, {"properties": [("mode", 'GPENCIL_OPACITY')]}), # Proportional editing. @@ -3364,6 +3513,7 @@ def km_grease_pencil_stroke_edit_mode(params): return keymap + def km_grease_pencil_stroke_curve_edit_mode(_params): items = [] keymap = ( @@ -3379,6 +3529,7 @@ def km_grease_pencil_stroke_curve_edit_mode(_params): return keymap + def km_grease_pencil_stroke_paint_mode(params): items = [] keymap = ( @@ -3406,14 +3557,12 @@ def km_grease_pencil_stroke_paint_mode(params): ("gpencil.active_frames_delete_all", {"type": 'X', "value": 'PRESS', "shift": True}, None), ("gpencil.active_frames_delete_all", {"type": 'DEL', "value": 'PRESS', "shift": True}, None), # Interpolation - ("gpencil.interpolate", {"type": 'E', "value": 'PRESS', "ctrl": True}, None), + op_tool_optional( + ("gpencil.interpolate", {"type": 'E', "value": 'PRESS', "ctrl": True}, None), + (op_tool_cycle, "builtin.interpolate"), params), ("gpencil.interpolate_sequence", {"type": 'E', "value": 'PRESS', "shift": True, "ctrl": True}, None), # Show/hide - ("gpencil.reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None), - ("gpencil.hide", {"type": 'H', "value": 'PRESS'}, - {"properties": [("unselected", False)]}), - ("gpencil.hide", {"type": 'H', "value": 'PRESS', "shift": True}, - {"properties": [("unselected", True)]}), + *_template_items_hide_reveal_actions("gpencil.hide", "gpencil.reveal"), # Active layer op_menu("GPENCIL_MT_layer_active", {"type": 'Y', "value": 'PRESS'}), # Merge Layer @@ -3522,10 +3671,21 @@ def km_grease_pencil_stroke_paint_fill(_params): {"properties": [("on_back", False)]}), # If press alternate key, the brush now it's for drawing areas ("gpencil.draw", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, - {"properties": [("mode", 'DRAW'), ("wait_for_input", False), ("disable_straight", True), ("disable_stabilizer", True)]}), + {"properties": [ + ("mode", 'DRAW'), + ("wait_for_input", False), + ("disable_straight", True), + ("disable_stabilizer", True), + ]}), # If press alternative key, the brush now it's for drawing lines ("gpencil.draw", {"type": 'LEFTMOUSE', "value": 'PRESS', "alt": True}, - {"properties": [("mode", 'DRAW'), ("wait_for_input", False), ("disable_straight", True), ("disable_stabilizer", True), ("disable_fill", True)]}), + {"properties": [ + ("mode", 'DRAW'), + ("wait_for_input", False), + ("disable_straight", True), + ("disable_stabilizer", True), + ("disable_fill", True), + ]}), ]) return keymap @@ -3560,7 +3720,7 @@ def km_grease_pencil_stroke_sculpt_mode(params): items.extend([ # Selection - *_grease_pencil_selection(params), + *_grease_pencil_selection(params, use_select_mouse=False), # Brush strength ("wm.radial_control", {"type": 'F', "value": 'PRESS', "shift": True}, @@ -3846,10 +4006,12 @@ def km_grease_pencil_stroke_vertex_mode(params): items.extend([ # Selection - *_grease_pencil_selection(params), + *_grease_pencil_selection(params, use_select_mouse=False), # Brush strength ("wm.radial_control", {"type": 'F', "value": 'PRESS', "shift": True}, - {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength')]}), + {"properties": [ + ("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength'), + ]}), # Brush size ("wm.radial_control", {"type": 'F', "value": 'PRESS'}, {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.size')]}), @@ -3895,7 +4057,9 @@ def km_grease_pencil_stroke_vertex_draw(_params): {"properties": [("wait_for_input", False)]}), # Brush strength ("wm.radial_control", {"type": 'F', "value": 'PRESS', "shift": True}, - {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength')]}), + {"properties": [ + ("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength'), + ]}), # Brush size ("wm.radial_control", {"type": 'F', "value": 'PRESS'}, {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.size')]}), @@ -3918,7 +4082,9 @@ def km_grease_pencil_stroke_vertex_blur(_params): {"properties": [("wait_for_input", False)]}), # Brush strength ("wm.radial_control", {"type": 'F', "value": 'PRESS', "shift": True}, - {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength')]}), + {"properties": [ + ("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength'), + ]}), # Brush size ("wm.radial_control", {"type": 'F', "value": 'PRESS'}, {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.size')]}), @@ -3943,7 +4109,9 @@ def km_grease_pencil_stroke_vertex_average(_params): {"properties": [("wait_for_input", False)]}), # Brush strength ("wm.radial_control", {"type": 'F', "value": 'PRESS', "shift": True}, - {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength')]}), + {"properties": [ + ("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength')], + }), # Brush size ("wm.radial_control", {"type": 'F', "value": 'PRESS'}, {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.size')]}), @@ -3966,7 +4134,9 @@ def km_grease_pencil_stroke_vertex_smear(_params): {"properties": [("wait_for_input", False)]}), # Brush strength ("wm.radial_control", {"type": 'F', "value": 'PRESS', "shift": True}, - {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength')]}), + {"properties": [ + ("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength'), + ]}), # Brush size ("wm.radial_control", {"type": 'F', "value": 'PRESS'}, {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.size')]}), @@ -4005,11 +4175,7 @@ def km_face_mask(params): items.extend([ *_template_items_select_actions(params, "paint.face_select_all"), - ("paint.face_select_hide", {"type": 'H', "value": 'PRESS'}, - {"properties": [("unselected", False)]}), - ("paint.face_select_hide", {"type": 'H', "value": 'PRESS', "shift": True}, - {"properties": [("unselected", True)]}), - ("paint.face_select_reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None), + *_template_items_hide_reveal_actions("paint.face_select_hide", "paint.face_select_reveal"), ("paint.face_select_linked", {"type": 'L', "value": 'PRESS', "ctrl": True}, None), ("paint.face_select_linked_pick", {"type": 'L', "value": 'PRESS'}, {"properties": [("deselect", False)]}), @@ -4051,11 +4217,7 @@ def km_pose(params): items.extend([ ("object.parent_set", {"type": 'P', "value": 'PRESS', "ctrl": True}, None), - ("pose.hide", {"type": 'H', "value": 'PRESS'}, - {"properties": [("unselected", False)]}), - ("pose.hide", {"type": 'H', "value": 'PRESS', "shift": True}, - {"properties": [("unselected", True)]}), - ("pose.reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None), + *_template_items_hide_reveal_actions("pose.hide", "pose.reveal"), op_menu("VIEW3D_MT_pose_apply", {"type": 'A', "value": 'PRESS', "ctrl": True}), ("pose.rot_clear", {"type": 'R', "value": 'PRESS', "alt": True}, None), ("pose.loc_clear", {"type": 'G', "value": 'PRESS', "alt": True}, None), @@ -4103,6 +4265,7 @@ def km_pose(params): ("pose.push", {"type": 'E', "value": 'PRESS', "ctrl": True}, None), ("pose.relax", {"type": 'E', "value": 'PRESS', "alt": True}, None), ("pose.breakdown", {"type": 'E', "value": 'PRESS', "shift": True}, None), + ("pose.blend_to_neighbour", {"type": 'E', "value": 'PRESS', "shift": True, "alt": True}, None), op_menu("VIEW3D_MT_pose_propagate", {"type": 'P', "value": 'PRESS', "alt": True}), *( (("object.hide_collection", @@ -4170,17 +4333,15 @@ def km_object_mode(params): ("anim.keying_set_active_set", {"type": 'I', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None), ("collection.create", {"type": 'G', "value": 'PRESS', "ctrl": True}, None), ("collection.objects_remove", {"type": 'G', "value": 'PRESS', "ctrl": True, "alt": True}, None), - ("collection.objects_remove_all", {"type": 'G', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None), - ("collection.objects_add_active", {"type": 'G', "value": 'PRESS', "shift": True, "ctrl": True}, None), + ("collection.objects_remove_all", + {"type": 'G', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None), + ("collection.objects_add_active", + {"type": 'G', "value": 'PRESS', "shift": True, "ctrl": True}, None), ("collection.objects_remove_active", {"type": 'G', "value": 'PRESS', "shift": True, "alt": True}, None), *_template_items_object_subdivision_set(), ("object.move_to_collection", {"type": 'M', "value": 'PRESS'}, None), ("object.link_to_collection", {"type": 'M', "value": 'PRESS', "shift": True}, None), - ("object.hide_view_clear", {"type": 'H', "value": 'PRESS', "alt": True}, None), - ("object.hide_view_set", {"type": 'H', "value": 'PRESS'}, - {"properties": [("unselected", False)]}), - ("object.hide_view_set", {"type": 'H', "value": 'PRESS', "shift": True}, - {"properties": [("unselected", True)]}), + *_template_items_hide_reveal_actions("object.hide_view_set", "object.hide_view_clear"), ("object.hide_collection", {"type": 'H', "value": 'PRESS', "ctrl": True}, None), *( (("object.hide_collection", @@ -4267,10 +4428,13 @@ def km_curve(params): {"properties": [("deselect", False)]}), ("curve.select_linked_pick", {"type": 'L', "value": 'PRESS', "shift": True}, {"properties": [("deselect", True)]}), - ("curve.shortest_path_pick", {"type": params.select_mouse, "value": params.select_mouse_value, "ctrl": True}, None), + ("curve.shortest_path_pick", + {"type": params.select_mouse, "value": params.select_mouse_value_fallback, "ctrl": True}, None), ("curve.separate", {"type": 'P', "value": 'PRESS'}, None), ("curve.split", {"type": 'Y', "value": 'PRESS'}, None), - ("curve.extrude_move", {"type": 'E', "value": 'PRESS'}, None), + op_tool_optional( + ("curve.extrude_move", {"type": 'E', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.extrude"), params), ("curve.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None), ("curve.make_segment", {"type": 'F', "value": 'PRESS'}, None), ("curve.cyclic_toggle", {"type": 'C', "value": 'PRESS', "alt": True}, None), @@ -4279,15 +4443,14 @@ def km_curve(params): ("curve.dissolve_verts", {"type": 'X', "value": 'PRESS', "ctrl": True}, None), ("curve.dissolve_verts", {"type": 'DEL', "value": 'PRESS', "ctrl": True}, None), ("curve.tilt_clear", {"type": 'T', "value": 'PRESS', "alt": True}, None), - ("transform.tilt", {"type": 'T', "value": 'PRESS', "ctrl": True}, None), + op_tool_optional( + ("transform.tilt", {"type": 'T', "value": 'PRESS', "ctrl": True}, None), + (op_tool_cycle, "builtin.tilt"), params), ("transform.transform", {"type": 'S', "value": 'PRESS', "alt": True}, {"properties": [("mode", 'CURVE_SHRINKFATTEN')]}), - ("curve.reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None), - ("curve.hide", {"type": 'H', "value": 'PRESS'}, - {"properties": [("unselected", False)]}), - ("curve.hide", {"type": 'H', "value": 'PRESS', "shift": True}, - {"properties": [("unselected", True)]}), - ("curve.normals_make_consistent", {"type": 'N', "value": 'PRESS', "ctrl" if params.legacy else "shift": True}, None), + *_template_items_hide_reveal_actions("curve.hide", "curve.reveal"), + ("curve.normals_make_consistent", + {"type": 'N', "value": 'PRESS', "ctrl" if params.legacy else "shift": True}, None), ("object.vertex_parent_set", {"type": 'P', "value": 'PRESS', "ctrl": True}, None), op_menu("VIEW3D_MT_hook", {"type": 'H', "value": 'PRESS', "ctrl": True}), *_template_items_proportional_editing( @@ -4328,9 +4491,11 @@ def _template_paint_radial_control(paint, rotation=False, secondary_rotation=Fal items.extend([ ("wm.radial_control", {"type": 'F', "value": 'PRESS'}, - radial_control_properties(paint, 'size', 'use_unified_size', secondary_rotation=secondary_rotation, color=color, zoom=zoom)), + radial_control_properties( + paint, 'size', 'use_unified_size', secondary_rotation=secondary_rotation, color=color, zoom=zoom)), ("wm.radial_control", {"type": 'F', "value": 'PRESS', "shift": True}, - radial_control_properties(paint, 'strength', 'use_unified_strength', secondary_rotation=secondary_rotation, color=color)), + radial_control_properties( + paint, 'strength', 'use_unified_strength', secondary_rotation=secondary_rotation, color=color)), ]) if rotation: @@ -4342,12 +4507,87 @@ def _template_paint_radial_control(paint, rotation=False, secondary_rotation=Fal if secondary_rotation: items.extend([ ("wm.radial_control", {"type": 'F', "value": 'PRESS', "ctrl": True, "alt": True}, - radial_control_properties(paint, 'mask_texture_slot.angle', None, secondary_rotation=secondary_rotation, color=color)), + radial_control_properties( + paint, 'mask_texture_slot.angle', None, secondary_rotation=secondary_rotation, color=color)), ]) return items +def _template_view3d_select(*, type, value, legacy): + return [( + "view3d.select", + {"type": type, "value": value, **{m: True for m in mods}}, + {"properties": [(c, True) for c in props]}, + ) for props, mods in ( + (("deselect_all",) if not legacy else (), ()), + (("toggle",), ("shift",)), + (("center", "object"), ("ctrl",)), + (("enumerate",), ("alt",)), + (("toggle", "center"), ("shift", "ctrl")), + (("center", "enumerate"), ("ctrl", "alt")), + (("toggle", "enumerate"), ("shift", "alt")), + (("toggle", "center", "enumerate"), ("shift", "ctrl", "alt")), + )] + + +def _template_view3d_select_for_fallback(params, fallback): + if (not fallback) and params.use_fallback_tool_rmb: + # Needed so we have immediate select+tweak when the default select tool is active. + return _template_view3d_select( + type=params.select_mouse, + value=params.select_mouse_value, + legacy=params.legacy, + ) + return [] + + +def _template_view3d_gpencil_select(*, type, value, legacy, use_select_mouse=True): + return [ + *([] if not use_select_mouse else [ + ("gpencil.select", {"type": type, "value": value}, + {"properties": [("deselect_all", not legacy)]})]), + ("gpencil.select", {"type": type, "value": value, "shift": True}, + {"properties": [("extend", True), ("toggle", True)]}), + # Whole stroke select + ("gpencil.select", {"type": type, "value": value, "alt": True}, + {"properties": [("entire_strokes", True)]}), + ("gpencil.select", {"type": type, "value": value, "shift": True, "alt": True}, + {"properties": [("extend", True), ("entire_strokes", True)]}), + ] + + +def _template_view3d_gpencil_select_for_fallback(params, fallback): + if (not fallback) and params.use_fallback_tool_rmb: + # Needed so we have immediate select+tweak when the default select tool is active. + return _template_view3d_gpencil_select( + type=params.select_mouse, + value=params.select_mouse_value, + legacy=params.legacy, + ) + return [] + + +def _template_uv_select(*, type, value, legacy): + return [ + ("uv.select", {"type": type, "value": value}, + {"properties": [("deselect_all", not legacy)]}), + ("uv.select", {"type": type, "value": value, "shift": True}, + {"properties": [("extend", True)]}), + ] + + +def _template_uv_select_for_fallback(params, fallback): + if (not fallback) and params.use_fallback_tool_rmb: + # Needed so we have immediate select+tweak when the default select tool is active. + return _template_uv_select( + type=params.select_mouse, + value=params.select_mouse_value, + legacy=params.legacy, + ) + return [] + + def km_image_paint(params): items = [] keymap = ( @@ -4521,16 +4761,27 @@ def km_sculpt(params): ("sculpt.expand", {"type": 'A', "value": 'PRESS', "shift": True, "alt": True}, {"properties": [("target", "MASK"), ("falloff_type", "NORMALS"), ("invert", False)]}), ("sculpt.expand", {"type": 'W', "value": 'PRESS', "shift": True}, - {"properties": [("target", "FACE_SETS"), ("falloff_type", "GEODESIC"), ("invert", False), ("use_modify_active", False)]}), + {"properties": [ + ("target", "FACE_SETS"), + ("falloff_type", "GEODESIC"), + ("invert", False), + ("use_modify_active", False)]}), ("sculpt.expand", {"type": 'W', "value": 'PRESS', "shift": True, "alt": True}, - {"properties": [("target", "FACE_SETS"), ("falloff_type", "BOUNDARY_FACE_SET"),("invert", False), ("use_modify_active", True)]}), + {"properties": [ + ("target", "FACE_SETS"), + ("falloff_type", "BOUNDARY_FACE_SET"), + ("invert", False), + ("use_modify_active", True), + ]}), # Partial Visibility Show/hide + # Match keys from: `_template_items_hide_reveal_actions`, cannot use because arguments aren't compatible. ("sculpt.face_set_change_visibility", {"type": 'H', "value": 'PRESS'}, {"properties": [("mode", 'TOGGLE')]}), ("sculpt.face_set_change_visibility", {"type": 'H', "value": 'PRESS', "shift": True}, {"properties": [("mode", 'HIDE_ACTIVE')]}), ("sculpt.face_set_change_visibility", {"type": 'H', "value": 'PRESS', "alt": True}, {"properties": [("mode", 'SHOW_ALL')]}), + ("sculpt.face_set_edit", {"type": 'W', "value": 'PRESS', "ctrl": True}, {"properties": [("mode", 'GROW')]}), ("sculpt.face_set_edit", {"type": 'W', "value": 'PRESS', "ctrl": True, "alt": True}, @@ -4610,7 +4861,7 @@ def km_sculpt(params): {"properties": [("data_path", 'tool_settings.sculpt.brush.use_smooth_stroke')]}), op_menu("VIEW3D_MT_angle_control", {"type": 'R', "value": 'PRESS'}), op_menu_pie("VIEW3D_MT_sculpt_mask_edit_pie", {"type": 'A', "value": 'PRESS'}), - op_menu_pie("VIEW3D_MT_sculpt_automasking_pie", {"type": 'A', "alt": True,"value": 'PRESS'}), + op_menu_pie("VIEW3D_MT_sculpt_automasking_pie", {"type": 'A', "alt": True, "value": 'PRESS'}), op_menu_pie("VIEW3D_MT_sculpt_face_sets_edit_pie", {"type": 'W', "value": 'PRESS'}), *_template_items_context_panel("VIEW3D_PT_sculpt_context_menu", params.context_menu_event), ]) @@ -4632,34 +4883,50 @@ def km_mesh(params): items.extend([ # Tools. - ("mesh.loopcut_slide", {"type": 'R', "value": 'PRESS', "ctrl": True}, - {"properties": [("TRANSFORM_OT_edge_slide", [("release_confirm", False)],)]}), - ("mesh.offset_edge_loops_slide", {"type": 'R', "value": 'PRESS', "shift": True, "ctrl": True}, - {"properties": [("TRANSFORM_OT_edge_slide", [("release_confirm", False)],)]}), - ("mesh.inset", {"type": 'I', "value": 'PRESS'}, None), - ("mesh.bevel", {"type": 'B', "value": 'PRESS', "ctrl": True}, - {"properties": [("affect", 'EDGES')]}), + op_tool_optional( + ("mesh.loopcut_slide", {"type": 'R', "value": 'PRESS', "ctrl": True}, + {"properties": [("TRANSFORM_OT_edge_slide", [("release_confirm", False)],)]}), + (op_tool_cycle, "builtin.loop_cut"), params), + op_tool_optional( + ("mesh.offset_edge_loops_slide", {"type": 'R', "value": 'PRESS', "shift": True, "ctrl": True}, + {"properties": [("TRANSFORM_OT_edge_slide", [("release_confirm", False)],)]}), + (op_tool_cycle, "builtin.offset_edge_loop_cut"), params), + op_tool_optional( + ("mesh.inset", {"type": 'I', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.inset_faces"), params), + op_tool_optional( + ("mesh.bevel", {"type": 'B', "value": 'PRESS', "ctrl": True}, + {"properties": [("affect", 'EDGES')]}), + (op_tool_cycle, "builtin.bevel"), params), ("mesh.bevel", {"type": 'B', "value": 'PRESS', "shift": True, "ctrl": True}, {"properties": [("affect", 'VERTICES')]}), # Selection modes. *_template_items_editmode_mesh_select_mode(params), # Loop Select with alt. Double click in case MMB emulation is on (below). - ("mesh.loop_select", {"type": params.select_mouse, "value": params.select_mouse_value, "alt": True}, None), - ("mesh.loop_select", {"type": params.select_mouse, "value": params.select_mouse_value, "shift": True, "alt": True}, + ("mesh.loop_select", + {"type": params.select_mouse, "value": params.select_mouse_value, "alt": True}, None), + ("mesh.loop_select", + {"type": params.select_mouse, "value": params.select_mouse_value, "shift": True, "alt": True}, {"properties": [("toggle", True)]}), # Selection - ("mesh.edgering_select", {"type": params.select_mouse, "value": params.select_mouse_value, "ctrl": True, "alt": True}, None), - ("mesh.edgering_select", {"type": params.select_mouse, "value": params.select_mouse_value, "shift": True, "ctrl": True, "alt": True}, + ("mesh.edgering_select", + {"type": params.select_mouse, "value": params.select_mouse_value, "ctrl": True, "alt": True}, None), + ("mesh.edgering_select", + {"type": params.select_mouse, "value": params.select_mouse_value, "shift": True, "ctrl": True, "alt": True}, {"properties": [("toggle", True)]}), - ("mesh.shortest_path_pick", {"type": params.select_mouse, "value": params.select_mouse_value, "ctrl": True}, + ("mesh.shortest_path_pick", + {"type": params.select_mouse, "value": params.select_mouse_value_fallback, "ctrl": True}, {"properties": [("use_fill", False)]}), - ("mesh.shortest_path_pick", {"type": params.select_mouse, "value": params.select_mouse_value, "shift": True, "ctrl": True}, + ("mesh.shortest_path_pick", + {"type": params.select_mouse, "value": params.select_mouse_value_fallback, "shift": True, "ctrl": True}, {"properties": [("use_fill", True)]}), *_template_items_select_actions(params, "mesh.select_all"), ("mesh.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None), ("mesh.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None), - ("mesh.select_next_item", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": True, "ctrl": True, "repeat": True}, None), - ("mesh.select_prev_item", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "shift": True, "ctrl": True, "repeat": True}, None), + ("mesh.select_next_item", + {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": True, "ctrl": True, "repeat": True}, None), + ("mesh.select_prev_item", + {"type": 'NUMPAD_MINUS', "value": 'PRESS', "shift": True, "ctrl": True, "repeat": True}, None), ("mesh.select_linked", {"type": 'L', "value": 'PRESS', "ctrl": True}, None), ("mesh.select_linked_pick", {"type": 'L', "value": 'PRESS'}, {"properties": [("deselect", False)]}), @@ -4668,17 +4935,15 @@ def km_mesh(params): ("mesh.select_mirror", {"type": 'M', "value": 'PRESS', "shift": True, "ctrl": True}, None), op_menu("VIEW3D_MT_edit_mesh_select_similar", {"type": 'G', "value": 'PRESS', "shift": True}), # Hide/reveal. - ("mesh.hide", {"type": 'H', "value": 'PRESS'}, - {"properties": [("unselected", False)]}), - ("mesh.hide", {"type": 'H', "value": 'PRESS', "shift": True}, - {"properties": [("unselected", True)]}), - ("mesh.reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None), + *_template_items_hide_reveal_actions("mesh.hide", "mesh.reveal"), # Tools. ("mesh.normals_make_consistent", {"type": 'N', "value": 'PRESS', "ctrl" if params.legacy else "shift": True}, {"properties": [("inside", False)]}), ("mesh.normals_make_consistent", {"type": 'N', "value": 'PRESS', "shift": True, "ctrl": True}, {"properties": [("inside", True)]}), - ("view3d.edit_mesh_extrude_move_normal", {"type": 'E', "value": 'PRESS'}, None), + op_tool_optional( + ("view3d.edit_mesh_extrude_move_normal", {"type": 'E', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.extrude_region"), params), op_menu("VIEW3D_MT_edit_mesh_extrude", {"type": 'E', "value": 'PRESS', "alt": True}), ("transform.edge_crease", {"type": 'E', "value": 'PRESS', "shift": True}, None), ("mesh.fill", {"type": 'F', "value": 'PRESS', "alt": True}, None), @@ -4687,8 +4952,11 @@ def km_mesh(params): ("mesh.quads_convert_to_tris", {"type": 'T', "value": 'PRESS', "shift": True, "ctrl": True}, {"properties": [("quad_method", 'FIXED'), ("ngon_method", 'CLIP')]}), ("mesh.tris_convert_to_quads", {"type": 'J', "value": 'PRESS', "alt": True}, None), - ("mesh.rip_move", {"type": 'V', "value": 'PRESS'}, - {"properties": [("MESH_OT_rip", [("use_fill", False)],)]}), + op_tool_optional( + ("mesh.rip_move", {"type": 'V', "value": 'PRESS'}, + {"properties": [("MESH_OT_rip", [("use_fill", False)],)]}), + (op_tool_cycle, "builtin.rip_region"), params), + # No tool is available for this. ("mesh.rip_move", {"type": 'V', "value": 'PRESS', "alt": True}, {"properties": [("MESH_OT_rip", [("use_fill", True)],)]}), ("mesh.rip_edge_move", {"type": 'D', "value": 'PRESS', "alt": True}, None), @@ -4702,7 +4970,9 @@ def km_mesh(params): ("mesh.split", {"type": 'Y', "value": 'PRESS'}, None), ("mesh.vert_connect_path", {"type": 'J', "value": 'PRESS'}, None), ("mesh.point_normals", {"type": 'L', "value": 'PRESS', "alt": True}, None), - ("transform.vert_slide", {"type": 'V', "value": 'PRESS', "shift": True}, None), + op_tool_optional( + ("transform.vert_slide", {"type": 'V', "value": 'PRESS', "shift": True}, None), + (op_tool_cycle, "builtin.vertex_slide"), params), ("mesh.dupli_extrude_cursor", {"type": params.action_mouse, "value": 'CLICK', "ctrl": True}, {"properties": [("rotate_source", True)]}), ("mesh.dupli_extrude_cursor", {"type": params.action_mouse, "value": 'CLICK', "shift": True, "ctrl": True}, @@ -4711,8 +4981,10 @@ def km_mesh(params): op_menu("VIEW3D_MT_edit_mesh_delete", {"type": 'DEL', "value": 'PRESS'}), ("mesh.dissolve_mode", {"type": 'X', "value": 'PRESS', "ctrl": True}, None), ("mesh.dissolve_mode", {"type": 'DEL', "value": 'PRESS', "ctrl": True}, None), - ("mesh.knife_tool", {"type": 'K', "value": 'PRESS'}, - {"properties": [("use_occlude_geometry", True), ("only_selected", False)]}), + op_tool_optional( + ("mesh.knife_tool", {"type": 'K', "value": 'PRESS'}, + {"properties": [("use_occlude_geometry", True), ("only_selected", False)]}), + (op_tool_cycle, "builtin.knife"), params), ("mesh.knife_tool", {"type": 'K', "value": 'PRESS', "shift": True}, {"properties": [("use_occlude_geometry", False), ("only_selected", True)]}), ("object.vertex_parent_set", {"type": 'P', "value": 'PRESS', "ctrl": True}, None), @@ -4737,16 +5009,20 @@ def km_mesh(params): {"properties": [("extend", True)]}), ("mesh.loop_select", {"type": params.select_mouse, "value": 'DOUBLE_CLICK', "alt": True}, {"properties": [("deselect", True)]}), - ("mesh.edgering_select", {"type": params.select_mouse, "value": 'DOUBLE_CLICK', "ctrl": True}, None), - ("mesh.edgering_select", {"type": params.select_mouse, "value": 'DOUBLE_CLICK', "shift": True, "ctrl": True}, + ("mesh.edgering_select", + {"type": params.select_mouse, "value": 'DOUBLE_CLICK', "ctrl": True}, None), + ("mesh.edgering_select", + {"type": params.select_mouse, "value": 'DOUBLE_CLICK', "shift": True, "ctrl": True}, {"properties": [("toggle", True)]}), ]) if params.legacy: items.extend([ ("mesh.poke", {"type": 'P', "value": 'PRESS', "alt": True}, None), - ("mesh.select_non_manifold", {"type": 'M', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None), - ("mesh.faces_select_linked_flat", {"type": 'F', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None), + ("mesh.select_non_manifold", + {"type": 'M', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None), + ("mesh.faces_select_linked_flat", + {"type": 'F', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None), ("mesh.spin", {"type": 'R', "value": 'PRESS', "alt": True}, None), ("mesh.beautify_fill", {"type": 'F', "value": 'PRESS', "shift": True, "alt": True}, None), *_template_items_object_subdivision_set(), @@ -4766,11 +5042,7 @@ def km_armature(params): items.extend([ # Hide/reveal. - ("armature.hide", {"type": 'H', "value": 'PRESS'}, - {"properties": [("unselected", False)]}), - ("armature.hide", {"type": 'H', "value": 'PRESS', "shift": True}, - {"properties": [("unselected", True)]}), - ("armature.reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None), + *_template_items_hide_reveal_actions("armature.hide", "armature.reveal"), # Align & roll. ("armature.align", {"type": 'A', "value": 'PRESS', "ctrl": True, "alt": True}, None), ("armature.calculate_roll", {"type": 'N', "value": 'PRESS', "ctrl" if params.legacy else "shift": True}, None), @@ -4801,14 +5073,17 @@ def km_armature(params): ("armature.select_linked_pick", {"type": 'L', "value": 'PRESS', "shift": True}, {"properties": [("deselect", True)]}), ("armature.select_linked", {"type": 'L', "value": 'PRESS', "ctrl": True}, None), - ("armature.shortest_path_pick", {"type": params.select_mouse, "value": params.select_mouse_value, "ctrl": True}, None), + ("armature.shortest_path_pick", + {"type": params.select_mouse, "value": params.select_mouse_value_fallback, "ctrl": True}, None), # Editing. op_menu("VIEW3D_MT_edit_armature_delete", {"type": 'X', "value": 'PRESS'}), op_menu("VIEW3D_MT_edit_armature_delete", {"type": 'DEL', "value": 'PRESS'}), ("armature.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None), ("armature.dissolve", {"type": 'X', "value": 'PRESS', "ctrl": True}, None), ("armature.dissolve", {"type": 'DEL', "value": 'PRESS', "ctrl": True}, None), - ("armature.extrude_move", {"type": 'E', "value": 'PRESS'}, None), + op_tool_optional( + ("armature.extrude_move", {"type": 'E', "value": 'PRESS'}, None), + (op_tool_cycle, "builtin.extrude"), params), ("armature.extrude_forked", {"type": 'E', "value": 'PRESS', "shift": True}, None), ("armature.click_extrude", {"type": params.action_mouse, "value": 'CLICK', "ctrl": True}, None), ("armature.fill", {"type": 'F', "value": 'PRESS'}, None), @@ -4823,11 +5098,17 @@ def km_armature(params): ("armature.armature_layers", {"type": 'M', "value": 'PRESS', "shift": True}, None), ("armature.bone_layers", {"type": 'M', "value": 'PRESS'}, None), # Special transforms. - ("transform.bbone_resize", {"type": 'S', "value": 'PRESS', "ctrl": True, "alt": True}, None), - ("transform.transform", {"type": 'S', "value": 'PRESS', "alt": True}, - {"properties": [("mode", 'BONE_ENVELOPE')]}), - ("transform.transform", {"type": 'R', "value": 'PRESS', "ctrl": True}, - {"properties": [("mode", 'BONE_ROLL')]}), + op_tool_optional( + ("transform.bbone_resize", {"type": 'S', "value": 'PRESS', "ctrl": True, "alt": True}, None), + (op_tool_cycle, "builtin.bone_size"), params), + op_tool_optional( + ("transform.transform", {"type": 'S', "value": 'PRESS', "alt": True}, + {"properties": [("mode", 'BONE_ENVELOPE')]}), + (op_tool_cycle, "builtin.bone_envelope"), params), + op_tool_optional( + ("transform.transform", {"type": 'R', "value": 'PRESS', "ctrl": True}, + {"properties": [("mode", 'BONE_ROLL')]}), + (op_tool_cycle, "builtin.roll"), params), # Menus. *_template_items_context_menu("VIEW3D_MT_armature_context_menu", params.context_menu_event), ]) @@ -4846,11 +5127,7 @@ def km_metaball(params): items.extend([ ("object.metaball_add", {"type": 'A', "value": 'PRESS', "shift": True}, None), - ("mball.reveal_metaelems", {"type": 'H', "value": 'PRESS', "alt": True}, None), - ("mball.hide_metaelems", {"type": 'H', "value": 'PRESS'}, - {"properties": [("unselected", False)]}), - ("mball.hide_metaelems", {"type": 'H', "value": 'PRESS', "shift": True}, - {"properties": [("unselected", True)]}), + *_template_items_hide_reveal_actions("mball.hide_metaelems", "mball.reveal_metaelems"), ("mball.delete_metaelems", {"type": 'X', "value": 'PRESS'}, None), ("mball.delete_metaelems", {"type": 'DEL', "value": 'PRESS'}, None), ("mball.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None), @@ -4908,11 +5185,7 @@ def km_particle(params): ("particle.select_linked", {"type": 'L', "value": 'PRESS', "ctrl": True}, None), ("particle.delete", {"type": 'X', "value": 'PRESS'}, None), ("particle.delete", {"type": 'DEL', "value": 'PRESS'}, None), - ("particle.reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None), - ("particle.hide", {"type": 'H', "value": 'PRESS'}, - {"properties": [("unselected", False)]}), - ("particle.hide", {"type": 'H', "value": 'PRESS', "shift": True}, - {"properties": [("unselected", True)]}), + *_template_items_hide_reveal_actions("particle.hide", "particle.reveal"), ("particle.brush_edit", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), ("particle.brush_edit", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, None), ("wm.radial_control", {"type": 'F', "value": 'PRESS'}, @@ -5621,6 +5894,7 @@ def km_paint_stroke_modal(_params): return keymap + def km_sculpt_expand_modal(_params): items = [] keymap = ( @@ -5828,38 +6102,60 @@ def km_image_editor_tool_uv_cursor(params): ) -def km_image_editor_tool_uv_select(params): +def km_image_editor_tool_uv_select(params, *, fallback): return ( - "Image Editor Tool: Uv, Tweak", + _fallback_id("Image Editor Tool: Uv, Tweak", fallback), {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, - {"items": _template_items_tool_select(params, "uv.select", "uv.cursor_set", extend="extend")}, + {"items": [ + *([] if fallback else _template_items_tool_select(params, "uv.select", "uv.cursor_set", extend="extend")), + *([] if (not params.use_fallback_tool_rmb) else _template_uv_select( + type=params.select_mouse, value=params.select_mouse_value, legacy=params.legacy)), + ]}, ) -def km_image_editor_tool_uv_select_box(params): +def km_image_editor_tool_uv_select_box(params, *, fallback): return ( - "Image Editor Tool: Uv, Select Box", + _fallback_id("Image Editor Tool: Uv, Select Box", fallback), {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, - {"items": _template_items_tool_select_actions_simple("uv.select_box", type=params.tool_tweak, value='ANY')}, + {"items": [ + *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions_simple( + "uv.select_box", + type=params.select_tweak if fallback else params.tool_tweak, + value='ANY')), + *_template_uv_select_for_fallback(params, fallback), + ]}, ) -def km_image_editor_tool_uv_select_circle(params): +def km_image_editor_tool_uv_select_circle(params, *, fallback): return ( - "Image Editor Tool: Uv, Select Circle", + _fallback_id("Image Editor Tool: Uv, Select Circle", fallback), {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, - {"items": _template_items_tool_select_actions_simple( - "uv.select_circle", type=params.tool_mouse, value='PRESS', - properties=[("wait_for_input", False)], - )}, + {"items": [ + *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions_simple( + "uv.select_circle", + type=params.select_tweak if fallback else params.tool_mouse, + value='ANY' if fallback else 'PRESS', + properties=[("wait_for_input", False)])), + # No selection fallback since this operates on press. + ]}, ) -def km_image_editor_tool_uv_select_lasso(params): +def km_image_editor_tool_uv_select_lasso(params, *, fallback): return ( - "Image Editor Tool: Uv, Select Lasso", + _fallback_id("Image Editor Tool: Uv, Select Lasso", fallback), {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, - {"items": _template_items_tool_select_actions_simple("uv.select_lasso", type=params.tool_tweak, value='ANY')}, + + {"items": [ + *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions_simple( + "uv.select_lasso", + type=params.select_tweak if fallback else params.tool_tweak, + value='ANY') + ), + *_template_uv_select_for_fallback(params, fallback), + ]}, ) @@ -5868,7 +6164,7 @@ def km_image_editor_tool_uv_rip_region(params): "Image Editor Tool: Uv, Rip Region", {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, {"items": [ - ("uv.rip_move", {"type": params.tool_tweak, "value": 'ANY'}, + ("uv.rip_move", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("TRANSFORM_OT_translate", [("release_confirm", True)])]}), ]}, ) @@ -5898,7 +6194,7 @@ def km_image_editor_tool_uv_move(params): "Image Editor Tool: Uv, Move", {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, {"items": [ - ("transform.translate", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.translate", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True)]}), ]}, ) @@ -5909,7 +6205,7 @@ def km_image_editor_tool_uv_rotate(params): "Image Editor Tool: Uv, Rotate", {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, {"items": [ - ("transform.rotate", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.rotate", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True)]}), ]}, ) @@ -5920,53 +6216,59 @@ def km_image_editor_tool_uv_scale(params): "Image Editor Tool: Uv, Scale", {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, {"items": [ - ("transform.resize", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.resize", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True)]}), ]}, ) -def km_node_editor_tool_select(params): +def km_node_editor_tool_select(params, *, fallback): return ( - "Node Tool: Tweak", + _fallback_id("Node Tool: Tweak", fallback), {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, {"items": [ - ("node.select", {"type": params.select_mouse, "value": 'PRESS'}, - {"properties": [("deselect_all", not params.legacy)]}), + *([] if fallback else [ + ("node.select", {"type": params.select_mouse, "value": 'PRESS'}, + {"properties": [("deselect_all", not params.legacy)]}), + ]), ]}, ) -def km_node_editor_tool_select_box(params): +def km_node_editor_tool_select_box(params, *, fallback): return ( - "Node Tool: Select Box", + _fallback_id("Node Tool: Select Box", fallback), {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, - {"items": _template_items_tool_select_actions_simple( - "node.select_box", type=params.tool_tweak, value='ANY', - properties=[("tweak", True)], - )}, + {"items": [ + *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions_simple( + "node.select_box", type=params.tool_tweak, value='ANY', + properties=[("tweak", True)], + )), + ]}, ) -def km_node_editor_tool_select_lasso(params): +def km_node_editor_tool_select_lasso(params, *, fallback): return ( - "Node Tool: Select Lasso", + _fallback_id("Node Tool: Select Lasso", fallback), {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, - {"items": _template_items_tool_select_actions_simple( - "node.select_lasso", type=params.tool_mouse, value='PRESS', - properties=[("tweak", True)], - )}, + {"items": [ + *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions_simple( + "node.select_lasso", type=params.tool_mouse, value='PRESS', + properties=[("tweak", True)])) + ]}, ) -def km_node_editor_tool_select_circle(params): +def km_node_editor_tool_select_circle(params, *, fallback): return ( - "Node Tool: Select Circle", + _fallback_id("Node Tool: Select Circle", fallback), {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, - {"items": _template_items_tool_select_actions_simple( - "node.select_circle", type=params.tool_mouse, value='PRESS', - properties=[("wait_for_input", False)], - )}, + {"items": [ + *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions_simple( + "node.select_circle", type=params.tool_mouse, value='PRESS', + properties=[("wait_for_input", False)])), + ]}, ) @@ -5992,38 +6294,61 @@ def km_3d_view_tool_cursor(params): ) -def km_3d_view_tool_select(params): +def km_3d_view_tool_select(params, *, fallback): return ( - "3D View Tool: Tweak", + _fallback_id("3D View Tool: Tweak", fallback), {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, - {"items": _template_items_tool_select(params, "view3d.select", "view3d.cursor3d", extend="toggle")}, + {"items": [ + *([] if fallback else _template_items_tool_select( + params, "view3d.select", "view3d.cursor3d", extend="toggle")), + *([] if (not params.use_fallback_tool_rmb) else _template_view3d_select( + type=params.select_mouse, value=params.select_mouse_value, legacy=params.legacy)), + ]}, ) -def km_3d_view_tool_select_box(params): +def km_3d_view_tool_select_box(params, *, fallback): return ( - "3D View Tool: Select Box", + _fallback_id("3D View Tool: Select Box", fallback), {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, - {"items": _template_items_tool_select_actions("view3d.select_box", type=params.tool_tweak, value='ANY')}, + {"items": [ + *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions( + "view3d.select_box", + type=params.select_tweak if fallback else params.tool_tweak, + value='ANY')), + *_template_view3d_select_for_fallback(params, fallback), + ]}, ) -def km_3d_view_tool_select_circle(params): +def km_3d_view_tool_select_circle(params, *, fallback): return ( - "3D View Tool: Select Circle", + _fallback_id("3D View Tool: Select Circle", fallback), {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, - {"items": _template_items_tool_select_actions_simple( - "view3d.select_circle", type=params.tool_mouse, value='PRESS', - properties=[("wait_for_input", False)], - )}, + {"items": [ + *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions_simple( + "view3d.select_circle", + # Why circle select should be used on tweak? + # So that RMB or Shift-RMB is still able to set an element as active. + type=params.select_tweak if fallback else params.tool_mouse, + value='ANY' if fallback else 'PRESS', + properties=[("wait_for_input", False)])), + # No selection fallback since this operates on press. + ]}, ) -def km_3d_view_tool_select_lasso(params): +def km_3d_view_tool_select_lasso(params, *, fallback): return ( - "3D View Tool: Select Lasso", + _fallback_id("3D View Tool: Select Lasso", fallback), {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, - {"items": _template_items_tool_select_actions("view3d.select_lasso", type=params.tool_tweak, value='ANY')}, + {"items": [ + *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions( + "view3d.select_lasso", + type=params.select_tweak if fallback else params.tool_tweak, + value='ANY')), + *_template_view3d_select_for_fallback(params, fallback), + ]} ) @@ -6032,7 +6357,8 @@ def km_3d_view_tool_transform(params): "3D View Tool: Transform", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.from_gizmo", {"type": params.tool_tweak, "value": 'ANY'}, None), + ("transform.from_gizmo", + {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, None), ]}, ) @@ -6042,7 +6368,8 @@ def km_3d_view_tool_move(params): "3D View Tool: Move", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.translate", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.translate", + {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True)]}), ]}, ) @@ -6053,7 +6380,8 @@ def km_3d_view_tool_rotate(params): "3D View Tool: Rotate", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.rotate", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.rotate", + {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True)]}), ]}, ) @@ -6064,7 +6392,8 @@ def km_3d_view_tool_scale(params): "3D View Tool: Scale", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.resize", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.resize", + {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True)]}), ]}, ) @@ -6076,15 +6405,15 @@ def km_3d_view_tool_shear(params): {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ ("transform.shear", - {"type": params.tool_tweak, "value": 'NORTH'}, + {"type": params.tool_tweak, "value": 'NORTH', **params.tool_modifier}, {"properties": [("release_confirm", True), ("orient_axis_ortho", 'Y')]}), ("transform.shear", - {"type": params.tool_tweak, "value": 'SOUTH'}, + {"type": params.tool_tweak, "value": 'SOUTH', **params.tool_modifier}, {"properties": [("release_confirm", True), ("orient_axis_ortho", 'Y')]}), # Use as fallback to catch diagonals too. ("transform.shear", - {"type": params.tool_tweak, "value": 'ANY'}, + {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True), ("orient_axis_ortho", 'X')]}), ]}, ) @@ -6107,7 +6436,7 @@ def km_3d_view_tool_pose_breakdowner(params): "3D View Tool: Pose, Breakdowner", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("pose.breakdown", {"type": params.tool_tweak, "value": 'ANY'}, None), + ("pose.breakdown", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, None), ]}, ) @@ -6117,7 +6446,8 @@ def km_3d_view_tool_pose_push(params): "3D View Tool: Pose, Push", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("pose.push", {"type": params.tool_tweak, "value": 'ANY'}, None), + ("pose.push", + {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, None), ]}, ) @@ -6127,7 +6457,8 @@ def km_3d_view_tool_pose_relax(params): "3D View Tool: Pose, Relax", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("pose.relax", {"type": params.tool_tweak, "value": 'ANY'}, None), + ("pose.relax", + {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, None), ]}, ) @@ -6137,7 +6468,8 @@ def km_3d_view_tool_edit_armature_roll(params): "3D View Tool: Edit Armature, Roll", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.transform", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.transform", + {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True), ("mode", 'BONE_ROLL')]}), ]}, ) @@ -6148,7 +6480,7 @@ def km_3d_view_tool_edit_armature_bone_size(params): "3D View Tool: Edit Armature, Bone Size", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.transform", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.transform", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True), ("mode", 'BONE_ENVELOPE')]}), ]}, ) @@ -6160,7 +6492,7 @@ def km_3d_view_tool_edit_armature_bone_envelope(params): {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.bbone_resize", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.bbone_resize", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True)]}), ]}, ) @@ -6171,7 +6503,7 @@ def km_3d_view_tool_edit_armature_extrude(params): "3D View Tool: Edit Armature, Extrude", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("armature.extrude_move", {"type": params.tool_tweak, "value": 'ANY'}, + ("armature.extrude_move", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("TRANSFORM_OT_translate", [("release_confirm", True)])]}), ]}, ) @@ -6182,7 +6514,7 @@ def km_3d_view_tool_edit_armature_extrude_to_cursor(params): "3D View Tool: Edit Armature, Extrude to Cursor", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("armature.click_extrude", {"type": params.tool_mouse, "value": 'PRESS'}, None), + ("armature.click_extrude", {"type": params.tool_mouse, "value": 'PRESS', **params.tool_modifier}, None), ]}, ) @@ -6203,7 +6535,7 @@ def km_3d_view_tool_edit_mesh_extrude_region(params): "3D View Tool: Edit Mesh, Extrude Region", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("mesh.extrude_context_move", {"type": params.tool_tweak, "value": 'ANY'}, + ("mesh.extrude_context_move", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("TRANSFORM_OT_translate", [("release_confirm", True)])]}), ]}, ) @@ -6214,7 +6546,7 @@ def km_3d_view_tool_edit_mesh_extrude_manifold(params): "3D View Tool: Edit Mesh, Extrude Manifold", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("mesh.extrude_manifold", {"type": params.tool_tweak, "value": 'ANY'}, + ("mesh.extrude_manifold", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [ ("MESH_OT_extrude_region", [("use_dissolve_ortho_edges", True)]), ("TRANSFORM_OT_translate", [ @@ -6233,7 +6565,7 @@ def km_3d_view_tool_edit_mesh_extrude_along_normals(params): "3D View Tool: Edit Mesh, Extrude Along Normals", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("mesh.extrude_region_shrink_fatten", {"type": params.tool_tweak, "value": 'ANY'}, + ("mesh.extrude_region_shrink_fatten", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("TRANSFORM_OT_shrink_fatten", [("release_confirm", True)])]}), ]}, ) @@ -6244,7 +6576,7 @@ def km_3d_view_tool_edit_mesh_extrude_individual(params): "3D View Tool: Edit Mesh, Extrude Individual", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("mesh.extrude_faces_move", {"type": params.tool_tweak, "value": 'ANY'}, + ("mesh.extrude_faces_move", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("TRANSFORM_OT_shrink_fatten", [("release_confirm", True)])]}), ]}, ) @@ -6255,6 +6587,7 @@ def km_3d_view_tool_edit_mesh_extrude_to_cursor(params): "3D View Tool: Edit Mesh, Extrude to Cursor", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ + # No need for `tool_modifier` since this takes all input. ("mesh.dupli_extrude_cursor", {"type": params.tool_mouse, "value": 'PRESS'}, None), ]}, ) @@ -6265,7 +6598,7 @@ def km_3d_view_tool_edit_mesh_inset_faces(params): "3D View Tool: Edit Mesh, Inset Faces", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("mesh.inset", {"type": params.tool_tweak, "value": 'ANY'}, + ("mesh.inset", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True)]}), ]}, ) @@ -6276,7 +6609,7 @@ def km_3d_view_tool_edit_mesh_bevel(params): "3D View Tool: Edit Mesh, Bevel", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("mesh.bevel", {"type": params.tool_tweak, "value": 'ANY'}, + ("mesh.bevel", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True)]}), ]}, ) @@ -6287,6 +6620,7 @@ def km_3d_view_tool_edit_mesh_loop_cut(params): "3D View Tool: Edit Mesh, Loop Cut", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ + # No need for `tool_modifier` since this takes all input. ("mesh.loopcut_slide", {"type": params.tool_mouse, "value": 'PRESS'}, {"properties": [("TRANSFORM_OT_edge_slide", [("release_confirm", True)])]}), ]}, @@ -6298,6 +6632,7 @@ def km_3d_view_tool_edit_mesh_offset_edge_loop_cut(params): "3D View Tool: Edit Mesh, Offset Edge Loop Cut", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ + # No need for `tool_modifier` since this takes all input. ("mesh.offset_edge_loops_slide", {"type": params.tool_mouse, "value": 'PRESS'}, None), ]}, ) @@ -6308,6 +6643,7 @@ def km_3d_view_tool_edit_mesh_knife(params): "3D View Tool: Edit Mesh, Knife", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ + # No need for `tool_modifier` since this takes all input. ("mesh.knife_tool", {"type": params.tool_mouse, "value": 'PRESS'}, {"properties": [("wait_for_input", False)]}), ]}, @@ -6319,6 +6655,7 @@ def km_3d_view_tool_edit_mesh_bisect(params): "3D View Tool: Edit Mesh, Bisect", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ + # No need for `tool_modifier` since this takes all input. ("mesh.bisect", {"type": params.tool_tweak, "value": 'ANY'}, None), ]}, ) @@ -6329,6 +6666,7 @@ def km_3d_view_tool_edit_mesh_poly_build(params): "3D View Tool: Edit Mesh, Poly Build", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ + # No need for `tool_modifier` since this takes all input. ("mesh.polybuild_extrude_at_cursor_move", {"type": params.tool_mouse, "value": 'PRESS'}, {"properties": [("TRANSFORM_OT_translate", [("release_confirm", True)])]}), ("mesh.polybuild_face_at_cursor_move", {"type": params.tool_mouse, "value": 'PRESS', "ctrl": True}, @@ -6343,7 +6681,7 @@ def km_3d_view_tool_edit_mesh_spin(params): "3D View Tool: Edit Mesh, Spin", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("mesh.spin", {"type": params.tool_tweak, "value": 'ANY'}, None), + ("mesh.spin", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, None), ]}, ) @@ -6353,7 +6691,7 @@ def km_3d_view_tool_edit_mesh_spin_duplicate(params): "3D View Tool: Edit Mesh, Spin Duplicates", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("mesh.spin", {"type": params.tool_tweak, "value": 'ANY'}, + ("mesh.spin", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("dupli", True)]}), ]}, ) @@ -6364,7 +6702,7 @@ def km_3d_view_tool_edit_mesh_smooth(params): "3D View Tool: Edit Mesh, Smooth", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("mesh.vertices_smooth", {"type": params.tool_tweak, "value": 'ANY'}, + ("mesh.vertices_smooth", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("wait_for_input", False)]}), ]}, ) @@ -6375,7 +6713,7 @@ def km_3d_view_tool_edit_mesh_randomize(params): "3D View Tool: Edit Mesh, Randomize", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.vertex_random", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.vertex_random", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("wait_for_input", False)]}), ]}, ) @@ -6386,7 +6724,7 @@ def km_3d_view_tool_edit_mesh_edge_slide(params): "3D View Tool: Edit Mesh, Edge Slide", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.edge_slide", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.edge_slide", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True)]}), ]}, ) @@ -6397,7 +6735,7 @@ def km_3d_view_tool_edit_mesh_vertex_slide(params): "3D View Tool: Edit Mesh, Vertex Slide", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.vert_slide", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.vert_slide", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True)]}), ]}, ) @@ -6408,7 +6746,7 @@ def km_3d_view_tool_edit_mesh_shrink_fatten(params): "3D View Tool: Edit Mesh, Shrink/Fatten", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.shrink_fatten", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.shrink_fatten", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True)]}), ]}, ) @@ -6419,7 +6757,7 @@ def km_3d_view_tool_edit_mesh_push_pull(params): "3D View Tool: Edit Mesh, Push/Pull", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.push_pull", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.push_pull", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True)]}), ]}, ) @@ -6430,7 +6768,7 @@ def km_3d_view_tool_edit_mesh_to_sphere(params): "3D View Tool: Edit Mesh, To Sphere", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.tosphere", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.tosphere", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True)]}), ]}, ) @@ -6441,7 +6779,7 @@ def km_3d_view_tool_edit_mesh_rip_region(params): "3D View Tool: Edit Mesh, Rip Region", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("mesh.rip_move", {"type": params.tool_tweak, "value": 'ANY'}, + ("mesh.rip_move", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("TRANSFORM_OT_translate", [("release_confirm", True)])]}), ]}, ) @@ -6452,7 +6790,7 @@ def km_3d_view_tool_edit_mesh_rip_edge(params): "3D View Tool: Edit Mesh, Rip Edge", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("mesh.rip_edge_move", {"type": params.tool_tweak, "value": 'ANY'}, + ("mesh.rip_edge_move", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("TRANSFORM_OT_translate", [("release_confirm", True)])]}), ]}, ) @@ -6463,6 +6801,7 @@ def km_3d_view_tool_edit_curve_draw(params): "3D View Tool: Edit Curve, Draw", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ + # No need for `tool_modifier` since this takes all input. ("curve.draw", {"type": params.tool_mouse, "value": 'PRESS'}, {"properties": [("wait_for_input", False)]}), ]}, @@ -6474,7 +6813,7 @@ def km_3d_view_tool_edit_curve_tilt(params): "3D View Tool: Edit Curve, Tilt", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.tilt", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.tilt", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("release_confirm", True)]}), ]}, ) @@ -6485,7 +6824,7 @@ def km_3d_view_tool_edit_curve_radius(params): "3D View Tool: Edit Curve, Radius", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.transform", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.transform", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("mode", 'CURVE_SHRINKFATTEN'), ("release_confirm", True)]}), ]}, ) @@ -6496,7 +6835,7 @@ def km_3d_view_tool_edit_curve_randomize(params): "3D View Tool: Edit Curve, Randomize", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("transform.vertex_random", {"type": params.tool_tweak, "value": 'ANY'}, + ("transform.vertex_random", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("wait_for_input", False)]}), ]}, ) @@ -6507,7 +6846,7 @@ def km_3d_view_tool_edit_curve_extrude(params): "3D View Tool: Edit Curve, Extrude", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("curve.extrude_move", {"type": params.tool_tweak, "value": 'ANY'}, + ("curve.extrude_move", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, {"properties": [("TRANSFORM_OT_translate", [("release_confirm", True)])]}), ]}, ) @@ -6518,6 +6857,7 @@ def km_3d_view_tool_edit_curve_extrude_to_cursor(params): "3D View Tool: Edit Curve, Extrude to Cursor", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ + # No need for `tool_modifier` since this takes all input. ("curve.vertex_add", {"type": params.tool_mouse, "value": 'PRESS'}, None), ]}, ) @@ -6832,12 +7172,16 @@ def km_3d_view_tool_paint_gpencil_eyedropper(params): "3D View Tool: Paint Gpencil, Eyedropper", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("ui.eyedropper_gpencil_color", {"type": params.tool_mouse, "value": 'PRESS'}, None), - ("ui.eyedropper_gpencil_color", {"type": params.tool_mouse, "value": 'PRESS', "shift": True}, None), - ("ui.eyedropper_gpencil_color", {"type": params.tool_mouse, "value": 'PRESS', "shift": True, "ctrl": True}, None), + ("ui.eyedropper_gpencil_color", + {"type": params.tool_mouse, "value": 'PRESS'}, None), + ("ui.eyedropper_gpencil_color", + {"type": params.tool_mouse, "value": 'PRESS', "shift": True}, None), + ("ui.eyedropper_gpencil_color", + {"type": params.tool_mouse, "value": 'PRESS', "shift": True, "ctrl": True}, None), ]}, ) + def km_3d_view_tool_paint_gpencil_interpolate(params): return ( "3D View Tool: Paint Gpencil, Interpolate", @@ -6848,38 +7192,60 @@ def km_3d_view_tool_paint_gpencil_interpolate(params): ]}, ) -def km_3d_view_tool_edit_gpencil_select(params): + +def km_3d_view_tool_edit_gpencil_select(params, *, fallback): return ( - "3D View Tool: Edit Gpencil, Tweak", + _fallback_id("3D View Tool: Edit Gpencil, Tweak", fallback), {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, - {"items": _template_items_tool_select(params, "gpencil.select", "view3d.cursor3d", extend="toggle")}, + {"items": [ + *([] if fallback else _template_items_tool_select( + params, "gpencil.select", "view3d.cursor3d", extend="toggle")), + *([] if (not params.use_fallback_tool_rmb) else _template_view3d_gpencil_select( + type=params.select_mouse, value=params.select_mouse_value, legacy=params.legacy)), + ]}, ) -def km_3d_view_tool_edit_gpencil_select_box(params): +def km_3d_view_tool_edit_gpencil_select_box(params, *, fallback): return ( - "3D View Tool: Edit Gpencil, Select Box", + _fallback_id("3D View Tool: Edit Gpencil, Select Box", fallback), {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, - {"items": _template_items_tool_select_actions("gpencil.select_box", type=params.tool_tweak, value='ANY')}, + {"items": [ + *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions( + "gpencil.select_box", type=params.select_tweak if fallback else params.tool_tweak, value='ANY')), + *_template_view3d_gpencil_select_for_fallback(params, fallback), + ]}, ) -def km_3d_view_tool_edit_gpencil_select_circle(params): +def km_3d_view_tool_edit_gpencil_select_circle(params, *, fallback): return ( - "3D View Tool: Edit Gpencil, Select Circle", + _fallback_id("3D View Tool: Edit Gpencil, Select Circle", fallback), {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, - {"items": _template_items_tool_select_actions_simple( - "gpencil.select_circle", type=params.tool_mouse, value='PRESS', - properties=[("wait_for_input", False)], - )}, + {"items": [ + *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions_simple( + "gpencil.select_circle", + # Why circle select should be used on tweak? + # So that RMB or Shift-RMB is still able to set an element as active. + type=params.select_tweak if fallback else params.tool_mouse, + value='ANY' if fallback else 'PRESS', + properties=[("wait_for_input", False)])), + # No selection fallback since this operates on press. + ]}, ) -def km_3d_view_tool_edit_gpencil_select_lasso(params): +def km_3d_view_tool_edit_gpencil_select_lasso(params, *, fallback): return ( - "3D View Tool: Edit Gpencil, Select Lasso", + _fallback_id("3D View Tool: Edit Gpencil, Select Lasso", fallback), {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, - {"items": _template_items_tool_select_actions("gpencil.select_lasso", type=params.tool_tweak, value='ANY')}, + {"items": [ + *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions( + "gpencil.select_lasso", + type=params.select_tweak if fallback else params.tool_tweak, + value='ANY')), + *_template_view3d_gpencil_select_for_fallback(params, fallback), + ]} ) @@ -6888,7 +7254,7 @@ def km_3d_view_tool_edit_gpencil_extrude(params): "3D View Tool: Edit Gpencil, Extrude", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("gpencil.extrude_move", {"type": params.tool_tweak, "value": 'ANY'}, None), + ("gpencil.extrude_move", {"type": params.tool_tweak, "value": 'ANY', **params.tool_modifier}, None), ]}, ) @@ -6898,6 +7264,7 @@ def km_3d_view_tool_edit_gpencil_radius(params): "3D View Tool: Edit Gpencil, Radius", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ + # No need for `tool_modifier` since this takes all input. ("transform.transform", {"type": params.tool_tweak, "value": 'ANY'}, {"properties": [("mode", 'GPENCIL_SHRINKFATTEN'), ("release_confirm", True)]}), ]}, @@ -6909,6 +7276,7 @@ def km_3d_view_tool_edit_gpencil_bend(params): "3D View Tool: Edit Gpencil, Bend", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ + # No need for `tool_modifier` since this takes all input. ("transform.bend", {"type": params.tool_tweak, "value": 'ANY'}, {"properties": [("release_confirm", True)]}), ]}, @@ -6920,6 +7288,7 @@ def km_3d_view_tool_edit_gpencil_shear(params): "3D View Tool: Edit Gpencil, Shear", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ + # No need for `tool_modifier` since this takes all input. ("transform.shear", {"type": params.tool_tweak, "value": 'ANY'}, {"properties": [("release_confirm", True)]}), ]}, @@ -6931,6 +7300,7 @@ def km_3d_view_tool_edit_gpencil_to_sphere(params): "3D View Tool: Edit Gpencil, To Sphere", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ + # No need for `tool_modifier` since this takes all input. ("transform.tosphere", {"type": params.tool_tweak, "value": 'ANY'}, {"properties": [("release_confirm", True)]}), ]}, @@ -6942,6 +7312,7 @@ def km_3d_view_tool_edit_gpencil_transform_fill(params): "3D View Tool: Edit Gpencil, Transform Fill", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ + # No need for `tool_modifier` since this takes all input. ("gpencil.transform_fill", {"type": params.tool_tweak, "value": 'ANY'}, {"properties": [("release_confirm", True)]}), ]}, @@ -6994,9 +7365,10 @@ def km_3d_view_tool_sculpt_gpencil_select_lasso(params): ) -def km_sequencer_editor_tool_select(params): +def km_sequencer_editor_tool_select(params, *, fallback): return ( - "Sequencer Tool: Select", + # TODO, fall-back tool support. + _fallback_id("Sequencer Tool: Select", fallback), {"space_type": 'SEQUENCE_EDITOR', "region_type": 'WINDOW'}, {"items": [ ("sequencer.select", {"type": params.select_mouse, "value": 'PRESS'}, None), @@ -7005,9 +7377,10 @@ def km_sequencer_editor_tool_select(params): ) -def km_sequencer_editor_tool_select_box(params): +def km_sequencer_editor_tool_select_box(params, *, fallback): return ( - "Sequencer Tool: Select Box", + # TODO, fall-back tool support. + _fallback_id("Sequencer Tool: Select Box", fallback), {"space_type": 'SEQUENCE_EDITOR', "region_type": 'WINDOW'}, {"items": [ *_template_items_tool_select_actions_simple( @@ -7037,7 +7410,45 @@ def km_sequencer_editor_tool_blade(_params): {"space_type": 'SEQUENCE_EDITOR', "region_type": 'WINDOW'}, {"items": [ ("sequencer.split", {"type": 'LEFTMOUSE', "value": 'PRESS'}, - {"properties": [("type", 'SOFT'), ("side", 'NO_CHANGE'), ("use_cursor_position", True), ("ignore_selection", True)]}), + {"properties": [ + ("type", 'SOFT'), + ("side", 'NO_CHANGE'), + ("use_cursor_position", True), + ("ignore_selection", True), + ]}), + ]}, + ) + + +def km_sequencer_editor_tool_move(params): + return ( + "Sequencer Tool: Move", + {"space_type": 'SEQUENCE_EDITOR', "region_type": 'WINDOW'}, + {"items": [ + ("transform.translate", {"type": params.tool_tweak, "value": 'ANY'}, + {"properties": [("release_confirm", True)]}), + ]}, + ) + + +def km_sequencer_editor_tool_rotate(params): + return ( + "Sequencer Tool: Rotate", + {"space_type": 'SEQUENCE_EDITOR', "region_type": 'WINDOW'}, + {"items": [ + ("transform.rotate", {"type": params.tool_tweak, "value": 'ANY'}, + {"properties": [("release_confirm", True)]}), + ]}, + ) + + +def km_sequencer_editor_tool_scale(params): + return ( + "Sequencer Tool: Scale", + {"space_type": 'SEQUENCE_EDITOR', "region_type": 'WINDOW'}, + {"items": [ + ("transform.resize", {"type": params.tool_tweak, "value": 'ANY'}, + {"properties": [("release_confirm", True)]}), ]}, ) @@ -7187,25 +7598,25 @@ def generate_keymaps(params=None): km_image_editor_tool_generic_sample(params), km_image_editor_tool_uv_cursor(params), - km_image_editor_tool_uv_select(params), - km_image_editor_tool_uv_select_box(params), - km_image_editor_tool_uv_select_circle(params), - km_image_editor_tool_uv_select_lasso(params), + *(km_image_editor_tool_uv_select(params, fallback=fallback) for fallback in (False, True)), + *(km_image_editor_tool_uv_select_box(params, fallback=fallback) for fallback in (False, True)), + *(km_image_editor_tool_uv_select_circle(params, fallback=fallback) for fallback in (False, True)), + *(km_image_editor_tool_uv_select_lasso(params, fallback=fallback) for fallback in (False, True)), km_image_editor_tool_uv_rip_region(params), km_image_editor_tool_uv_sculpt_stroke(params), km_image_editor_tool_uv_move(params), km_image_editor_tool_uv_rotate(params), km_image_editor_tool_uv_scale(params), - km_node_editor_tool_select(params), - km_node_editor_tool_select_box(params), - km_node_editor_tool_select_lasso(params), - km_node_editor_tool_select_circle(params), + *(km_node_editor_tool_select(params, fallback=fallback) for fallback in (False, True)), + *(km_node_editor_tool_select_box(params, fallback=fallback) for fallback in (False, True)), + *(km_node_editor_tool_select_lasso(params, fallback=fallback) for fallback in (False, True)), + *(km_node_editor_tool_select_circle(params, fallback=fallback) for fallback in (False, True)), km_node_editor_tool_links_cut(params), km_3d_view_tool_cursor(params), - km_3d_view_tool_select(params), - km_3d_view_tool_select_box(params), - km_3d_view_tool_select_circle(params), - km_3d_view_tool_select_lasso(params), + *(km_3d_view_tool_select(params, fallback=fallback) for fallback in (False, True)), + *(km_3d_view_tool_select_box(params, fallback=fallback) for fallback in (False, True)), + *(km_3d_view_tool_select_circle(params, fallback=fallback) for fallback in (False, True)), + *(km_3d_view_tool_select_lasso(params, fallback=fallback) for fallback in (False, True)), km_3d_view_tool_transform(params), km_3d_view_tool_move(params), km_3d_view_tool_rotate(params), @@ -7276,10 +7687,10 @@ def generate_keymaps(params=None): km_3d_view_tool_paint_gpencil_cutter(params), km_3d_view_tool_paint_gpencil_eyedropper(params), km_3d_view_tool_paint_gpencil_interpolate(params), - km_3d_view_tool_edit_gpencil_select(params), - km_3d_view_tool_edit_gpencil_select_box(params), - km_3d_view_tool_edit_gpencil_select_circle(params), - km_3d_view_tool_edit_gpencil_select_lasso(params), + *(km_3d_view_tool_edit_gpencil_select(params, fallback=fallback) for fallback in (False, True)), + *(km_3d_view_tool_edit_gpencil_select_box(params, fallback=fallback) for fallback in (False, True)), + *(km_3d_view_tool_edit_gpencil_select_circle(params, fallback=fallback) for fallback in (False, True)), + *(km_3d_view_tool_edit_gpencil_select_lasso(params, fallback=fallback) for fallback in (False, True)), km_3d_view_tool_edit_gpencil_extrude(params), km_3d_view_tool_edit_gpencil_radius(params), km_3d_view_tool_edit_gpencil_bend(params), @@ -7291,10 +7702,13 @@ def generate_keymaps(params=None): km_3d_view_tool_sculpt_gpencil_select_box(params), km_3d_view_tool_sculpt_gpencil_select_circle(params), km_3d_view_tool_sculpt_gpencil_select_lasso(params), - km_sequencer_editor_tool_select(params), - km_sequencer_editor_tool_select_box(params), + *(km_sequencer_editor_tool_select(params, fallback=fallback) for fallback in (False, True)), + *(km_sequencer_editor_tool_select_box(params, fallback=fallback) for fallback in (False, True)), km_sequencer_editor_tool_blade(params), km_sequencer_editor_tool_generic_sample(params), + km_sequencer_editor_tool_scale(params), + km_sequencer_editor_tool_rotate(params), + km_sequencer_editor_tool_move(params), ] # ------------------------------------------------------------------------------ |