Fix T66074: Number shortcut for brushes doesn't work

Add number brush switching for 2.7x map.
This commit is contained in:
Campbell Barton 2019-06-25 01:06:17 +10:00
parent 4fcc3b8ba2
commit b2a20c2d9e
Notes: blender-bot 2023-02-14 02:06:22 +01:00
Referenced by issue #66074, number short cut for select brush does not work
2 changed files with 23 additions and 1 deletions

View File

@ -316,6 +316,15 @@ 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},
{"properties": [("index", i)]})
for i in range(20)
]
# ------------------------------------------------------------------------------
# Window, Screen, Areas, Regions
@ -3629,6 +3638,9 @@ def km_image_paint(params):
op_panel("VIEW3D_PT_paint_texture_context_menu", params.context_menu_event),
])
if params.legacy:
items.extend(_template_items_legacy_tools_from_numbers())
return keymap
@ -3672,6 +3684,9 @@ def km_vertex_paint(params):
op_panel("VIEW3D_PT_paint_vertex_context_menu", params.context_menu_event),
])
if params.legacy:
items.extend(_template_items_legacy_tools_from_numbers())
return keymap
@ -3716,6 +3731,10 @@ def km_weight_paint(params):
("view3d.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, None),
])
if params.legacy:
items.extend(_template_items_legacy_tools_from_numbers())
return keymap
@ -3810,6 +3829,9 @@ def km_sculpt(params):
op_panel("VIEW3D_PT_sculpt_context_menu", params.context_menu_event),
])
if params.legacy:
items.extend(_template_items_legacy_tools_from_numbers())
return keymap

View File

@ -1559,7 +1559,7 @@ class WM_OT_tool_set_by_index(Operator):
expand: BoolProperty(
description="Include tool sub-groups",
default=False,
default=True,
)
space_type: rna_space_type_prop