UI: move reports / job back to status bar, but make it more visible with color.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -118,8 +118,7 @@ typedef struct ReportList {
|
||||
#
|
||||
#
|
||||
typedef struct ReportTimerInfo {
|
||||
float col[3];
|
||||
float grayscale;
|
||||
float col[4];
|
||||
float widthfac;
|
||||
} ReportTimerInfo;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user