Skip to content

Commit

Permalink
fix: 🐛 Error after deactivating the addon.
Browse files Browse the repository at this point in the history
  • Loading branch information
BlenderDefender authored Jul 2, 2022
2 parents 9cc4237 + eb4ad91 commit a7a6fbd
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ def register_keymap(*args):

keymaps = ["3D View", "UV Editor"]

t = [k.name for k in wm.keyconfigs.active.keymaps]

for map in keymaps:
# Get the active keymap for the 3D view
active_km = wm.keyconfigs.active.keymaps[map]
# Try to get the active keymap for the current map name.
active_km = wm.keyconfigs.active.keymaps.get(map, None)

if not active_km:
print(f"Gizmodal Ops Register - Warning: Key {map} not found.")
continue

find_km_item = active_km.keymap_items.find_from_operator

# Iterate over all keymap items defined in operators.
Expand All @@ -83,8 +86,13 @@ def unregister_keymap(*args):
keymaps = ["3D View", "UV Editor"]

for map in keymaps:
# Get the active keymap for the 3D view
active_km = wm.keyconfigs.active.keymaps[map]
# Try to get the active keymap for the current map name.
active_km = wm.keyconfigs.active.keymaps.get(map, None)

if not active_km:
print(f"Gizmodal Ops Unregister - Warning: Key {map} not found.")
continue

find_km_item = active_km.keymap_items.find_from_operator

# Iterate over all keymap items defined in operators.
Expand Down

0 comments on commit a7a6fbd

Please sign in to comment.