Cleanup: remove unused code & add comments
This commit is contained in:
@@ -61,8 +61,6 @@ def generate(context, space_type):
|
||||
]
|
||||
items_all_text = {item_container[0].text for item_container in items_all}
|
||||
|
||||
use_simple_keymap = False
|
||||
|
||||
# Press the toolbar popup key again to set the default tool,
|
||||
# this is useful because the select box tool is useful as a way
|
||||
# to 'drop' currently active tools (it's basically a 'none' tool).
|
||||
@@ -165,13 +163,12 @@ def generate(context, space_type):
|
||||
if item_container[0].text != tap_reset_tool
|
||||
]
|
||||
|
||||
if use_simple_keymap:
|
||||
# Simply assign a key from A-Z.
|
||||
for i, (item, _, _) in enumerate(items_all):
|
||||
key = chr(ord('A') + i)
|
||||
kmi = keymap.keymap_items.new("wm.tool_set_by_name", key, 'PRESS')
|
||||
kmi.properties.name = item.text
|
||||
else:
|
||||
# -----------------------
|
||||
# Begin Keymap Generation
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Direct Tool Assignment & Brushes
|
||||
|
||||
for item_container in items_all:
|
||||
item = item_container[0]
|
||||
# Only check the first item in the tools key-map (a little arbitrary).
|
||||
@@ -240,6 +237,9 @@ def generate(context, space_type):
|
||||
kmi_found = None
|
||||
item_container[1] = kmi_found
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Single Key Access
|
||||
|
||||
# More complex multi-pass test.
|
||||
for item_container in items_all:
|
||||
item, kmi_found = item_container[:2]
|
||||
@@ -259,8 +259,13 @@ def generate(context, space_type):
|
||||
kmi.properties.name = item.text
|
||||
item_container[2] = kmi
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Single Key Modifier
|
||||
#
|
||||
#
|
||||
# Test for key_modifier, where alpha key is used as a 'key_modifier'
|
||||
# (grease pencil holding 'D' for example).
|
||||
|
||||
for item_container in items_all:
|
||||
item, kmi_found, kmi_exist = item_container
|
||||
if kmi_found is None or kmi_exist:
|
||||
@@ -286,6 +291,11 @@ def generate(context, space_type):
|
||||
kmi.properties.name = item.text
|
||||
item_container[2] = kmi
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Assign A-Z to Keys
|
||||
#
|
||||
# When th keys are free.
|
||||
|
||||
if use_auto_keymap_alpha:
|
||||
# Map all unmapped keys to numbers,
|
||||
# while this is a bit strange it means users will not confuse regular key bindings to ordered bindings.
|
||||
@@ -311,6 +321,9 @@ def generate(context, space_type):
|
||||
item_container[2] = kmi
|
||||
del kmi_type_alpha_char, kmi_type_alpha_args, kmi_type_alpha_args_tuple
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Assign Numbers to Keys
|
||||
|
||||
if use_auto_keymap_num:
|
||||
# Free events (last used first).
|
||||
kmi_type_auto = ('ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE', 'ZERO')
|
||||
@@ -366,11 +379,15 @@ def generate(context, space_type):
|
||||
kmi.properties.name = item.text
|
||||
kmi_unique_args.add(kmi_tuple)
|
||||
|
||||
|
||||
# ---------------------
|
||||
# End Keymap Generation
|
||||
|
||||
if use_hack_properties:
|
||||
keymap.keymap_items.remove(kmi_hack)
|
||||
keymap.keymap_items.remove(kmi_hack_brush_select)
|
||||
|
||||
|
||||
# Keepo last so we can try add a key without any modifiers
|
||||
# Keep last so we can try add a key without any modifiers
|
||||
# in the case this toolbar was activated with modifiers.
|
||||
if use_tap_reset:
|
||||
if len(kmi_toolbar_args_type_only) == len(kmi_toolbar_args):
|
||||
|
||||
Reference in New Issue
Block a user