diff options
author | Robert Guetzkow <gitcommit@outlook.de> | 2020-12-01 12:24:10 +0300 |
---|---|---|
committer | Robert Guetzkow <gitcommit@outlook.de> | 2020-12-01 12:27:31 +0300 |
commit | 73976fd55a45d48b8e86c163375f26d5c5a7be68 (patch) | |
tree | 2e8b1e4f07ecefb4dbdafbd4cb4b3b724a14d65c /greasepencil_tools/prefs.py | |
parent | cde7574c05bd44e172827eafac6f9ffb7fe76a13 (diff) |
Fix T83099: Greasepencil add-on keymap item removal
The greasepencil add-on removed keymap items it hadn't created
itself, thus invalidating references that other add-ons held for
the keymap items they've created. This is fixed by storing a
reference to the created keymap items alongside the keymap and
only removing those items that the add-on created itself.
Additionally, this commit fixes the doc string that was no
longer valid.
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D9670
Diffstat (limited to 'greasepencil_tools/prefs.py')
-rw-r--r-- | greasepencil_tools/prefs.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/greasepencil_tools/prefs.py b/greasepencil_tools/prefs.py index 4c146220..1475e95c 100644 --- a/greasepencil_tools/prefs.py +++ b/greasepencil_tools/prefs.py @@ -218,21 +218,18 @@ def register_keymaps(): return addon = bpy.context.window_manager.keyconfigs.addon - km = bpy.context.window_manager.keyconfigs.addon.keymaps.get("3D View") - if not km: - km = addon.keymaps.new(name = "3D View", space_type = "VIEW_3D") - + km = addon.keymaps.new(name = "3D View", space_type = "VIEW_3D") + if 'view3d.rotate_canvas' not in km.keymap_items: km = addon.keymaps.new(name='3D View', space_type='VIEW_3D') kmi = km.keymap_items.new('view3d.rotate_canvas', type=pref.mouse_click, value="PRESS", alt=pref.use_alt, ctrl=pref.use_ctrl, shift=pref.use_shift, any=False) - addon_keymaps.append(km) + addon_keymaps.append((km, kmi)) def unregister_keymaps(): - for km in addon_keymaps: - for kmi in km.keymap_items: - km.keymap_items.remove(kmi) + for km, kmi in addon_keymaps: + km.keymap_items.remove(kmi) addon_keymaps.clear() |