Fix T41500: mesh_f2.py annoying exception when running blender from terminal with '--background --python'

keyconfigs are not available in background mode...
This commit is contained in:
Bastien Montagne 2014-08-20 09:29:18 +02:00
parent dcb4b78b1b
commit c24bd5bb2f
Notes: blender-bot 2023-02-14 20:04:17 +01:00
Referenced by issue #41500, mesh_f2.py annoying exception when running blender from terminal with '--background --python'
1 changed files with 5 additions and 4 deletions

View File

@ -384,10 +384,11 @@ def register():
bpy.utils.register_class(c)
# add keymap entry
km = bpy.context.window_manager.keyconfigs.addon.keymaps.new(\
name='Mesh', space_type='EMPTY')
kmi = km.keymap_items.new("mesh.f2", 'F', 'PRESS')
addon_keymaps.append((km, kmi))
kcfg = bpy.context.window_manager.keyconfigs.addon
if kcfg:
km = kcfg.keymaps.new(name='Mesh', space_type='EMPTY')
kmi = km.keymap_items.new("mesh.f2", 'F', 'PRESS')
addon_keymaps.append((km, kmi))
def unregister():