andyp123 / blender_vertex_color_master

Blender addon for working more precisely with vertex colours.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BUG: Keymap doesn't unregister correctly

andyp123 opened this issue · comments

The key for pie menus can't be unregistered properly, which sometimes causes errors on script reload and addon uninstallation.

Traceback (most recent call last):
addon_utils.py, line 437, in disable
mod.unregister()
init.py, line 113, in unregister
del bpy.types.Scene.vertex_color_master_settings
AttributeError: 'tuple' object has no attribute 'keymap_items'

Referring to Blender manual Here Maybe you can try this unregister func

def unregister():
    ...
    # unregister shortcuts
    wm = bpy.context.window_manager
    if wm.keyconfigs.addon:
        for km,kmi in addon_keymaps:
            km.keymap_items.remove(kmi)
        wm.keyconfigs.addon.keymaps.remove(km)
    addon_keymaps.clear()

Thanks for the suggestion! I think that's where I got the original code from, but it could have been updated since. I haven't been keeping this addon updated recently, but I may return to it now Blender 3.0 is out and the vertex colour editing mode isn't going to change drastically any time soon.

Fixed :)