armory/blender/arm/keymap.py

27 lines
822 B
Python
Raw Normal View History

2016-10-19 13:28:06 +02:00
import bpy
2017-03-15 12:30:14 +01:00
import arm.props_ui as props_ui
2016-10-19 13:28:06 +02:00
arm_keymaps = []
def register():
wm = bpy.context.window_manager
addon_keyconfig = wm.keyconfigs.addon
# Keyconfigs are not available in background mode. If the keyconfig
# was not found despite running _not_ in background mode, a warning
# is printed
if addon_keyconfig is None:
if not bpy.app.background:
print("Armory warning: no keyconfig path found")
return
km = addon_keyconfig.keymaps.new(name='Window', space_type='EMPTY', region_type="WINDOW")
2016-10-19 13:28:06 +02:00
km.keymap_items.new(props_ui.ArmoryPlayButton.bl_idname, type='F5', value='PRESS')
arm_keymaps.append(km)
def unregister():
wm = bpy.context.window_manager
for km in arm_keymaps:
wm.keyconfigs.addon.keymaps.remove(km)
del arm_keymaps[:]