-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkey.py
35 lines (24 loc) · 825 Bytes
/
key.py
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
35
import bpy
from .ui.pie import AlignPieMenu
keymaps = []
def reg_key():
kc = bpy.context.window_manager.keyconfigs.addon # 获取按键配置addon的
km = kc.keymaps.new(name='Object Mode', space_type='EMPTY', region_type='WINDOW')
kmi = km.keymap_items.new(idname='wm.call_menu_pie',
type="A",
value='PRESS',
ctrl=True,
shift=False,
alt=True,
)
kmi.properties.name = AlignPieMenu.bl_idname
kmi.show_expanded = True
keymaps.append((km, kmi))
def un_reg_key():
for km, kmi in keymaps:
km.keymap_items.remove(kmi)
keymaps.clear()
def register():
reg_key()
def unregister():
un_reg_key()