diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-10-19 18:14:27 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-10-19 18:19:03 +0300 |
commit | b2d495c2de61b7a32be8cdb81e4a65b60f6ff8c7 (patch) | |
tree | 2db30d784c8bbc8dd76152e6428451d8c916a947 | |
parent | be52fd0d0fb0add1724600f162cde1219f3bdb7e (diff) |
UI: move reports / job back to status bar, but make it more visible with color.
-rw-r--r-- | release/scripts/startup/bl_ui/space_statusbar.py | 19 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_topbar.py | 17 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 9 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_ops.c | 32 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_windowmanager_types.h | 3 |
6 files changed, 39 insertions, 42 deletions
diff --git a/release/scripts/startup/bl_ui/space_statusbar.py b/release/scripts/startup/bl_ui/space_statusbar.py index 3f4e8879645..2cc5bd94bd7 100644 --- a/release/scripts/startup/bl_ui/space_statusbar.py +++ b/release/scripts/startup/bl_ui/space_statusbar.py @@ -32,6 +32,25 @@ class STATUSBAR_HT_header(Header): layout.separator_spacer() + # messages + layout.template_reports_banner() + + row = layout.row(align=True) + if bpy.app.autoexec_fail is True and bpy.app.autoexec_fail_quiet is False: + row.label(text="Auto-run disabled", icon='ERROR') + if bpy.data.is_saved: + props = row.operator("wm.revert_mainfile", icon='SCREEN_BACK', text="Reload Trusted") + props.use_scripts = True + + row.operator("script.autoexec_warn_clear", text="Ignore") + + # include last so text doesn't push buttons out of the header + row.label(text=bpy.app.autoexec_fail_message) + + layout.template_running_jobs() + + layout.separator_spacer() + # stats scene = context.scene view_layer = context.view_layer diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index a2cf3def077..9fdc7143d11 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -66,23 +66,6 @@ class TOPBAR_HT_upper_bar(Header): window = context.window scene = window.scene - # messages - layout.template_reports_banner() - - row = layout.row(align=True) - if bpy.app.autoexec_fail is True and bpy.app.autoexec_fail_quiet is False: - row.label(text="Auto-run disabled", icon='ERROR') - if bpy.data.is_saved: - props = row.operator("wm.revert_mainfile", icon='SCREEN_BACK', text="Reload Trusted") - props.use_scripts = True - - row.operator("script.autoexec_warn_clear", text="Ignore") - - # include last so text doesn't push buttons out of the header - row.label(text=bpy.app.autoexec_fail_message) - - layout.template_running_jobs() - # Active workspace view-layer is retrieved through window, not through workspace. layout.template_ID(window, "scene", new="scene.new", unlink="scene.delete") diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 6e869a2f902..70e9a33aeae 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -4630,23 +4630,20 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) UI_fontstyle_set(&style->widgetlabel); width = BLF_width(style->widgetlabel.uifont_id, report->message, report->len); width = min_ii((int)(rti->widthfac * width), width); - width = max_ii(width, 10); + width = max_ii(width, 10 * UI_DPI_FAC); /* make a box around the report to make it stand out */ UI_block_align_begin(block); but = uiDefBut(block, UI_BTYPE_ROUNDBOX, 0, "", 0, 0, UI_UNIT_X + 5, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); /* set the report's bg color in but->col - UI_BTYPE_ROUNDBOX feature */ - rgb_float_to_uchar(but->col, rti->col); - but->col[3] = 255; + rgba_float_to_uchar(but->col, rti->col); but = uiDefBut(block, UI_BTYPE_ROUNDBOX, 0, "", UI_UNIT_X + 5, 0, UI_UNIT_X + width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); + rgba_float_to_uchar(but->col, rti->col); UI_block_align_end(block); - UI_GetThemeColorShade3ubv(TH_BACK, 20, but->col); - but->col[3] = 255; - /* icon and report message on top */ icon = UI_icon_from_report_type(report->type); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 4d186b1d940..99022a14b6a 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -3669,6 +3669,7 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED( wcol->inner[0] = but->col[0]; wcol->inner[1] = but->col[1]; wcol->inner[2] = but->col[2]; + wcol->inner[3] = but->col[3]; } rad = wcol->roundness * U.widget_unit; diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 793b1a79b55..ec0084931eb 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -509,8 +509,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), co Report *report; ReportTimerInfo *rti; float progress = 0.0, color_progress = 0.0; - float neutral_col[3] = {0.35, 0.35, 0.35}; - float neutral_gray = 0.6; + float neutral_col[4] = {0.0f, 0.0f, 0.0f, 0.0f}; float timeout = 0.0, color_timeout = 0.0; int send_note = 0; @@ -541,34 +540,33 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), co if (rti->widthfac == 0.0f) { /* initialize colors based on report type */ if (report->type & RPT_ERROR_ALL) { - rti->col[0] = 1.0; - rti->col[1] = 0.2; - rti->col[2] = 0.0; + rti->col[0] = 1.0f; + rti->col[1] = 0.2f; + rti->col[2] = 0.0f; } else if (report->type & RPT_WARNING_ALL) { - rti->col[0] = 1.0; - rti->col[1] = 1.0; - rti->col[2] = 0.0; + rti->col[0] = 1.0f; + rti->col[1] = 1.0f; + rti->col[2] = 0.0f; } else if (report->type & RPT_INFO_ALL) { - rti->col[0] = 0.3; - rti->col[1] = 0.45; - rti->col[2] = 0.7; + rti->col[0] = 0.3f; + rti->col[1] = 0.45f; + rti->col[2] = 0.7f; } - rti->grayscale = 0.75; - rti->widthfac = 1.0; + rti->col[3] = 0.65f; + rti->widthfac = 1.0f; } - progress = (float)reports->reporttimer->duration / timeout; - color_progress = (float)reports->reporttimer->duration / color_timeout; + progress = powf((float)reports->reporttimer->duration / timeout, 2.0f); + color_progress = powf((float)reports->reporttimer->duration / color_timeout, 2.0); /* save us from too many draws */ if (color_progress <= 1.0f) { send_note = 1; /* fade colors out sharply according to progress through fade-out duration */ - interp_v3_v3v3(rti->col, rti->col, neutral_col, color_progress); - rti->grayscale = interpf(neutral_gray, rti->grayscale, color_progress); + interp_v4_v4v4(rti->col, rti->col, neutral_col, color_progress); } /* collapse report at end of timeout */ diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index daa8975bca6..abd35a3cc73 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -118,8 +118,7 @@ typedef struct ReportList { # # typedef struct ReportTimerInfo { - float col[3]; - float grayscale; + float col[4]; float widthfac; } ReportTimerInfo; |