Skip to content

Commit

Permalink
feat: add SHIFT+T shortcut for toggle utils
Browse files Browse the repository at this point in the history
  • Loading branch information
tristan-hm committed Jul 11, 2024
1 parent 53b048e commit ccb530e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions viewport/toggle_utils_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
from .. lib.objects import get_all_util_objects


keys = []


class ND_OT_toggle_utils_collection(bpy.types.Operator):
bl_idname = "nd.toggle_utils_collection"
bl_label = "Utils Visibility"
Expand Down Expand Up @@ -63,6 +66,17 @@ def invoke(self, context, event):
def register():
bpy.utils.register_class(ND_OT_toggle_utils_collection)

for mapping in [('Object Mode', 'EMPTY')]:
keymap = bpy.context.window_manager.keyconfigs.addon.keymaps.new(name=mapping[0], space_type=mapping[1])

entry = keymap.keymap_items.new("nd.toggle_utils_collection", 'T', 'PRESS', shift=True)
keys.append((keymap, entry))


def unregister():
for keymap, entry in keys:
keymap.keymap_items.remove(entry)

keys.clear()

bpy.utils.unregister_class(ND_OT_toggle_utils_collection)

0 comments on commit ccb530e

Please sign in to comment.