Post #5527: Lovely write-up of the nightmare that is the keymap system, let me continue. One
📋 Metadata
- Author: Metemer
- Date: 2025-07-15 15:15:19
- Type:
discussion - Quality Score: 9/10
- Reply to: post_05520
- Replies (3): post_05530, post_05531, post_05533
🏷️ Tags
hotkeys configuration advanced
⚙️ Related PME Features
- Hotkey Configuration
💬 Content
Lovely write-up of the nightmare that is the keymap system, let me continue. One nitpick is that the factory settings and the reset target are not the same thing, except in the standard case.
For add-on hotkeys, the reset target is keyconfigs.addon, and for non-addon hotkeys, it’s keyconfigs.active.
But, when the keymap template is set to “Blender”, active and default are literally the same thing:
>>> keyconfigs = bpy.context.window_manager.keyconfigs
>>> keyconfigs.active == keyconfigs.default
True
You mentioned already that keyconfigs.user is a delta, but here’s an insane thing you can do to showcase that:
- Register the same add-on hotkey 3x
- Delete them in the UI (this deletes the
userKeyMapItems) - Restart Blender
- Register the same add-on hotkey 3x
- None of them will appear in the keymap editor, since they were removed, and that removal delta is being stored somewhere, somehow.
- Register a 4th one
- Motherfucker shows up.
For this reason, add-on hotkeys should never be removed by users , since they cannot be recovered in any other way than providing a button that does so. I implemented that button in CloudRig here. This should essentially discard the “removals” part of the keymap delta.
This still will not save your soul if you export and import a keymap while you have add-ons present. And I don’t know if removals are also stored in the exported data.
The fact that we need to write such workarounds on the Python end to allow users to fix illegal actions promoted by Blender’s UI is really horrible.
I started writing a lengthy page in the Python docs “Gotchas” section about this, which will hopefully motivate some effort on the core dev side, which will maybe lead into a design doc about how the existing system could be improved without rewriting from scratch, since the latter is not realistic. I’m not sure when I’ll get around to finishing it though.
❤️ 6 likes