forked from ChristopheSeux/boneWidget
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkeymaps.py
More file actions
34 lines (23 loc) · 751 Bytes
/
keymaps.py
File metadata and controls
34 lines (23 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import bpy
from . import menus
addon_keymaps = []
def can_register():
# true if Blender run with GUI
return not bpy.app.background
def register():
if not can_register():
return
wm = bpy.context.window_manager
km = wm.keyconfigs.addon.keymaps.new("Pose", space_type="EMPTY")
kmi = km.keymap_items.new("wm.call_menu_pie", type="E", value="PRESS")
kmi.properties.name = menus.BONEWIDGET_MT_pie.bl_idname
addon_keymaps.append(km)
def unregister():
if not can_register():
return
wm = bpy.context.window_manager
for km in addon_keymaps:
for kmi in km.keymap_items:
km.keymap_items.remove(kmi)
wm.keyconfigs.addon.keymaps.remove(km)
addon_keymaps.clear()