[Bf-extensions-cvs] [c24bd5b] master: Fix T41500: mesh_f2.py annoying exception when running blender from terminal with '--background --python'

Bastien Montagne noreply at git.blender.org
Wed Aug 20 09:41:40 CEST 2014


Commit: c24bd5bb2f56043b6d988c42f426d46c80799def
Author: Bastien Montagne
Date:   Wed Aug 20 09:29:18 2014 +0200
Branches: master
https://developer.blender.org/rBAc24bd5bb2f56043b6d988c42f426d46c80799def

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

keyconfigs are not available in background mode...

===================================================================

M	mesh_f2.py

===================================================================

diff --git a/mesh_f2.py b/mesh_f2.py
index 16f67b9..61786d1 100644
--- a/mesh_f2.py
+++ b/mesh_f2.py
@@ -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():



More information about the Bf-extensions-cvs mailing list