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.
This commit is contained in:
Julian Eisel
2020-08-07 16:07:45 +02:00
parent d4bd0789ab
commit 17dbdcc552

View File

@@ -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")) {