[Bf-blender-cvs] [17dbdcc552b] master: Fix T79571: "Assign Shortcut" doesn't work for "Clear Keyframes"

Julian Eisel noreply at git.blender.org
Fri Aug 7 16:11:39 CEST 2020


Commit: 17dbdcc552bfb96441a8fd3c57a4787378e5a549
Author: Julian Eisel
Date:   Fri Aug 7 16:07:45 2020 +0200
Branches: master
https://developer.blender.org/rB17dbdcc552bfb96441a8fd3c57a4787378e5a549

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.

===================================================================

M	source/blender/windowmanager/intern/wm_keymap_utils.c

===================================================================

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



More information about the Bf-blender-cvs mailing list