From d35a33ef723e70f6ca89c2d92da112744e44003c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 28 May 2020 14:28:06 +1000 Subject: Gizmo: add flag for gizmos to ignore keymap events Needed for the snap gizmo not to steal mouse events from the tool. --- source/blender/windowmanager/gizmo/WM_gizmo_types.h | 16 +++++++++------- source/blender/windowmanager/intern/wm_event_system.c | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.h b/source/blender/windowmanager/gizmo/WM_gizmo_types.h index e79031193c2..346ed131c59 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_types.h +++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.h @@ -67,31 +67,33 @@ typedef enum eWM_GizmoFlag { WM_GIZMO_DRAW_VALUE = (1 << 2), WM_GIZMO_HIDDEN = (1 << 3), WM_GIZMO_HIDDEN_SELECT = (1 << 4), + /** Ignore the key-map for this gizmo. */ + WM_GIZMO_HIDDEN_KEYMAP = (1 << 5), /** * When set 'scale_final' value also scales the offset. * Use when offset is to avoid screen-space overlap instead of absolute positioning. */ - WM_GIZMO_DRAW_OFFSET_SCALE = (1 << 5), + WM_GIZMO_DRAW_OFFSET_SCALE = (1 << 6), /** * User should still use 'scale_final' for any handles and UI elements. * This simply skips scale when calculating the final matrix. * Needed when the gizmo needs to align with the interface underneath it. */ - WM_GIZMO_DRAW_NO_SCALE = (1 << 6), + WM_GIZMO_DRAW_NO_SCALE = (1 << 7), /** * Hide the cursor and lock it's position while interacting with this gizmo. */ - WM_GIZMO_MOVE_CURSOR = (1 << 7), + WM_GIZMO_MOVE_CURSOR = (1 << 8), /** Don't write into the depth buffer when selecting. */ - WM_GIZMO_SELECT_BACKGROUND = (1 << 8), + WM_GIZMO_SELECT_BACKGROUND = (1 << 9), /** Use the active tools operator properties when running as an operator. */ - WM_GIZMO_OPERATOR_TOOL_INIT = (1 << 9), + WM_GIZMO_OPERATOR_TOOL_INIT = (1 << 10), /** Don't pass through events to other handlers * (allows click/drag not to have it's events stolen by press events in other keymaps). */ - WM_GIZMO_EVENT_HANDLE_ALL = (1 << 10), + WM_GIZMO_EVENT_HANDLE_ALL = (1 << 11), /** Don't use tool-tips for this gizmo (can be distracting). */ - WM_GIZMO_NO_TOOLTIP = (1 << 11), + WM_GIZMO_NO_TOOLTIP = (1 << 12), } eWM_GizmoFlag; /** diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 54498b21369..e5f288b1963 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2602,7 +2602,7 @@ static int wm_handlers_do_gizmo_handler(bContext *C, if (handle_keymap) { /* Handle highlight gizmo. */ - if (gz != NULL) { + if ((gz != NULL) && (gz->flag & WM_GIZMO_HIDDEN_KEYMAP) == 0) { bool keymap_poll = false; wmGizmoGroup *gzgroup = gz->parent_gzgroup; wmKeyMap *keymap = WM_keymap_active(wm, gz->keymap ? gz->keymap : gzgroup->type->keymap); -- cgit v1.2.3