diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-07 18:03:30 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-07 18:06:53 +0300 |
commit | b9dbcf406e834a0673fc5586e83c91c781bbbc6c (patch) | |
tree | b572a1b6c11f3c8958971667242f92b8a8a3d2c0 /source/blender/windowmanager/intern/wm_keymap.c | |
parent | c8be112523fb0fe2f532ff2351fe3c699e63b544 (diff) |
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.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_keymap.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_keymap.c | 12 |
1 files changed, 11 insertions, 1 deletions
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")) { |