I experience this problem with all the addons which adds new hotkeys.
# Registration
addon_keymaps = []
def register_keymaps():
wm = bpy.context.window_manager
km = wm.keyconfigs.addon.keymaps.new(name = 'Window', space_type = 'EMPTY')
kmi = km.keymap_items.new('tck.menu_call', 'W', 'PRESS', ctrl = True)
addon_keymaps.append((km, kmi))
def unregister_keymaps():
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
def register():
bpy.utils.register_module(__name__)
register_keymaps()
def unregister():
unregister_keymaps()
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":
register()
Here is the example registration code. I believe this is the standard way, no?
Then is the problem.
Initially I enable the addon and there was no problem.
After I reload blender, save a hotkey preset, or export and load key-config.py,
all the hotkey entries in blender that belongs to addons duplicates.
And this phenomenon does not resolve itself. If I keep saving and loading key-configs, they duplicate a second time.
I’m not sure how or is there a way to resolve this issue. And is it a safe situation at all. My key config is already sitting at 250KB, I fear it may cause trouble for me one day.