[Bf-blender-cvs] [64c7b2a] master: UI: show ttips even if disabled, when holding alt key.

Bastien Montagne noreply at git.blender.org
Sat Aug 9 22:08:59 CEST 2014


Commit: 64c7b2a122d6099efa8f298866b37239a18bb9bf
Author: Bastien Montagne
Date:   Sat Aug 9 22:04:55 2014 +0200
Branches: master
https://developer.blender.org/rB64c7b2a122d6099efa8f298866b37239a18bb9bf

UI: show ttips even if disabled, when holding alt key.

Patch by @sambler (Shane Ambler), with minor edits by myself (see also D727, T24055).
Reviewed feature-side by @carter2422 (Jonathan Williamson).

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

M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 139e243..d7b4f75 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -178,6 +178,7 @@ enum {
 	UI_BUT_DRAG_MULTI    = (1 << 25),  /* edit this button as well as the active button (not just dragging) */
 	UI_BUT_SCA_LINK_GREY = (1 << 26),  /* used to flag if sca links shoud be grey out */
 	UI_BUT_HAS_SEP_CHAR  = (1 << 27),  /* but->str contains UI_SEP_CHAR, used for key shortcuts */
+	UI_OPTION_TOOLTIPS   = (1 << 28),  /* force show tooltips when holding option/alt if U's USER_TOOLTIPS is off */
 };
 
 #define UI_PANEL_WIDTH          340
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 1cf704e..68148d3 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -6656,7 +6656,7 @@ static void button_tooltip_timer_reset(bContext *C, uiBut *but)
 		data->tooltiptimer = NULL;
 	}
 
-	if (U.flag & USER_TOOLTIPS)
+	if ((U.flag & USER_TOOLTIPS) || (but->flag & UI_OPTION_TOOLTIPS))
 		if (!but->block->tooltipdisabled)
 			if (!wm->drags.first)
 				data->tooltiptimer = WM_event_add_timer(data->wm, data->window, TIMER, BUTTON_TOOLTIP_DELAY);
@@ -7168,6 +7168,11 @@ static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *ar)
 	if (event->type == MOUSEMOVE) {
 		but = ui_but_find_mouse_over(ar, event);
 		if (but) {
+			if (event->alt)
+				/* display tooltips if holding alt on mouseover when tooltips are off in prefs */
+				but->flag |= UI_OPTION_TOOLTIPS;
+			else
+				but->flag &= ~UI_OPTION_TOOLTIPS;
 			button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
 		}
 	}
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 8125870..1295829 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3154,7 +3154,7 @@ static void rna_def_userdef_view(BlenderRNA *brna)
 	/* display */
 	prop = RNA_def_property(srna, "show_tooltips", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TOOLTIPS);
-	RNA_def_property_ui_text(prop, "Tooltips", "Display tooltips");
+	RNA_def_property_ui_text(prop, "Tooltips", "Display tooltips (when off hold Alt to force display)");
 
 	prop = RNA_def_property(srna, "show_tooltips_python", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_TOOLTIPS_PYTHON);




More information about the Bf-blender-cvs mailing list