Fix #136998: Cannot assign shortcut to insert single keyframe operator

Shortcut is actually assigned to the operator but inside wrong keymap
("Animation"). When "add shortcut" is invoked for a property within
side panel or properties tab, add the new keyitem to "User Interface"
keymap.

Pull Request: https://projects.blender.org/blender/blender/pulls/137080
This commit is contained in:
Pratik Borhade
2025-04-15 19:42:55 +02:00
committed by Harley Acheson
parent 1332c21581
commit d330c1ec65

View File

@@ -406,10 +406,21 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
default:
break;
}
if (ARegion *region = CTX_wm_region(C)) {
/* When property is in side panel, add shortcut key to User interface Keymap, see: #136998.
*/
if (region->regiontype == RGN_TYPE_UI) {
km = WM_keymap_find_all(wm, "User Interface", SPACE_EMPTY, RGN_TYPE_WINDOW);
}
}
if (km && !WM_keymap_poll((bContext *)C, km)) {
km = nullptr;
}
}
else if (sl->spacetype == SPACE_PROPERTIES) {
km = WM_keymap_find_all(wm, "User Interface", SPACE_EMPTY, RGN_TYPE_WINDOW);
}
if (!km) {
km = WM_keymap_find_all(wm, "Animation", SPACE_EMPTY, RGN_TYPE_WINDOW);