UI: show tool name in tip w/ icon-only display
authorCampbell Barton <ideasman42@gmail.com>
Tue, 4 Sep 2018 04:37:19 +0000 (14:37 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 4 Sep 2018 04:37:19 +0000 (14:37 +1000)
source/blender/editors/interface/interface_region_tooltip.c

index 762fc3a946d4c3dba4d9a6af558ff5914f4c3aa6..6f78fb09ff149638f3da6971e0b944f63c71b3e4 100644 (file)
@@ -390,6 +390,17 @@ static uiTooltipData *ui_tooltip_data_from_tool(bContext *C, uiBut *but)
         * doesn't have access to information about non-active tools.
         */
 
+       /* Title (when icon-only). */
+       if (but->drawstr[0] == '\0') {
+               uiTooltipField *field = text_field_add(
+                       data, &(uiTooltipFormat){
+                           .style = UI_TIP_STYLE_NORMAL,
+                           .color_id = UI_TIP_LC_MAIN,
+                           .is_pad = true,
+                       });
+               field->text = BLI_strdup(tool_name);
+       }
+
        /* Tip. */
        {
                const char *expr_imports[] = {"bpy", "bl_ui", NULL};