diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-05-27 05:24:29 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-05-27 05:24:29 +0300 |
commit | 7ed7901c00867a951bd2bb0e179d7b087cd68d9d (patch) | |
tree | e56516b474129832741940db72cea13bcc933522 | |
parent | 43af0f4d16edce82faa2ea8e01dd4eca68594346 (diff) |
Gizmo: add flag to disable tooltip
For some gizmos that follow the mouse cursor, this gets in the way.
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_gizmo.c | 8 | ||||
-rw-r--r-- | source/blender/windowmanager/gizmo/WM_gizmo_types.h | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c index 826d4039c55..d4ac7f64941 100644 --- a/source/blender/makesrna/intern/rna_wm_gizmo.c +++ b/source/blender/makesrna/intern/rna_wm_gizmo.c @@ -407,6 +407,7 @@ RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_operator_tool_properties, flag, WM_GIZMO_OPERATOR_TOOL_INIT); RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_event_handle_all, flag, WM_GIZMO_EVENT_HANDLE_ALL); +RNA_GIZMO_GENERIC_FLAG_NEG_RW_DEF(flag_use_tooltip, flag, WM_GIZMO_NO_TOOLTIP); /* wmGizmo.state */ RNA_GIZMO_FLAG_RO_DEF(state_is_highlight, state, WM_GIZMO_STATE_HIGHLIGHT); @@ -1271,6 +1272,13 @@ static void rna_def_gizmo(BlenderRNA *brna, PropertyRNA *cprop) "do not pass events through to be handled by other keymaps"); RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); + /* WM_GIZMO_NO_TOOLTIP (negated) */ + prop = RNA_def_property(srna, "use_tooltip", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs( + prop, "rna_Gizmo_flag_use_tooltip_get", "rna_Gizmo_flag_use_tooltip_set"); + RNA_def_property_ui_text(prop, "Use Tooltip", "Use tool-tips when hovering over this gizmo"); + /* No update needed. */ + /* wmGizmo.state (readonly) */ /* WM_GIZMO_STATE_HIGHLIGHT */ prop = RNA_def_property(srna, "is_highlight", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.h b/source/blender/windowmanager/gizmo/WM_gizmo_types.h index 955fb959e92..e79031193c2 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_types.h +++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.h @@ -89,6 +89,9 @@ typedef enum eWM_GizmoFlag { /** 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), + + /** Don't use tool-tips for this gizmo (can be distracting). */ + WM_GIZMO_NO_TOOLTIP = (1 << 11), } eWM_GizmoFlag; /** diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 0da82881ba3..54498b21369 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2590,7 +2590,7 @@ static int wm_handlers_do_gizmo_handler(bContext *C, if (wm_gizmomap_highlight_set(gzmap, C, gz, part)) { if (gz != NULL) { - if (U.flag & USER_TOOLTIPS) { + if ((U.flag & USER_TOOLTIPS) && (gz->flag & WM_GIZMO_NO_TOOLTIP) == 0) { WM_tooltip_timer_init(C, CTX_wm_window(C), area, region, WM_gizmomap_tooltip_init); } } |