Blenderkit: Breaks keymap type "Window" #67565

Closed
opened 2019-07-24 07:24:29 +02:00 by Brendon Murphy · 6 comments
Member

System Information
Operating system: win64

Blender Version
Broken:
2.80, 45ae9edbd5ac, blender2.8, 2018-07-25,
Worked: (optional)

Short description of error
Keymap registration in Blenderkit Breaks Key map unregister "Window Type" in Viewport Pie Menu addon and likely causes error in addons load tests.

Exact steps for others to reproduce the error
Enable Blenderkit addon
Enable Viewport pie menu's addon then in the addons preferences enable all or only the editor switch pie.
Disable Blenderkit
Disable Viewport pie menu's.
Error:

Traceback (most recent call last):
  File "C:\Users\Dell\Downloads\blender-2.80-22_07_19-win64\2.80\scripts\modules\addon_utils.py", line 437, in disable
    mod.unregister()
  File "C:\Users\Dell\Downloads\blender-2.80-22_07_19-win64\2.80\scripts\addons\space_view3d_pie_menus\__init__.py", line 304, in unregister
    unregister_submodule(mod)
  File "C:\Users\Dell\Downloads\blender-2.80-22_07_19-win64\2.80\scripts\addons\space_view3d_pie_menus\__init__.py", line 112, in unregister_submodule
    mod.unregister()
  File "C:\Users\Dell\Downloads\blender-2.80-22_07_19-win64\2.80\scripts\addons\space_view3d_pie_menus\pie_editor_switch_menu.py", line 164, in unregister
    km.keymap_items.remove(kmi)
RuntimeError: Error: KeyMapItem '' cannot be removed from 'Window'

Please note: The viewport pies addon registers and unregister and correctly removes the keymap from the "Window" keymaps when enabled without Blenderkit enabled then disabled. I believe this may have been the cause of the issues here 9792985119 due to order of enable disable in the addons load tests Resulting in my commits to the pie menus reverted. I'm not looking to change the pie menu's again until after release.

The bug in Blenderkit needs to be addressed asap. Priority should be high and fix should be in before release.

I would like to thank @Imaginer for his help in irc on this matter and the time spent testing this unusual circumstance. A edited copy of his report back.
blenderkit gets unregistered before your addon and it's not, you see both addons add hotkeys to the 'Window' keymap.
When blenderkit removes the keymap it seems to go to far and messes up the 'Window' keymap
To verify just enable all addons except blenderkit and try a factory reset
Or just enable yours and blenderkit, then disable blenderkit and disable yours and you can replicate without doing a factory reset
[I'm wondering if it's something to do with a persistent property it registers on the keymap?
sorry, kmi.properties.keep_running
got solution for you
error in km, kmi for loop
replace lines 1692-1694 in ui.py with the normal unregistration and you'll need to replace the addon_keymaps append line in register.

@ideasman42 @brecht @VilemDuha

**System Information** Operating system: win64 **Blender Version** Broken: 2.80, 45ae9edbd5ac, blender2.8, 2018-07-25, Worked: (optional) **Short description of error** Keymap registration in Blenderkit Breaks Key map unregister "Window Type" in Viewport Pie Menu addon and likely causes error in addons load tests. **Exact steps for others to reproduce the error** Enable Blenderkit addon Enable Viewport pie menu's addon then in the addons preferences enable all or only the editor switch pie. Disable Blenderkit Disable Viewport pie menu's. Error: ``` Traceback (most recent call last): File "C:\Users\Dell\Downloads\blender-2.80-22_07_19-win64\2.80\scripts\modules\addon_utils.py", line 437, in disable mod.unregister() File "C:\Users\Dell\Downloads\blender-2.80-22_07_19-win64\2.80\scripts\addons\space_view3d_pie_menus\__init__.py", line 304, in unregister unregister_submodule(mod) File "C:\Users\Dell\Downloads\blender-2.80-22_07_19-win64\2.80\scripts\addons\space_view3d_pie_menus\__init__.py", line 112, in unregister_submodule mod.unregister() File "C:\Users\Dell\Downloads\blender-2.80-22_07_19-win64\2.80\scripts\addons\space_view3d_pie_menus\pie_editor_switch_menu.py", line 164, in unregister km.keymap_items.remove(kmi) RuntimeError: Error: KeyMapItem '' cannot be removed from 'Window' ``` Please note: The viewport pies addon registers and unregister and correctly removes the keymap from the "Window" keymaps when enabled without Blenderkit enabled then disabled. I believe this may have been the cause of the issues here 979298511916 due to order of enable disable in the addons load tests Resulting in my commits to the pie menus reverted. I'm not looking to change the pie menu's again until after release. The bug in Blenderkit needs to be addressed asap. Priority should be high and fix should be in before release. I would like to thank @Imaginer for his help in irc on this matter and the time spent testing this unusual circumstance. A edited copy of his report back. blenderkit gets unregistered before your addon and it's not, you see both addons add hotkeys to the 'Window' keymap. When blenderkit removes the keymap it seems to go to far and messes up the 'Window' keymap To verify just enable all addons except blenderkit and try a factory reset Or just enable yours and blenderkit, then disable blenderkit and disable yours and you can replicate without doing a factory reset [I'm wondering if it's something to do with a persistent property it registers on the keymap? sorry, kmi.properties.keep_running got solution for you error in km, kmi for loop replace lines 1692-1694 in ui.py with the normal unregistration and you'll need to replace the addon_keymaps append line in register. @ideasman42 @brecht @VilemDuha
Author
Member
Added subscribers: @Imaginer, @ideasman42, @VilemDuha, @brecht, @BrendonMurphy
Vilem Duha was assigned by Brendon Murphy 2019-07-24 07:26:35 +02:00
Author
Member

Adding highest priority as this should be fixed before release.

Adding highest priority as this should be fixed before release.
Member

Just to clarify. When blenderkit registers it only stores the keymap in addon_keymaps; it doesn't store the keymap_item as well. When it unregisters the hotkey in ui.py it then uses "wm.keyconfigs.addon.keymaps.remove(km)" instead of km.**keymap_items.**remove(kmi) and so removes the entire "Window" keymap instead of just the hotkey it created. This then causes any other addons that try to remove hotkeys from the "Window" keymap to fail.

Just to clarify. When blenderkit registers it only stores the keymap in addon_keymaps; it doesn't store the keymap_item as well. When it unregisters the hotkey in ui.py it then uses "wm.keyconfigs.addon.**keymaps**.remove(km)" instead of km.**keymap_items.**remove(kmi) and so removes the entire "Window" keymap instead of just the hotkey it created. This then causes any other addons that try to remove hotkeys from the "Window" keymap to fail.

This issue was referenced by 5fdd75d683

This issue was referenced by 5fdd75d68328cb3257a9792c6deb84e49b606375

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Member

Resolved by commit 5fdd75d683

Resolved by commit 5fdd75d68328cb3257a9792c6deb84e49b606375
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#67565
No description provided.