From 17dbdcc552bfb96441a8fd3c57a4787378e5a549 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 7 Aug 2020 16:07:45 +0200 Subject: [PATCH] Fix T79571: "Assign Shortcut" doesn't work for "Clear Keyframes" In the 3D View, the "Animation" keymap is not used, but the mode specific ones. So the shortcut editing code should use these too, just like the default keymap does. --- .../windowmanager/intern/wm_keymap_utils.c | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/source/blender/windowmanager/intern/wm_keymap_utils.c b/source/blender/windowmanager/intern/wm_keymap_utils.c index 5ab36b15666..83558bc9192 100644 --- a/source/blender/windowmanager/intern/wm_keymap_utils.c +++ b/source/blender/windowmanager/intern/wm_keymap_utils.c @@ -379,7 +379,25 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname) } /* Animation Generic - after channels */ else if (STRPREFIX(opname, "ANIM_OT")) { - km = WM_keymap_find_all(wm, "Animation", 0, 0); + if (sl->spacetype == SPACE_VIEW3D) { + switch (CTX_data_mode_enum(C)) { + case CTX_MODE_OBJECT: + km = WM_keymap_find_all(wm, "Object Mode", 0, 0); + break; + case CTX_MODE_POSE: + km = WM_keymap_find_all(wm, "Pose", 0, 0); + break; + default: + break; + } + if (km && !WM_keymap_poll((bContext *)C, km)) { + km = NULL; + } + } + + if (!km) { + km = WM_keymap_find_all(wm, "Animation", 0, 0); + } } /* Graph Editor */ else if (STRPREFIX(opname, "GRAPH_OT")) {