Industry Compat keymap: Properly support Grease Pencil Edit Mode

Many things weren't working correctly in GP Edit Mode, such as select/deselect/invert all, basic tools, extrude, snap etc.

Now this mode works consistently with other modes.
This commit is contained in:
William Reynish 2020-01-05 12:43:16 +01:00
parent 85d43943dd
commit 295647212d
1 changed files with 9 additions and 29 deletions

View File

@ -770,7 +770,6 @@ def km_mask_editing(params):
("mask.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True}, {"properties": [("action", 'SELECT')]}),
("mask.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True, "shift": True}, {"properties": [("action", 'DESELECT')]}),
("mask.select_all", {"type": 'I', "value": 'PRESS', "ctrl": True}, {"properties": [("action", 'INVERT')]}),
#*_template_items_select_actions(params, "mask.select_all"),
("mask.select_linked", {"type": 'L', "value": 'PRESS', "ctrl": True}, None),
("mask.select_linked_pick", {"type": 'L', "value": 'PRESS'},
{"properties": [("deselect", False)]}),
@ -2256,10 +2255,12 @@ def km_grease_pencil(_params):
def _grease_pencil_selection(params):
return [
# Select all
("gpencil.select_box", {"type": 'A', "value": 'PRESS', "ctrl": True}, None),
("gpencil.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True},
{"properties": [("extend", True), ("toggle", True)]}),
# Select all
("gpencil.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True}, {"properties": [("action", 'SELECT')]}),
("gpencil.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True, "shift": True}, {"properties": [("action", 'DESELECT')]}),
("gpencil.select_all", {"type": 'I', "value": 'PRESS', "ctrl": True}, {"properties": [("action", 'INVERT')]}),
# Select linked
("gpencil.select_linked", {"type": 'RIGHT_BRACKET', "value": 'PRESS'}, None),
# Select alternate
@ -2272,14 +2273,6 @@ def _grease_pencil_selection(params):
]
def _grease_pencil_display():
return [
("wm.context_toggle", {"type": 'Q', "value": 'PRESS', "shift": True},
{"properties": [("data_path", 'space_data.overlay.use_gpencil_edit_lines')]}),
("wm.context_toggle", {"type": 'Q', "value": 'PRESS', "shift": True, "alt": True},
{"properties": [("data_path", 'space_data.overlay.use_gpencil_multiedit_line_only')]}),
]
def km_grease_pencil_stroke_edit_mode(params):
items = []
@ -2290,18 +2283,13 @@ def km_grease_pencil_stroke_edit_mode(params):
)
items.extend([
# Interpolation
("gpencil.interpolate", {"type": 'E', "value": 'PRESS', "ctrl": True, "alt": True}, None),
("gpencil.interpolate_sequence", {"type": 'E', "value": 'PRESS', "shift": True, "ctrl": True}, None),
# Normal select
("gpencil.select", {"type": 'LEFTMOUSE', "value": 'PRESS'},
("gpencil.select", {"type": 'LEFTMOUSE', "value": 'CLICK'},
{"properties": [("deselect_all", True)]}),
# Selection
*_grease_pencil_selection(params),
# Duplicate and move selected points
("gpencil.duplicate_move", {"type": 'D', "value": 'PRESS', "ctrl": True}, None),
# Extrude and move selected points
("gpencil.extrude_move", {"type": 'E', "value": 'PRESS'}, None),
# Delete
op_menu("VIEW3D_MT_edit_gpencil_delete", {"type": 'BACK_SPACE', "value": 'PRESS'}),
op_menu("VIEW3D_MT_edit_gpencil_delete", {"type": 'DEL', "value": 'PRESS'}),
@ -2321,20 +2309,13 @@ def km_grease_pencil_stroke_edit_mode(params):
("gpencil.copy", {"type": 'C', "value": 'PRESS', "ctrl": True}, None),
("gpencil.paste", {"type": 'V', "value": 'PRESS', "ctrl": True}, None),
# Snap
op_menu("GPENCIL_MT_snap", {"type": 'S', "value": 'PRESS', "shift": True}),
op_menu("GPENCIL_MT_snap", {"type": 'X', "value": 'PRESS', "shift": True}),
# Show/hide
("gpencil.reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None),
("gpencil.hide", {"type": 'H', "value": 'PRESS', "ctrl": True},
{"properties": [("unselected", False)]}),
("gpencil.hide", {"type": 'H', "value": 'PRESS', "shift": True},
{"properties": [("unselected", True)]}),
("gpencil.selection_opacity_toggle", {"type": 'H', "value": 'PRESS', "ctrl": True}, None),
# Display
*_grease_pencil_display(),
# Isolate layer
("gpencil.layer_isolate", {"type": 'NUMPAD_ASTERIX', "value": 'PRESS'}, None),
# Move to layer
("gpencil.move_to_layer", {"type": 'G', "value": 'PRESS'}, None),
# Transform tools
("transform.translate", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, None),
("wm.context_toggle", {"type": 'B', "value": 'PRESS'},
@ -2350,6 +2331,9 @@ def km_grease_pencil_stroke_edit_mode(params):
{"properties": [("mode", 2)]}),
# Tools
*_template_items_basic_tools(),
op_tool_cycle("builtin.extrude", {"type": 'E', "value": 'PRESS', "ctrl": True}),
op_tool_cycle("builtin.radius", {"type": 'R', "value": 'PRESS', "ctrl": True}),
op_tool_cycle("builtin.bend", {"type": 'B', "value": 'PRESS', "ctrl": True}),
])
@ -2514,8 +2498,6 @@ def km_grease_pencil_stroke_sculpt_mode(params):
{"properties": [("data_path_primary", 'tool_settings.gpencil_sculpt.brush.size')]}),
# Context menu
*_template_items_context_panel("VIEW3D_PT_gpencil_sculpt_context_menu", {"type": 'RIGHTMOUSE', "value": 'PRESS'}),
# Display
*_grease_pencil_display(),
])
return keymap
@ -2543,8 +2525,6 @@ def km_grease_pencil_stroke_weight_mode(params):
# Brush size.
("wm.radial_control", {"type": 'S', "value": 'PRESS'},
{"properties": [("data_path_primary", 'tool_settings.gpencil_sculpt.weight_brush.size')]}),
# Display
*_grease_pencil_display(),
])
return keymap