[Bf-blender-cvs] [b9dbcf4] master: Fix T48802 Unwrap buttons, can't add hotkey in 3DView's UV Unwrap menu.

Bastien Montagne noreply at git.blender.org
Thu Jul 7 17:10:09 CEST 2016


Commit: b9dbcf406e834a0673fc5586e83c91c781bbbc6c
Author: Bastien Montagne
Date:   Thu Jul 7 17:03:30 2016 +0200
Branches: master
https://developer.blender.org/rBb9dbcf406e834a0673fc5586e83c91c781bbbc6c

Fix T48802 Unwrap buttons, can't add hotkey in 3DView's UV Unwrap menu.

Those unwrap operators are a bit tricky, some are available from both 3DView and UVEditor, others only from 3DView...

Hacked around this by returning Mesh keymap for UV_OT ops for specific 3DView/MeshEditMode context.

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

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

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

diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 72b26cc..184ff09 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -1787,7 +1787,17 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
 	}
 	/* UV Editor */
 	else if (STRPREFIX(opname, "UV_OT")) {
-		km = WM_keymap_find_all(C, "UV Editor", 0, 0);
+		/* Hack to allow using UV unwrapping ops from 3DView/editmode.
+		 * Mesh keymap is probably not ideal, but best place I could find to put those. */
+		if (sl->spacetype == SPACE_VIEW3D) {
+			km = WM_keymap_find_all(C, "Mesh", 0, 0);
+			if (km && km->poll && !km->poll(C)) {
+				km = NULL;
+			}
+		}
+		if (!km) {
+			km = WM_keymap_find_all(C, "UV Editor", 0, 0);
+		}
 	}
 	/* Node Editor */
 	else if (STRPREFIX(opname, "NODE_OT")) {




More information about the Bf-blender-cvs mailing list