Cleanup: remove redundant keymap arguments

Also add missing space-type argument, while not required
this is used by convention elsewhere in the key-map.
This commit is contained in:
Campbell Barton 2021-03-14 18:00:17 +11:00
parent 2e95eaed55
commit 06245d0d94
2 changed files with 29 additions and 27 deletions

View File

@ -368,7 +368,11 @@ def _template_items_tool_select_actions_simple(operator, *, type, value, propert
def _template_items_legacy_tools_from_numbers():
return [
("wm.tool_set_by_index",
{"type": NUMBERS_1[i % 10], "value": 'PRESS', "shift": i >= 10},
{
"type": NUMBERS_1[i % 10],
"value": 'PRESS',
**({"shift": True} if i >= 10 else {}),
},
{"properties": [("index", i)]})
for i in range(20)
]
@ -5589,28 +5593,26 @@ def km_sculpt_expand_modal(_params):
("CANCEL", {"type": 'ESC', "value": 'PRESS', "any": True}, None),
("CANCEL", {"type": 'RIGHTMOUSE', "value": 'PRESS', "any": True}, None),
("CONFIRM", {"type": 'LEFTMOUSE', "value": 'PRESS', "any": True}, None),
("INVERT", {"type": 'F', "value": 'PRESS', "any": True, "repeat" : False}, None),
("PRESERVE", {"type": 'E', "value": 'PRESS', "any": True, "repeat" : False}, None),
("GRADIENT", {"type": 'G', "value": 'PRESS', "any": True, "repeat" : False}, None),
("RECURSION_STEP_GEODESIC", {"type": 'R', "value": 'PRESS', "repeat" : False}, None),
("RECURSION_STEP_TOPOLOGY", {"type": 'R', "value": 'PRESS', "alt" : True ,"any": True, "repeat" : False}, None),
("MOVE_TOGGLE", {"type": 'SPACE', "value": 'ANY', "any": True, "repeat" : False}, None),
("FALLOFF_GEODESICS", {"type": 'ONE', "value": 'PRESS', "any": True, "repeat" : False}, None),
("FALLOFF_TOPOLOGY", {"type": 'TWO', "value": 'PRESS', "any": True, "repeat" : False}, None),
("FALLOFF_TOPOLOGY_DIAGONALS", {"type": 'THREE', "value": 'PRESS', "any": True, "repeat" : False}, None),
("FALLOFF_SPHERICAL", {"type": 'FOUR', "value": 'PRESS', "any": True, "repeat" : False}, None),
("SNAP_TOGGLE", {"type": 'LEFT_CTRL', "value": 'ANY', "repeat" : False}, None),
("LOOP_COUNT_INCREASE", {"type": 'W', "value": 'PRESS', "any": True, "repeat" : True}, None),
("LOOP_COUNT_DECREASE", {"type": 'Q', "value": 'PRESS', "any": True, "repeat" : True}, None),
("BRUSH_GRADIENT_TOGGLE", {"type": 'B', "value": 'PRESS', "any": True, "repeat" : False}, None),
("TEXTURE_DISTORTION_INCREASE", {"type": 'Y', "value": 'PRESS', "any": False, "repeat" : True}, None),
("TEXTURE_DISTORTION_DECREASE", {"type": 'T', "value": 'PRESS', "any": False, "repeat" : True}, None),
("INVERT", {"type": 'F', "value": 'PRESS', "any": True}, None),
("PRESERVE", {"type": 'E', "value": 'PRESS', "any": True}, None),
("GRADIENT", {"type": 'G', "value": 'PRESS', "any": True}, None),
("RECURSION_STEP_GEODESIC", {"type": 'R', "value": 'PRESS'}, None),
("RECURSION_STEP_TOPOLOGY", {"type": 'R', "value": 'PRESS', "alt": True}, None),
("MOVE_TOGGLE", {"type": 'SPACE', "value": 'ANY', "any": True}, None),
("FALLOFF_GEODESICS", {"type": 'ONE', "value": 'PRESS', "any": True}, None),
("FALLOFF_TOPOLOGY", {"type": 'TWO', "value": 'PRESS', "any": True}, None),
("FALLOFF_TOPOLOGY_DIAGONALS", {"type": 'THREE', "value": 'PRESS', "any": True}, None),
("FALLOFF_SPHERICAL", {"type": 'FOUR', "value": 'PRESS', "any": True}, None),
("SNAP_TOGGLE", {"type": 'LEFT_CTRL', "value": 'ANY'}, None),
("LOOP_COUNT_INCREASE", {"type": 'W', "value": 'PRESS', "any": True, "repeat": True}, None),
("LOOP_COUNT_DECREASE", {"type": 'Q', "value": 'PRESS', "any": True, "repeat": True}, None),
("BRUSH_GRADIENT_TOGGLE", {"type": 'B', "value": 'PRESS', "any": True}, None),
("TEXTURE_DISTORTION_INCREASE", {"type": 'Y', "value": 'PRESS'}, None),
("TEXTURE_DISTORTION_DECREASE", {"type": 'T', "value": 'PRESS'}, None),
])
return keymap
# Fallback for gizmos that don't have custom a custom key-map.
def km_generic_gizmo(_params):
keymap = (
@ -5715,7 +5717,7 @@ def km_popup_toolbar(_params):
def km_generic_tool_annotate(params):
return (
"Generic Tool: Annotate",
{"region_type": 'WINDOW'},
{"space_type": 'EMPTY', "region_type": 'WINDOW'},
{"items": [
("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS'},
{"properties": [("mode", 'DRAW'), ("wait_for_input", False)]}),
@ -5728,7 +5730,7 @@ def km_generic_tool_annotate(params):
def km_generic_tool_annotate_line(params):
return (
"Generic Tool: Annotate Line",
{"region_type": 'WINDOW'},
{"space_type": 'EMPTY', "region_type": 'WINDOW'},
{"items": [
("gpencil.annotate", {"type": params.tool_tweak, "value": 'ANY'},
{"properties": [("mode", 'DRAW_STRAIGHT'), ("wait_for_input", False)]}),
@ -5741,7 +5743,7 @@ def km_generic_tool_annotate_line(params):
def km_generic_tool_annotate_polygon(params):
return (
"Generic Tool: Annotate Polygon",
{"region_type": 'WINDOW'},
{"space_type": 'EMPTY', "region_type": 'WINDOW'},
{"items": [
("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS'},
{"properties": [("mode", 'DRAW_POLY'), ("wait_for_input", False)]}),
@ -5754,7 +5756,7 @@ def km_generic_tool_annotate_polygon(params):
def km_generic_tool_annotate_eraser(params):
return (
"Generic Tool: Annotate Eraser",
{"region_type": 'WINDOW'},
{"space_type": 'EMPTY', "region_type": 'WINDOW'},
{"items": [
("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS'},
{"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}),

View File

@ -3849,10 +3849,10 @@ def km_knife_tool_modal_map(_params):
("ADD_CUT_CLOSED", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK', "any": True}, None),
("ADD_CUT", {"type": 'LEFTMOUSE', "value": 'ANY', "any": True}, None),
("NEW_CUT", {"type": 'E', "value": 'PRESS'}, None),
("SNAP_MIDPOINTS_ON", {"type": 'LEFT_CTRL', "value": 'PRESS', "any": False}, None),
("SNAP_MIDPOINTS_OFF", {"type": 'LEFT_CTRL', "value": 'RELEASE', "any": False}, None),
("SNAP_MIDPOINTS_ON", {"type": 'RIGHT_CTRL', "value": 'PRESS', "any": False}, None),
("SNAP_MIDPOINTS_OFF", {"type": 'RIGHT_CTRL', "value": 'RELEASE', "any": False}, None),
("SNAP_MIDPOINTS_ON", {"type": 'LEFT_CTRL', "value": 'PRESS'}, None),
("SNAP_MIDPOINTS_OFF", {"type": 'LEFT_CTRL', "value": 'RELEASE'}, None),
("SNAP_MIDPOINTS_ON", {"type": 'RIGHT_CTRL', "value": 'PRESS'}, None),
("SNAP_MIDPOINTS_OFF", {"type": 'RIGHT_CTRL', "value": 'RELEASE'}, None),
("IGNORE_SNAP_ON", {"type": 'LEFT_SHIFT', "value": 'PRESS', "any": True}, None),
("IGNORE_SNAP_OFF", {"type": 'LEFT_SHIFT', "value": 'RELEASE', "any": True}, None),
("IGNORE_SNAP_ON", {"type": 'RIGHT_SHIFT', "value": 'PRESS', "any": True}, None),