diff options
author | Julian Eisel <julian@blender.org> | 2020-08-07 17:07:45 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-08-07 17:11:30 +0300 |
commit | 17dbdcc552bfb96441a8fd3c57a4787378e5a549 (patch) | |
tree | 19675b4acbf0c0f3de1e3f3a372b6baa54281e00 | |
parent | d4bd0789abb6e7805e07636232cec4480028f6d1 (diff) |
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.
-rw-r--r-- | source/blender/windowmanager/intern/wm_keymap_utils.c | 20 |
1 files changed, 19 insertions, 1 deletions
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")) { |