diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-11-27 09:33:52 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-11-27 09:52:15 +0300 |
commit | 1f8360171cd80c0c1918486703926709cb5db7aa (patch) | |
tree | 25ce56039ec95d156c4eaddc4134d639f3b900c3 /release/scripts/presets/keyconfig/keymap_data/blender_default.py | |
parent | a58f0eea4f1e9b04e519e123eb656009cf718f9e (diff) |
Keymap: share annotation tool keymaps between spaces
Not sharing caused duplication in the keymap and
required a factory class generator.
Simplify tool & keymap definitions by sharing them.
It's highly unlikely we will ever want these to use different keys
once they're set as the active tool.
Diffstat (limited to 'release/scripts/presets/keyconfig/keymap_data/blender_default.py')
-rw-r--r-- | release/scripts/presets/keyconfig/keymap_data/blender_default.py | 173 |
1 files changed, 61 insertions, 112 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 03f9fadadea..6b8e459d16b 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -4943,6 +4943,62 @@ def km_popup_toolbar(params): # # Named are auto-generated based on the tool name and it's toolbar. + +def km_generic_tool_annotate(params): + return ( + "Generic Tool: Annotate", + {"region_type": 'WINDOW'}, + {"items": ( + ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS'}, + {"properties": [("mode", 'DRAW'), ("wait_for_input", False)]}), + ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS', "alt": True}, + {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}), + ), + }, + ) + + +def km_generic_tool_annotate_line(params): + return ( + "Generic Tool: Annotate Line", + {"region_type": 'WINDOW'}, + {"items": ( + ("gpencil.annotate", {"type": params.tool_tweak, "value": 'ANY'}, + {"properties": [("mode", 'DRAW_STRAIGHT'), ("wait_for_input", False)]}), + ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS', "alt": True}, + {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}), + ), + }, + ) + + +def km_generic_tool_annotate_polygon(params): + return ( + "Generic Tool: Annotate Polygon", + {"region_type": 'WINDOW'}, + {"items": ( + ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS'}, + {"properties": [("mode", 'DRAW_POLY'), ("wait_for_input", False)]}), + ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS', "alt": True}, + {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}), + ), + }, + ) + + +def km_generic_tool_annotate_eraser(params): + return ( + "Generic Tool: Annotate Eraser", + {"region_type": 'WINDOW'}, + {"items": ( + ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS'}, + {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}), + ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS', "alt": True}, + {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}), + ), + }, + ) + def km_image_editor_tool_uv_cursor(params): return ( "Image Editor Tool: Uv, Cursor", @@ -4994,54 +5050,6 @@ def km_image_editor_tool_uv_select_lasso(params): ) -def km_image_editor_tool_uv_annotate(params): - return ( - "Image Editor Tool: Uv, Annotate", - {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, - {"items": ( - ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS'}, - {"properties": [("mode", 'DRAW'), ("wait_for_input", False)]}), - ), - }, - ) - - -def km_image_editor_tool_uv_annotate_line(params): - return ( - "Image Editor Tool: Uv, Annotate Line", - {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, - {"items": ( - ("gpencil.annotate", {"type": params.tool_tweak, "value": 'ANY'}, - {"properties": [("mode", 'DRAW_STRAIGHT'), ("wait_for_input", False)]}), - ), - }, - ) - - -def km_image_editor_tool_uv_annotate_polygon(params): - return ( - "Image Editor Tool: Uv, Annotate Polygon", - {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, - {"items": ( - ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS'}, - {"properties": [("mode", 'DRAW_POLY'), ("wait_for_input", False)]}), - ), - }, - ) - - -def km_image_editor_tool_uv_annotate_eraser(params): - return ( - "Image Editor Tool: Uv, Annotate Eraser", - {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'}, - {"items": ( - ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS'}, - {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}), - ), - }, - ) - - def km_3d_view_tool_object_cursor(params): return ( "3D View Tool: Object, Cursor", @@ -5140,62 +5148,6 @@ def km_3d_view_tool_object_scale(params): ) -def km_3d_view_tool_object_annotate(params): - return ( - "3D View Tool: Object, Annotate", - {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, - {"items": ( - ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS'}, - {"properties": [("mode", 'DRAW'), ("wait_for_input", False)]}), - ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS', "alt": True}, - {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}), - ), - }, - ) - - -def km_3d_view_tool_object_annotate_line(params): - return ( - "3D View Tool: Object, Annotate Line", - {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, - {"items": ( - ("gpencil.annotate", {"type": params.tool_tweak, "value": 'ANY'}, - {"properties": [("mode", 'DRAW_STRAIGHT'), ("wait_for_input", False)]}), - ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS', "alt": True}, - {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}), - ), - }, - ) - - -def km_3d_view_tool_object_annotate_polygon(params): - return ( - "3D View Tool: Object, Annotate Polygon", - {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, - {"items": ( - ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS'}, - {"properties": [("mode", 'DRAW_POLY'), ("wait_for_input", False)]}), - ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS', "alt": True}, - {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}), - ), - }, - ) - - -def km_3d_view_tool_object_annotate_eraser(params): - return ( - "3D View Tool: Object, Annotate Eraser", - {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, - {"items": ( - ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS'}, - {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}), - ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS', "alt": True}, - {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}), - ), - }, - ) - - def km_3d_view_tool_object_measure(params): return ( "3D View Tool: Object, Measure", @@ -5940,15 +5892,16 @@ def generate_keymaps(params=None): km_popup_toolbar(params), # Tool System. + km_generic_tool_annotate(params), + km_generic_tool_annotate_line(params), + km_generic_tool_annotate_polygon(params), + km_generic_tool_annotate_eraser(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_annotate(params), - km_image_editor_tool_uv_annotate_line(params), - km_image_editor_tool_uv_annotate_polygon(params), - km_image_editor_tool_uv_annotate_eraser(params), km_3d_view_tool_object_cursor(params), km_3d_view_tool_object_select(params), km_3d_view_tool_object_select_box(params), @@ -5958,10 +5911,6 @@ def generate_keymaps(params=None): km_3d_view_tool_object_move(params), km_3d_view_tool_object_rotate(params), km_3d_view_tool_object_scale(params), - km_3d_view_tool_object_annotate(params), - km_3d_view_tool_object_annotate_line(params), - km_3d_view_tool_object_annotate_polygon(params), - km_3d_view_tool_object_annotate_eraser(params), km_3d_view_tool_object_measure(params), km_3d_view_tool_pose_breakdowner(params), km_3d_view_tool_pose_push(params), |