From b9dbcf406e834a0673fc5586e83c91c781bbbc6c Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 7 Jul 2016 17:03:30 +0200 Subject: 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. --- source/blender/windowmanager/intern/wm_keymap.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to '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 72b26cc6207..184ff09a76e 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")) { -- cgit v1.2.3