Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/presets/keyconfig/keymap_data/blender_default.py
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show All 20 Lines | |||||
| # Configurable Parameters | # Configurable Parameters | ||||
| class Params: | class Params: | ||||
| __slots__ = ( | __slots__ = ( | ||||
| "apple", | "apple", | ||||
| "legacy", | "legacy", | ||||
| "select_mouse", | "select_mouse", | ||||
| "select_mouse_value", | "select_mouse_value", | ||||
| # Convenience for: `'CLICK' if params.use_fallback_tool_rmb else params.select_mouse_value` | |||||
| "select_mouse_value_fallback", | |||||
| "select_tweak", | "select_tweak", | ||||
| "action_mouse", | "action_mouse", | ||||
| "action_tweak", | "action_tweak", | ||||
| "tool_mouse", | "tool_mouse", | ||||
| "tool_tweak", | "tool_tweak", | ||||
| "context_menu_event", | "context_menu_event", | ||||
| "cursor_set_event", | "cursor_set_event", | ||||
| "cursor_tweak_event", | "cursor_tweak_event", | ||||
| "use_mouse_emulate_3_button", | "use_mouse_emulate_3_button", | ||||
| # Experimental option. | # Experimental option. | ||||
| "pie_value", | "pie_value", | ||||
| # User preferences. | # User preferences. | ||||
| # | # | ||||
| # Swap 'Space/Shift-Space'. | # Swap 'Space/Shift-Space'. | ||||
| "spacebar_action", | "spacebar_action", | ||||
| # Key toggles selection with 'A'. | # Key toggles selection with 'A'. | ||||
| "use_select_all_toggle", | "use_select_all_toggle", | ||||
| # Activate gizmo on drag (which support it). | # Activate gizmo on drag (which support it). | ||||
| "use_gizmo_drag", | "use_gizmo_drag", | ||||
| # Use the fallback tool instead of tweak for RMB select. | |||||
| "use_fallback_tool", | |||||
| # This case needs to be checked often, move into it's own variable. | |||||
| "use_fallback_tool_rmb", | |||||
| # Use pie menu for tab by default (swap 'Tab/Ctrl-Tab'). | # Use pie menu for tab by default (swap 'Tab/Ctrl-Tab'). | ||||
| "use_v3d_tab_menu", | "use_v3d_tab_menu", | ||||
| # Use extended pie menu for shading. | # Use extended pie menu for shading. | ||||
| "use_v3d_shade_ex_pie", | "use_v3d_shade_ex_pie", | ||||
| # Swap orbit/pan keys (for 2D workflows). | # Swap orbit/pan keys (for 2D workflows). | ||||
| "use_v3d_mmb_pan", | "use_v3d_mmb_pan", | ||||
| # Alt click to access tools. | # Alt click to access tools. | ||||
| "use_alt_click_leader", | "use_alt_click_leader", | ||||
| Show All 10 Lines | def __init__( | ||||
| legacy=False, | legacy=False, | ||||
| select_mouse='RIGHT', | select_mouse='RIGHT', | ||||
| use_mouse_emulate_3_button=False, | use_mouse_emulate_3_button=False, | ||||
| # User preferences. | # User preferences. | ||||
| spacebar_action='TOOL', | spacebar_action='TOOL', | ||||
| use_select_all_toggle=False, | use_select_all_toggle=False, | ||||
| use_gizmo_drag=True, | use_gizmo_drag=True, | ||||
| use_fallback_tool=False, | |||||
| use_v3d_tab_menu=False, | use_v3d_tab_menu=False, | ||||
| use_v3d_shade_ex_pie=False, | use_v3d_shade_ex_pie=False, | ||||
| use_v3d_mmb_pan=False, | use_v3d_mmb_pan=False, | ||||
| use_alt_click_leader=False, | use_alt_click_leader=False, | ||||
| use_pie_click_drag=False, | use_pie_click_drag=False, | ||||
| v3d_tilde_action='VIEW', | v3d_tilde_action='VIEW', | ||||
| v3d_alt_mmb_drag_action='RELATIVE', | v3d_alt_mmb_drag_action='RELATIVE', | ||||
| ): | ): | ||||
| from sys import platform | from sys import platform | ||||
| self.apple = (platform == 'darwin') | self.apple = (platform == 'darwin') | ||||
| self.legacy = legacy | self.legacy = legacy | ||||
| if select_mouse == 'RIGHT': | if select_mouse == 'RIGHT': | ||||
| # Right mouse select. | # Right mouse select. | ||||
| self.select_mouse = 'RIGHTMOUSE' | self.select_mouse = 'RIGHTMOUSE' | ||||
| self.select_mouse_value = 'PRESS' | self.select_mouse_value = 'PRESS' | ||||
| self.select_tweak = 'EVT_TWEAK_R' | self.select_tweak = 'EVT_TWEAK_R' | ||||
| self.action_mouse = 'LEFTMOUSE' | self.action_mouse = 'LEFTMOUSE' | ||||
| self.action_tweak = 'EVT_TWEAK_L' | self.action_tweak = 'EVT_TWEAK_L' | ||||
| self.tool_mouse = 'LEFTMOUSE' | self.tool_mouse = 'LEFTMOUSE' | ||||
| self.tool_tweak = 'EVT_TWEAK_L' | self.tool_tweak = 'EVT_TWEAK_L' | ||||
| self.context_menu_event = {"type": 'W', "value": 'PRESS'} | self.context_menu_event = {"type": 'W', "value": 'PRESS'} | ||||
| self.cursor_set_event = {"type": 'LEFTMOUSE', "value": 'CLICK'} | self.cursor_set_event = {"type": 'LEFTMOUSE', "value": 'CLICK'} | ||||
| self.cursor_tweak_event = None | 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 | |||||
| else: | else: | ||||
| # Left mouse select uses Click event for selection. This is a little | # Left mouse select uses Click event for selection. This is a little | ||||
| # less immediate, but is needed to distinguish between click and tweak | # less immediate, but is needed to distinguish between click and tweak | ||||
| # events on the same mouse buttons. | # events on the same mouse buttons. | ||||
| self.select_mouse = 'LEFTMOUSE' | self.select_mouse = 'LEFTMOUSE' | ||||
| self.select_mouse_value = 'CLICK' | self.select_mouse_value = 'CLICK' | ||||
| self.select_tweak = 'EVT_TWEAK_L' | self.select_tweak = 'EVT_TWEAK_L' | ||||
| self.action_mouse = 'RIGHTMOUSE' | self.action_mouse = 'RIGHTMOUSE' | ||||
| self.action_tweak = 'EVT_TWEAK_R' | self.action_tweak = 'EVT_TWEAK_R' | ||||
| self.tool_mouse = 'LEFTMOUSE' | self.tool_mouse = 'LEFTMOUSE' | ||||
| self.tool_tweak = 'EVT_TWEAK_L' | self.tool_tweak = 'EVT_TWEAK_L' | ||||
| if self.legacy: | if self.legacy: | ||||
| self.context_menu_event = {"type": 'W', "value": 'PRESS'} | self.context_menu_event = {"type": 'W', "value": 'PRESS'} | ||||
| else: | else: | ||||
| self.context_menu_event = {"type": 'RIGHTMOUSE', "value": 'PRESS'} | self.context_menu_event = {"type": 'RIGHTMOUSE', "value": 'PRESS'} | ||||
| self.cursor_set_event = {"type": 'RIGHTMOUSE', "value": 'PRESS', "shift": True} | self.cursor_set_event = {"type": 'RIGHTMOUSE', "value": 'PRESS', "shift": True} | ||||
| self.cursor_tweak_event = {"type": 'EVT_TWEAK_R', "value": 'ANY', "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 | |||||
| self.use_mouse_emulate_3_button = use_mouse_emulate_3_button | self.use_mouse_emulate_3_button = use_mouse_emulate_3_button | ||||
| # User preferences | # User preferences | ||||
| self.spacebar_action = spacebar_action | self.spacebar_action = spacebar_action | ||||
| self.use_gizmo_drag = use_gizmo_drag | self.use_gizmo_drag = use_gizmo_drag | ||||
| self.use_select_all_toggle = use_select_all_toggle | self.use_select_all_toggle = use_select_all_toggle | ||||
| Show All 17 Lines | |||||
| # Physical layout. | # Physical layout. | ||||
| NUMBERS_1 = ('ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE', 'ZERO') | NUMBERS_1 = ('ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE', 'ZERO') | ||||
| # Numeric order. | # Numeric order. | ||||
| NUMBERS_0 = ('ZERO', 'ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE') | NUMBERS_0 = ('ZERO', 'ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE') | ||||
| # ------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------ | ||||
| # Generic Utilities | |||||
| def _fallback_id(text, fallback): | |||||
| if fallback: | |||||
| return text + " (fallback)" | |||||
| return text | |||||
| # ------------------------------------------------------------------------------ | |||||
| # Keymap Item Wrappers | # Keymap Item Wrappers | ||||
| def op_menu(menu, kmi_args): | def op_menu(menu, kmi_args): | ||||
| return ("wm.call_menu", kmi_args, {"properties": [("name", menu)]}) | return ("wm.call_menu", kmi_args, {"properties": [("name", menu)]}) | ||||
| def op_menu_pie(menu, kmi_args): | def op_menu_pie(menu, kmi_args): | ||||
| return ("wm.call_menu_pie", kmi_args, {"properties": [("name", menu)]}) | return ("wm.call_menu_pie", kmi_args, {"properties": [("name", menu)]}) | ||||
| ▲ Show 20 Lines • Show All 718 Lines • ▼ Show 20 Lines | keymap = ( | ||||
| "UV Editor", | "UV Editor", | ||||
| {"space_type": 'EMPTY', "region_type": 'WINDOW'}, | {"space_type": 'EMPTY', "region_type": 'WINDOW'}, | ||||
| {"items": items}, | {"items": items}, | ||||
| ) | ) | ||||
| items.extend([ | items.extend([ | ||||
| # Selection modes. | # Selection modes. | ||||
| *_template_items_uv_select_mode(params), | *_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.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, "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, "shift": True, "alt": True}, | ||||
| {"properties": [("extend", 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", | ||||
| ("uv.select_edge_ring", {"type": params.select_mouse, "value": params.select_mouse_value, "ctrl": True, "shift": True, "alt": True}, | {"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)]}), | {"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)]}), | {"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)]}), | {"properties": [("use_fill", True)]}), | ||||
| ("uv.select_split", {"type": 'Y', "value": 'PRESS'}, None), | ("uv.select_split", {"type": 'Y', "value": 'PRESS'}, None), | ||||
| ("uv.select_box", {"type": 'B', "value": 'PRESS'}, | ("uv.select_box", {"type": 'B', "value": 'PRESS'}, | ||||
| {"properties": [("pinned", False)]}), | {"properties": [("pinned", False)]}), | ||||
| ("uv.select_box", {"type": 'B', "value": 'PRESS', "ctrl": True}, | ("uv.select_box", {"type": 'B', "value": 'PRESS', "ctrl": True}, | ||||
| {"properties": [("pinned", True)]}), | {"properties": [("pinned", True)]}), | ||||
| ("uv.select_circle", {"type": 'C', "value": 'PRESS'}, None), | ("uv.select_circle", {"type": 'C', "value": 'PRESS'}, None), | ||||
| ("uv.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True}, | ("uv.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True}, | ||||
| ▲ Show 20 Lines • Show All 284 Lines • ▼ Show 20 Lines | items.extend([ | ||||
| {"properties": [("type", 'BOTTOM')]}), | {"properties": [("type", 'BOTTOM')]}), | ||||
| ("view3d.view_axis", {"type": 'NDOF_BUTTON_FRONT', "value": 'PRESS', "shift": True}, | ("view3d.view_axis", {"type": 'NDOF_BUTTON_FRONT', "value": 'PRESS', "shift": True}, | ||||
| {"properties": [("type", 'FRONT'), ("align_active", True)]}), | {"properties": [("type", 'FRONT'), ("align_active", True)]}), | ||||
| ("view3d.view_axis", {"type": 'NDOF_BUTTON_RIGHT', "value": 'PRESS', "shift": True}, | ("view3d.view_axis", {"type": 'NDOF_BUTTON_RIGHT', "value": 'PRESS', "shift": True}, | ||||
| {"properties": [("type", 'RIGHT'), ("align_active", True)]}), | {"properties": [("type", 'RIGHT'), ("align_active", True)]}), | ||||
| ("view3d.view_axis", {"type": 'NDOF_BUTTON_TOP', "value": 'PRESS', "shift": True}, | ("view3d.view_axis", {"type": 'NDOF_BUTTON_TOP', "value": 'PRESS', "shift": True}, | ||||
| {"properties": [("type", 'TOP'), ("align_active", True)]}), | {"properties": [("type", 'TOP'), ("align_active", True)]}), | ||||
| # Selection. | # Selection. | ||||
| *(( | *_template_view3d_select( | ||||
| "view3d.select", | type=params.select_mouse, | ||||
| {"type": params.select_mouse, "value": params.select_mouse_value, **{m: True for m in mods}}, | value=('CLICK' if params.use_fallback_tool_rmb else params.select_mouse_value), | ||||
| {"properties": [(c, True) for c in props]}, | legacy=params.legacy, | ||||
| ) 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), | ("view3d.select_box", {"type": 'B', "value": 'PRESS'}, None), | ||||
| ("view3d.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True}, | ("view3d.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True}, | ||||
| {"properties": [("mode", 'ADD')]}), | {"properties": [("mode", 'ADD')]}), | ||||
| ("view3d.select_lasso", {"type": params.action_tweak, "value": 'ANY', "shift": True, "ctrl": True}, | ("view3d.select_lasso", {"type": params.action_tweak, "value": 'ANY', "shift": True, "ctrl": True}, | ||||
| {"properties": [("mode", 'SUB')]}), | {"properties": [("mode", 'SUB')]}), | ||||
| ("view3d.select_circle", {"type": 'C', "value": 'PRESS'}, None), | ("view3d.select_circle", {"type": 'C', "value": 'PRESS'}, None), | ||||
| # Borders. | # Borders. | ||||
| ("view3d.clip_border", {"type": 'B', "value": 'PRESS', "alt": True}, None), | ("view3d.clip_border", {"type": 'B', "value": 'PRESS', "alt": True}, None), | ||||
| ▲ Show 20 Lines • Show All 1,977 Lines • ▼ Show 20 Lines | items.extend([ | ||||
| # Erase | # Erase | ||||
| ("gpencil.annotate", {"type": 'RIGHTMOUSE', "value": 'PRESS', "key_modifier": 'D'}, | ("gpencil.annotate", {"type": 'RIGHTMOUSE', "value": 'PRESS', "key_modifier": 'D'}, | ||||
| {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}), | {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}), | ||||
| ]) | ]) | ||||
| return keymap | return keymap | ||||
| def _grease_pencil_selection(params): | def _grease_pencil_selection(params, use_select_mouse=True): | ||||
| return [ | return [ | ||||
| # Select all | # Select all | ||||
| *_template_items_select_actions(params, "gpencil.select_all"), | *_template_items_select_actions(params, "gpencil.select_all"), | ||||
| # Circle select | # Circle select | ||||
| ("gpencil.select_circle", {"type": 'C', "value": 'PRESS'}, None), | ("gpencil.select_circle", {"type": 'C', "value": 'PRESS'}, None), | ||||
| # Box select | # Box select | ||||
| ("gpencil.select_box", {"type": 'B', "value": 'PRESS'}, None), | ("gpencil.select_box", {"type": 'B', "value": 'PRESS'}, None), | ||||
| # Lasso select | # Lasso select | ||||
| ("gpencil.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True}, | ("gpencil.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True}, | ||||
| {"properties": [("mode", 'ADD')]}), | {"properties": [("mode", 'ADD')]}), | ||||
| ("gpencil.select_lasso", {"type": params.action_tweak, "value": 'ANY', "shift": True, "ctrl": True}, | ("gpencil.select_lasso", {"type": params.action_tweak, "value": 'ANY', "shift": True, "ctrl": True}, | ||||
| {"properties": [("mode", 'SUB')]}), | {"properties": [("mode", 'SUB')]}), | ||||
| # In the Node Editor, lasso select needs ALT modifier too | # In the Node Editor, lasso select needs ALT modifier too | ||||
| # (as somehow CTRL+LMB drag gets taken for "cut" quite early). | # (as somehow CTRL+LMB drag gets taken for "cut" quite early). | ||||
| # There probably isn't too much harm adding this for other editors too | # 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 | # as part of standard GP editing keymap. This hotkey combo doesn't seem | ||||
| # to see much use under standard scenarios? | # 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')]}), | {"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')]}), | {"properties": [("mode", 'SUB')]}), | ||||
| ("gpencil.select", {"type": params.select_mouse, "value": params.select_mouse_value, "shift": True}, | *_template_view3d_gpencil_select( | ||||
| {"properties": [("extend", True), ("toggle", True)]}), | type=params.select_mouse, | ||||
| # Whole stroke select | value=params.select_mouse_value_fallback, | ||||
| ("gpencil.select", {"type": params.select_mouse, "value": params.select_mouse_value, "alt": True}, | legacy=params.legacy, | ||||
| {"properties": [("entire_strokes", True)]}), | use_select_mouse=use_select_mouse, | ||||
| ("gpencil.select", {"type": params.select_mouse, "value": params.select_mouse_value, "shift": True, "alt": True}, | ), | ||||
| {"properties": [("extend", True), ("entire_strokes", True)]}), | |||||
| # Select linked | # Select linked | ||||
| ("gpencil.select_linked", {"type": 'L', "value": 'PRESS'}, None), | ("gpencil.select_linked", {"type": 'L', "value": 'PRESS'}, None), | ||||
| ("gpencil.select_linked", {"type": 'L', "value": 'PRESS', "ctrl": True}, None), | ("gpencil.select_linked", {"type": 'L', "value": 'PRESS', "ctrl": True}, None), | ||||
| # Select alternate | # Select alternate | ||||
| ("gpencil.select_alternate", {"type": 'L', "value": 'PRESS', "shift": True}, None), | ("gpencil.select_alternate", {"type": 'L', "value": 'PRESS', "shift": True}, None), | ||||
| # Select grouped | # Select grouped | ||||
| ("gpencil.select_grouped", {"type": 'G', "value": 'PRESS', "shift": True}, None), | ("gpencil.select_grouped", {"type": 'G', "value": 'PRESS', "shift": True}, None), | ||||
| # Select more/less | # Select more/less | ||||
| Show All 18 Lines | keymap = ( | ||||
| {"space_type": 'EMPTY', "region_type": 'WINDOW'}, | {"space_type": 'EMPTY', "region_type": 'WINDOW'}, | ||||
| {"items": items}, | {"items": items}, | ||||
| ) | ) | ||||
| items.extend([ | items.extend([ | ||||
| # Interpolation | # Interpolation | ||||
| ("gpencil.interpolate", {"type": 'E', "value": 'PRESS', "ctrl": True}, None), | ("gpencil.interpolate", {"type": 'E', "value": 'PRESS', "ctrl": True}, None), | ||||
| ("gpencil.interpolate_sequence", {"type": 'E', "value": 'PRESS', "shift": True, "ctrl": True}, None), | ("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 | # Selection | ||||
| *_grease_pencil_selection(params), | *_grease_pencil_selection(params), | ||||
| # Duplicate and move selected points | # Duplicate and move selected points | ||||
| ("gpencil.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None), | ("gpencil.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None), | ||||
| # Extrude and move selected points | # Extrude and move selected points | ||||
| ("gpencil.extrude_move", {"type": 'E', "value": 'PRESS'}, None), | ("gpencil.extrude_move", {"type": 'E', "value": 'PRESS'}, None), | ||||
| # Delete | # Delete | ||||
| op_menu("VIEW3D_MT_edit_gpencil_delete", {"type": 'X', "value": 'PRESS'}), | op_menu("VIEW3D_MT_edit_gpencil_delete", {"type": 'X', "value": 'PRESS'}), | ||||
| ▲ Show 20 Lines • Show All 275 Lines • ▼ Show 20 Lines | def km_grease_pencil_stroke_sculpt_mode(params): | ||||
| keymap = ( | keymap = ( | ||||
| "Grease Pencil Stroke Sculpt Mode", | "Grease Pencil Stroke Sculpt Mode", | ||||
| {"space_type": 'EMPTY', "region_type": 'WINDOW'}, | {"space_type": 'EMPTY', "region_type": 'WINDOW'}, | ||||
| {"items": items} | {"items": items} | ||||
| ) | ) | ||||
| items.extend([ | items.extend([ | ||||
| # Selection | # Selection | ||||
| *_grease_pencil_selection(params), | *_grease_pencil_selection(params, use_select_mouse=False), | ||||
| # Brush strength | # Brush strength | ||||
| ("wm.radial_control", {"type": 'F', "value": 'PRESS', "shift": True}, | ("wm.radial_control", {"type": 'F', "value": 'PRESS', "shift": True}, | ||||
| {"properties": [("data_path_primary", 'tool_settings.gpencil_sculpt_paint.brush.strength')]}), | {"properties": [("data_path_primary", 'tool_settings.gpencil_sculpt_paint.brush.strength')]}), | ||||
| # Brush size | # Brush size | ||||
| ("wm.radial_control", {"type": 'F', "value": 'PRESS'}, | ("wm.radial_control", {"type": 'F', "value": 'PRESS'}, | ||||
| {"properties": [("data_path_primary", 'tool_settings.gpencil_sculpt_paint.brush.size')]}), | {"properties": [("data_path_primary", 'tool_settings.gpencil_sculpt_paint.brush.size')]}), | ||||
| # Increase/Decrease brush size | # Increase/Decrease brush size | ||||
| ▲ Show 20 Lines • Show All 269 Lines • ▼ Show 20 Lines | def km_grease_pencil_stroke_vertex_mode(params): | ||||
| keymap = ( | keymap = ( | ||||
| "Grease Pencil Stroke Vertex Mode", | "Grease Pencil Stroke Vertex Mode", | ||||
| {"space_type": 'EMPTY', "region_type": 'WINDOW'}, | {"space_type": 'EMPTY', "region_type": 'WINDOW'}, | ||||
| {"items": items}, | {"items": items}, | ||||
| ) | ) | ||||
| items.extend([ | items.extend([ | ||||
| # Selection | # Selection | ||||
| *_grease_pencil_selection(params), | *_grease_pencil_selection(params, use_select_mouse=False), | ||||
| # Brush strength | # Brush strength | ||||
| ("wm.radial_control", {"type": 'F', "value": 'PRESS', "shift": True}, | ("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 | # Brush size | ||||
| ("wm.radial_control", {"type": 'F', "value": 'PRESS'}, | ("wm.radial_control", {"type": 'F', "value": 'PRESS'}, | ||||
| {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.size')]}), | {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.size')]}), | ||||
| # Increase/Decrease brush size | # Increase/Decrease brush size | ||||
| ("brush.scale_size", {"type": 'LEFT_BRACKET', "value": 'PRESS', "repeat": True}, | ("brush.scale_size", {"type": 'LEFT_BRACKET', "value": 'PRESS', "repeat": True}, | ||||
| ▲ Show 20 Lines • Show All 404 Lines • ▼ Show 20 Lines | items.extend([ | ||||
| ("curve.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None), | ("curve.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None), | ||||
| ("curve.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None), | ("curve.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None), | ||||
| ("curve.select_linked", {"type": 'L', "value": 'PRESS', "ctrl": True}, None), | ("curve.select_linked", {"type": 'L', "value": 'PRESS', "ctrl": True}, None), | ||||
| ("curve.select_similar", {"type": 'G', "value": 'PRESS', "shift": True}, None), | ("curve.select_similar", {"type": 'G', "value": 'PRESS', "shift": True}, None), | ||||
| ("curve.select_linked_pick", {"type": 'L', "value": 'PRESS'}, | ("curve.select_linked_pick", {"type": 'L', "value": 'PRESS'}, | ||||
| {"properties": [("deselect", False)]}), | {"properties": [("deselect", False)]}), | ||||
| ("curve.select_linked_pick", {"type": 'L', "value": 'PRESS', "shift": True}, | ("curve.select_linked_pick", {"type": 'L', "value": 'PRESS', "shift": True}, | ||||
| {"properties": [("deselect", 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.separate", {"type": 'P', "value": 'PRESS'}, None), | ||||
| ("curve.split", {"type": 'Y', "value": 'PRESS'}, None), | ("curve.split", {"type": 'Y', "value": 'PRESS'}, None), | ||||
| ("curve.extrude_move", {"type": 'E', "value": 'PRESS'}, None), | ("curve.extrude_move", {"type": 'E', "value": 'PRESS'}, None), | ||||
| ("curve.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None), | ("curve.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None), | ||||
| ("curve.make_segment", {"type": 'F', "value": 'PRESS'}, None), | ("curve.make_segment", {"type": 'F', "value": 'PRESS'}, None), | ||||
| ("curve.cyclic_toggle", {"type": 'C', "value": 'PRESS', "alt": True}, None), | ("curve.cyclic_toggle", {"type": 'C', "value": 'PRESS', "alt": True}, None), | ||||
| op_menu("VIEW3D_MT_edit_curve_delete", {"type": 'X', "value": 'PRESS'}), | op_menu("VIEW3D_MT_edit_curve_delete", {"type": 'X', "value": 'PRESS'}), | ||||
| op_menu("VIEW3D_MT_edit_curve_delete", {"type": 'DEL', "value": 'PRESS'}), | op_menu("VIEW3D_MT_edit_curve_delete", {"type": 'DEL', "value": 'PRESS'}), | ||||
| ▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | if secondary_rotation: | ||||
| items.extend([ | items.extend([ | ||||
| ("wm.radial_control", {"type": 'F', "value": 'PRESS', "ctrl": True, "alt": True}, | ("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 | 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): | def km_image_paint(params): | ||||
| items = [] | items = [] | ||||
| keymap = ( | keymap = ( | ||||
| "Image Paint", | "Image Paint", | ||||
| {"space_type": 'EMPTY', "region_type": 'WINDOW'}, | {"space_type": 'EMPTY', "region_type": 'WINDOW'}, | ||||
| {"items": items}, | {"items": items}, | ||||
| ) | ) | ||||
| ▲ Show 20 Lines • Show All 287 Lines • ▼ Show 20 Lines | items.extend([ | ||||
| # Loop Select with alt. Double click in case MMB emulation is on (below). | # 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, "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, "shift": True, "alt": True}, | ||||
| {"properties": [("toggle", True)]}), | {"properties": [("toggle", True)]}), | ||||
| # Selection | # 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, "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, "shift": True, "ctrl": True, "alt": True}, | ||||
| {"properties": [("toggle", 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)]}), | {"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)]}), | {"properties": [("use_fill", True)]}), | ||||
| *_template_items_select_actions(params, "mesh.select_all"), | *_template_items_select_actions(params, "mesh.select_all"), | ||||
| ("mesh.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None), | ("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_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_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_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", {"type": 'L', "value": 'PRESS', "ctrl": True}, None), | ||||
| ("mesh.select_linked_pick", {"type": 'L', "value": 'PRESS'}, | ("mesh.select_linked_pick", {"type": 'L', "value": 'PRESS'}, | ||||
| ▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | items.extend([ | ||||
| ("armature.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None), | ("armature.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None), | ||||
| ("armature.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None), | ("armature.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None), | ||||
| ("armature.select_similar", {"type": 'G', "value": 'PRESS', "shift": True}, None), | ("armature.select_similar", {"type": 'G', "value": 'PRESS', "shift": True}, None), | ||||
| ("armature.select_linked_pick", {"type": 'L', "value": 'PRESS'}, | ("armature.select_linked_pick", {"type": 'L', "value": 'PRESS'}, | ||||
| {"properties": [("deselect", False)]}), | {"properties": [("deselect", False)]}), | ||||
| ("armature.select_linked_pick", {"type": 'L', "value": 'PRESS', "shift": True}, | ("armature.select_linked_pick", {"type": 'L', "value": 'PRESS', "shift": True}, | ||||
| {"properties": [("deselect", True)]}), | {"properties": [("deselect", True)]}), | ||||
| ("armature.select_linked", {"type": 'L', "value": 'PRESS', "ctrl": True}, None), | ("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. | # Editing. | ||||
| op_menu("VIEW3D_MT_edit_armature_delete", {"type": 'X', "value": 'PRESS'}), | op_menu("VIEW3D_MT_edit_armature_delete", {"type": 'X', "value": 'PRESS'}), | ||||
| op_menu("VIEW3D_MT_edit_armature_delete", {"type": 'DEL', "value": 'PRESS'}), | op_menu("VIEW3D_MT_edit_armature_delete", {"type": 'DEL', "value": 'PRESS'}), | ||||
| ("armature.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None), | ("armature.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None), | ||||
| ("armature.dissolve", {"type": 'X', "value": 'PRESS', "ctrl": True}, None), | ("armature.dissolve", {"type": 'X', "value": 'PRESS', "ctrl": True}, None), | ||||
| ("armature.dissolve", {"type": 'DEL', "value": 'PRESS', "ctrl": True}, None), | ("armature.dissolve", {"type": 'DEL', "value": 'PRESS', "ctrl": True}, None), | ||||
| ("armature.extrude_move", {"type": 'E', "value": 'PRESS'}, None), | ("armature.extrude_move", {"type": 'E', "value": 'PRESS'}, None), | ||||
| ("armature.extrude_forked", {"type": 'E', "value": 'PRESS', "shift": True}, None), | ("armature.extrude_forked", {"type": 'E', "value": 'PRESS', "shift": True}, None), | ||||
| ▲ Show 20 Lines • Show All 1,007 Lines • ▼ Show 20 Lines | return ( | ||||
| {"items": [ | {"items": [ | ||||
| ("uv.cursor_set", {"type": params.tool_mouse, "value": 'PRESS'}, None), | ("uv.cursor_set", {"type": params.tool_mouse, "value": 'PRESS'}, None), | ||||
| ("transform.translate", {"type": params.tool_tweak, "value": 'ANY'}, | ("transform.translate", {"type": params.tool_tweak, "value": 'ANY'}, | ||||
| {"properties": [("release_confirm", True), ("cursor_transform", True)]}), | {"properties": [("release_confirm", True), ("cursor_transform", True)]}), | ||||
| ]}, | ]}, | ||||
| ) | ) | ||||
| def km_image_editor_tool_uv_select(params): | def km_image_editor_tool_uv_select(params, *, fallback): | ||||
| return ( | return ( | ||||
| "Image Editor Tool: Uv, Tweak", | _fallback_id("Image Editor Tool: Uv, Tweak", fallback), | ||||
| {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, | {"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 ( | return ( | ||||
| "Image Editor Tool: Uv, Select Box", | _fallback_id("Image Editor Tool: Uv, Select Box", fallback), | ||||
| {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, | {"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 ( | return ( | ||||
| "Image Editor Tool: Uv, Select Circle", | _fallback_id("Image Editor Tool: Uv, Select Circle", fallback), | ||||
| {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, | {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, | ||||
| {"items": _template_items_tool_select_actions_simple( | {"items": [ | ||||
| "uv.select_circle", type=params.tool_mouse, value='PRESS', | *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions_simple( | ||||
| properties=[("wait_for_input", False)], | "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 ( | return ( | ||||
| "Image Editor Tool: Uv, Select Lasso", | _fallback_id("Image Editor Tool: Uv, Select Lasso", fallback), | ||||
| {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, | {"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), | |||||
| ]}, | |||||
| ) | ) | ||||
| def km_image_editor_tool_uv_rip_region(params): | def km_image_editor_tool_uv_rip_region(params): | ||||
| return ( | return ( | ||||
| "Image Editor Tool: Uv, Rip Region", | "Image Editor Tool: Uv, Rip Region", | ||||
| {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, | {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, | ||||
| {"items": [ | {"items": [ | ||||
| ▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | return ( | ||||
| {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, | {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, | ||||
| {"items": [ | {"items": [ | ||||
| ("transform.resize", {"type": params.tool_tweak, "value": 'ANY'}, | ("transform.resize", {"type": params.tool_tweak, "value": 'ANY'}, | ||||
| {"properties": [("release_confirm", True)]}), | {"properties": [("release_confirm", True)]}), | ||||
| ]}, | ]}, | ||||
| ) | ) | ||||
| def km_node_editor_tool_select(params): | def km_node_editor_tool_select(params, *, fallback): | ||||
| return ( | return ( | ||||
| "Node Tool: Tweak", | _fallback_id("Node Tool: Tweak", fallback), | ||||
| {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, | {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, | ||||
| {"items": [ | {"items": [ | ||||
| *([] if fallback else [ | |||||
| ("node.select", {"type": params.select_mouse, "value": 'PRESS'}, | ("node.select", {"type": params.select_mouse, "value": 'PRESS'}, | ||||
| {"properties": [("deselect_all", not params.legacy)]}), | {"properties": [("deselect_all", not params.legacy)]}), | ||||
| ]), | |||||
| ]}, | ]}, | ||||
| ) | ) | ||||
| def km_node_editor_tool_select_box(params): | def km_node_editor_tool_select_box(params, *, fallback): | ||||
| return ( | return ( | ||||
| "Node Tool: Select Box", | _fallback_id("Node Tool: Select Box", fallback), | ||||
| {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, | {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, | ||||
| {"items": _template_items_tool_select_actions_simple( | {"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', | "node.select_box", type=params.tool_tweak, value='ANY', | ||||
| properties=[("tweak", True)], | properties=[("tweak", True)], | ||||
| )}, | )), | ||||
| ]}, | |||||
| ) | ) | ||||
| def km_node_editor_tool_select_lasso(params): | def km_node_editor_tool_select_lasso(params, *, fallback): | ||||
| return ( | return ( | ||||
| "Node Tool: Select Lasso", | _fallback_id("Node Tool: Select Lasso", fallback), | ||||
| {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, | {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, | ||||
| {"items": _template_items_tool_select_actions_simple( | {"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', | "node.select_lasso", type=params.tool_mouse, value='PRESS', | ||||
| properties=[("tweak", True)], | properties=[("tweak", True)])) | ||||
| )}, | ]}, | ||||
| ) | ) | ||||
| def km_node_editor_tool_select_circle(params): | def km_node_editor_tool_select_circle(params, *, fallback): | ||||
| return ( | return ( | ||||
| "Node Tool: Select Circle", | _fallback_id("Node Tool: Select Circle", fallback), | ||||
| {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, | {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, | ||||
| {"items": _template_items_tool_select_actions_simple( | {"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', | "node.select_circle", type=params.tool_mouse, value='PRESS', | ||||
| properties=[("wait_for_input", False)], | properties=[("wait_for_input", False)])), | ||||
| )}, | ]}, | ||||
| ) | ) | ||||
| def km_node_editor_tool_links_cut(params): | def km_node_editor_tool_links_cut(params): | ||||
| return ( | return ( | ||||
| "Node Tool: Links Cut", | "Node Tool: Links Cut", | ||||
| {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, | {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, | ||||
| {"items": [ | {"items": [ | ||||
| Show All 9 Lines | return ( | ||||
| {"items": [ | {"items": [ | ||||
| ("view3d.cursor3d", {"type": params.tool_mouse, "value": 'PRESS'}, None), | ("view3d.cursor3d", {"type": params.tool_mouse, "value": 'PRESS'}, None), | ||||
| ("transform.translate", {"type": params.tool_tweak, "value": 'ANY'}, | ("transform.translate", {"type": params.tool_tweak, "value": 'ANY'}, | ||||
| {"properties": [("release_confirm", True), ("cursor_transform", True)]}), | {"properties": [("release_confirm", True), ("cursor_transform", True)]}), | ||||
| ]}, | ]}, | ||||
| ) | ) | ||||
| def km_3d_view_tool_select(params): | def km_3d_view_tool_select(params, *, fallback): | ||||
| return ( | return ( | ||||
| "3D View Tool: Tweak", | _fallback_id("3D View Tool: Tweak", fallback), | ||||
| {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, | {"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 ( | return ( | ||||
| "3D View Tool: Select Box", | _fallback_id("3D View Tool: Select Box", fallback), | ||||
| {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, | {"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 ( | return ( | ||||
| "3D View Tool: Select Circle", | _fallback_id("3D View Tool: Select Circle", fallback), | ||||
| {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, | {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, | ||||
| {"items": _template_items_tool_select_actions_simple( | {"items": [ | ||||
| "view3d.select_circle", type=params.tool_mouse, value='PRESS', | *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions_simple( | ||||
| properties=[("wait_for_input", False)], | "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 ( | return ( | ||||
| "3D View Tool: Select Lasso", | _fallback_id("3D View Tool: Select Lasso", fallback), | ||||
| {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, | {"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), | |||||
| ]} | |||||
| ) | ) | ||||
| def km_3d_view_tool_transform(params): | def km_3d_view_tool_transform(params): | ||||
| return ( | return ( | ||||
| "3D View Tool: Transform", | "3D View Tool: Transform", | ||||
| {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, | {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, | ||||
| {"items": [ | {"items": [ | ||||
| ▲ Show 20 Lines • Show All 808 Lines • ▼ Show 20 Lines | return ( | ||||
| "3D View Tool: Paint Gpencil, Interpolate", | "3D View Tool: Paint Gpencil, Interpolate", | ||||
| {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, | {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, | ||||
| {"items": [ | {"items": [ | ||||
| ("gpencil.interpolate", {"type": params.tool_tweak, "value": 'ANY'}, | ("gpencil.interpolate", {"type": params.tool_tweak, "value": 'ANY'}, | ||||
| {"properties": [("release_confirm", True)]}), | {"properties": [("release_confirm", True)]}), | ||||
| ]}, | ]}, | ||||
| ) | ) | ||||
| def km_3d_view_tool_edit_gpencil_select(params): | def km_3d_view_tool_edit_gpencil_select(params, *, fallback): | ||||
| return ( | return ( | ||||
| "3D View Tool: Edit Gpencil, Tweak", | _fallback_id("3D View Tool: Edit Gpencil, Tweak", fallback), | ||||
| {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, | {"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, *, fallback): | |||||
| def km_3d_view_tool_edit_gpencil_select_box(params): | |||||
| return ( | 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'}, | {"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, *, fallback): | |||||
| def km_3d_view_tool_edit_gpencil_select_circle(params): | |||||
| return ( | 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'}, | {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, | ||||
| {"items": _template_items_tool_select_actions_simple( | {"items": [ | ||||
| "gpencil.select_circle", type=params.tool_mouse, value='PRESS', | *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions_simple( | ||||
| properties=[("wait_for_input", False)], | "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 ( | 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'}, | {"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), | |||||
| ]} | |||||
| ) | ) | ||||
| def km_3d_view_tool_edit_gpencil_extrude(params): | def km_3d_view_tool_edit_gpencil_extrude(params): | ||||
| return ( | return ( | ||||
| "3D View Tool: Edit Gpencil, Extrude", | "3D View Tool: Edit Gpencil, Extrude", | ||||
| {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, | {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, | ||||
| {"items": [ | {"items": [ | ||||
| ▲ Show 20 Lines • Show All 291 Lines • ▼ Show 20 Lines | return [ | ||||
| # Tool System. | # Tool System. | ||||
| km_generic_tool_annotate(params), | km_generic_tool_annotate(params), | ||||
| km_generic_tool_annotate_line(params), | km_generic_tool_annotate_line(params), | ||||
| km_generic_tool_annotate_polygon(params), | km_generic_tool_annotate_polygon(params), | ||||
| km_generic_tool_annotate_eraser(params), | km_generic_tool_annotate_eraser(params), | ||||
| km_image_editor_tool_generic_sample(params), | km_image_editor_tool_generic_sample(params), | ||||
| km_image_editor_tool_uv_cursor(params), | km_image_editor_tool_uv_cursor(params), | ||||
| km_image_editor_tool_uv_select(params), | *(km_image_editor_tool_uv_select(params, fallback=fallback) for fallback in (False, True)), | ||||
| km_image_editor_tool_uv_select_box(params), | *(km_image_editor_tool_uv_select_box(params, fallback=fallback) for fallback in (False, True)), | ||||
| km_image_editor_tool_uv_select_circle(params), | *(km_image_editor_tool_uv_select_circle(params, fallback=fallback) for fallback in (False, True)), | ||||
| km_image_editor_tool_uv_select_lasso(params), | *(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_rip_region(params), | ||||
| km_image_editor_tool_uv_sculpt_stroke(params), | km_image_editor_tool_uv_sculpt_stroke(params), | ||||
| km_image_editor_tool_uv_move(params), | km_image_editor_tool_uv_move(params), | ||||
| km_image_editor_tool_uv_rotate(params), | km_image_editor_tool_uv_rotate(params), | ||||
| km_image_editor_tool_uv_scale(params), | km_image_editor_tool_uv_scale(params), | ||||
| km_node_editor_tool_select(params), | *(km_node_editor_tool_select(params, fallback=fallback) for fallback in (False, True)), | ||||
| km_node_editor_tool_select_box(params), | *(km_node_editor_tool_select_box(params, fallback=fallback) for fallback in (False, True)), | ||||
| km_node_editor_tool_select_lasso(params), | *(km_node_editor_tool_select_lasso(params, fallback=fallback) for fallback in (False, True)), | ||||
| km_node_editor_tool_select_circle(params), | *(km_node_editor_tool_select_circle(params, fallback=fallback) for fallback in (False, True)), | ||||
| km_node_editor_tool_links_cut(params), | km_node_editor_tool_links_cut(params), | ||||
| km_3d_view_tool_cursor(params), | km_3d_view_tool_cursor(params), | ||||
| km_3d_view_tool_select(params), | *(km_3d_view_tool_select(params, fallback=fallback) for fallback in (False, True)), | ||||
| km_3d_view_tool_select_box(params), | *(km_3d_view_tool_select_box(params, fallback=fallback) for fallback in (False, True)), | ||||
| km_3d_view_tool_select_circle(params), | *(km_3d_view_tool_select_circle(params, fallback=fallback) for fallback in (False, True)), | ||||
| km_3d_view_tool_select_lasso(params), | *(km_3d_view_tool_select_lasso(params, fallback=fallback) for fallback in (False, True)), | ||||
| km_3d_view_tool_transform(params), | km_3d_view_tool_transform(params), | ||||
| km_3d_view_tool_move(params), | km_3d_view_tool_move(params), | ||||
| km_3d_view_tool_rotate(params), | km_3d_view_tool_rotate(params), | ||||
| km_3d_view_tool_scale(params), | km_3d_view_tool_scale(params), | ||||
| km_3d_view_tool_shear(params), | km_3d_view_tool_shear(params), | ||||
| km_3d_view_tool_measure(params), | km_3d_view_tool_measure(params), | ||||
| km_3d_view_tool_interactive_add(params), | km_3d_view_tool_interactive_add(params), | ||||
| km_3d_view_tool_pose_breakdowner(params), | km_3d_view_tool_pose_breakdowner(params), | ||||
| ▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | return [ | ||||
| km_3d_view_tool_paint_gpencil_polyline(params), | km_3d_view_tool_paint_gpencil_polyline(params), | ||||
| km_3d_view_tool_paint_gpencil_box(params), | km_3d_view_tool_paint_gpencil_box(params), | ||||
| km_3d_view_tool_paint_gpencil_circle(params), | km_3d_view_tool_paint_gpencil_circle(params), | ||||
| km_3d_view_tool_paint_gpencil_arc(params), | km_3d_view_tool_paint_gpencil_arc(params), | ||||
| km_3d_view_tool_paint_gpencil_curve(params), | km_3d_view_tool_paint_gpencil_curve(params), | ||||
| km_3d_view_tool_paint_gpencil_cutter(params), | km_3d_view_tool_paint_gpencil_cutter(params), | ||||
| km_3d_view_tool_paint_gpencil_eyedropper(params), | km_3d_view_tool_paint_gpencil_eyedropper(params), | ||||
| km_3d_view_tool_paint_gpencil_interpolate(params), | km_3d_view_tool_paint_gpencil_interpolate(params), | ||||
| km_3d_view_tool_edit_gpencil_select(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), | *(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), | *(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), | *(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_extrude(params), | ||||
| km_3d_view_tool_edit_gpencil_radius(params), | km_3d_view_tool_edit_gpencil_radius(params), | ||||
| km_3d_view_tool_edit_gpencil_bend(params), | km_3d_view_tool_edit_gpencil_bend(params), | ||||
| km_3d_view_tool_edit_gpencil_shear(params), | km_3d_view_tool_edit_gpencil_shear(params), | ||||
| km_3d_view_tool_edit_gpencil_to_sphere(params), | km_3d_view_tool_edit_gpencil_to_sphere(params), | ||||
| km_3d_view_tool_edit_gpencil_transform_fill(params), | km_3d_view_tool_edit_gpencil_transform_fill(params), | ||||
| km_3d_view_tool_edit_gpencil_interpolate(params), | km_3d_view_tool_edit_gpencil_interpolate(params), | ||||
| km_3d_view_tool_sculpt_gpencil_select(params), | km_3d_view_tool_sculpt_gpencil_select(params), | ||||
| Show All 38 Lines | |||||