prevent keymap register in background mode

2.1.6

- Fixed: Prevent some keymaps to register when blender is launched in background mode
gpv2
pullusb 2023-01-16 17:56:51 +01:00
parent 4ae5d3a55b
commit 80ec798144
3 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,10 @@
# Changelog # Changelog
2.1.6
- Fixed: Prevent some keymaps to register when blender is launched in background mode
2.1.5 2.1.5
- fixed: false positive with checkfile in modifier layer target - fixed: false positive with checkfile in modifier layer target

View File

@ -759,6 +759,8 @@ class GPTB_OT_add_gp_layer(Operator):
addon_keymaps = [] addon_keymaps = []
def register_keymaps(): def register_keymaps():
if bpy.app.background:
return
addon = bpy.context.window_manager.keyconfigs.addon addon = bpy.context.window_manager.keyconfigs.addon
##---# Insert Layers ##---# Insert Layers
@ -789,6 +791,8 @@ def register_keymaps():
def unregister_keymaps(): def unregister_keymaps():
if bpy.app.background:
return
for km, kmi in addon_keymaps: for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi) km.keymap_items.remove(kmi)
addon_keymaps.clear() addon_keymaps.clear()

View File

@ -4,7 +4,7 @@ bl_info = {
"name": "GP toolbox", "name": "GP toolbox",
"description": "Tool set for Grease Pencil in animation production", "description": "Tool set for Grease Pencil in animation production",
"author": "Samuel Bernou, Christophe Seux", "author": "Samuel Bernou, Christophe Seux",
"version": (2, 1, 5), "version": (2, 1, 6),
"blender": (3, 0, 0), "blender": (3, 0, 0),
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", "location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
"warning": "", "warning": "",