UI: tweak display of report messages in the status bar.

Remove fading away the color, share theme colors with info editor.

Differential Revision: https://developer.blender.org/D4197
This commit is contained in:
Nathan Craddock
2019-03-28 17:54:35 +01:00
committed by Brecht Van Lommel
parent 56428a46b9
commit 1ef59026e4
8 changed files with 52 additions and 33 deletions

View File

@@ -472,7 +472,7 @@ const bTheme U_theme_default = {
.info_error_text = RGBA(0xffffffff),
.info_warning = RGBA(0xb36a00ff),
.info_warning_text = RGBA(0xffffffff),
.info_info = RGBA(0x668000ff),
.info_info = RGBA(0x1d4383ff),
.info_info_text = RGBA(0xffffffff),
.info_debug = RGBA(0xd3d3d3ff),
},

View File

@@ -1017,7 +1017,7 @@
info_error_text="#ffffff"
info_warning="#b36a00"
info_warning_text="#ffffff"
info_info="#668000"
info_info="#4d73b3ff"
info_info_text="#ffffff"
info_debug="#d3d3d3"
info_debug_text="#000000"

View File

@@ -24,7 +24,7 @@
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 280
#define BLENDER_SUBVERSION 51
#define BLENDER_SUBVERSION 52
/* Several breakages with 280, e.g. collections vs layers */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0

View File

@@ -2908,9 +2908,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
{
/* Versioning code until next subversion bump goes here. */
if (!MAIN_VERSION_ATLEAST(bmain, 280, 52)) {
LISTBASE_FOREACH (ParticleSettings *, part, &bmain->particles) {
/* Replace deprecated PART_DRAW_BB by PART_DRAW_NOT */
if (part->ren_as == PART_DRAW_BB) {
@@ -2946,4 +2944,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
} FOREACH_NODETREE_END;
}
{
/* Versioning code until next subversion bump goes here. */
}
}

View File

@@ -110,6 +110,10 @@ static void do_versions_theme(UserDef *userdef, bTheme *btheme)
FROM_DEFAULT_V4_UCHAR(space_view3d.back);
}
if (!USER_VERSION_ATLEAST(280, 52)) {
FROM_DEFAULT_V4_UCHAR(space_info.info_info);
}
#undef FROM_DEFAULT_V4_UCHAR
#undef USER_VERSION_ATLEAST

View File

@@ -366,6 +366,7 @@ void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]);
void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]);
// get a theme color from specified space type
void UI_GetThemeColorType3fv(int colorid, int spacetype, float col[3]);
void UI_GetThemeColorType3ubv(int colorid, int spacetype, unsigned char col[3]);
void UI_GetThemeColorType4ubv(int colorid, int spacetype, unsigned char col[4]);

View File

@@ -1153,6 +1153,16 @@ void UI_GetThemeColor4ubv(int colorid, uchar col[4])
col[3] = cp[3];
}
void UI_GetThemeColorType3fv(int colorid, int spacetype, float col[3])
{
const uchar *cp;
cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
col[0] = ((float)cp[0]) / 255.0f;
col[1] = ((float)cp[1]) / 255.0f;
col[2] = ((float)cp[2]) / 255.0f;
}
void UI_GetThemeColorType3ubv(int colorid, int spacetype, uchar col[3])
{
const uchar *cp;

View File

@@ -498,19 +498,19 @@ void FILE_OT_find_missing_files(wmOperatorType *ot)
*/
#define INFO_TIMEOUT 5.0f
#define INFO_COLOR_TIMEOUT 3.0f
#define ERROR_TIMEOUT 10.0f
#define ERROR_COLOR_TIMEOUT 6.0f
#define FLASH_TIMEOUT 1.0f
#define COLLAPSE_TIMEOUT 0.25f
#define BRIGHTEN_AMOUNT 0.1f
static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
wmWindowManager *wm = CTX_wm_manager(C);
ReportList *reports = CTX_wm_reports(C);
Report *report;
ReportTimerInfo *rti;
float progress = 0.0, color_progress = 0.0;
float neutral_col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
float timeout = 0.0, color_timeout = 0.0;
float target_col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
float progress = 0.0, flash_progress = 0.0;
float timeout = 0.0, flash_timeout = FLASH_TIMEOUT;
int send_note = 0;
/* escape if not our timer */
@@ -525,7 +525,6 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), co
rti = (ReportTimerInfo *)reports->reporttimer->customdata;
timeout = (report->type & RPT_ERROR_ALL) ? ERROR_TIMEOUT : INFO_TIMEOUT;
color_timeout = (report->type & RPT_ERROR_ALL) ? ERROR_COLOR_TIMEOUT : INFO_COLOR_TIMEOUT;
/* clear the report display after timeout */
if ((float)reports->reporttimer->duration > timeout) {
@@ -537,36 +536,39 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), co
return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH);
}
/* set target color based on report type */
if (report->type & RPT_ERROR_ALL) {
UI_GetThemeColorType3fv(TH_INFO_ERROR, SPACE_INFO, target_col);
}
else if (report->type & RPT_WARNING_ALL) {
UI_GetThemeColorType3fv(TH_INFO_WARNING, SPACE_INFO, target_col);
}
else if (report->type & RPT_INFO_ALL) {
UI_GetThemeColorType3fv(TH_INFO_INFO, SPACE_INFO, target_col);
}
target_col[3] = 0.65f;
if (rti->widthfac == 0.0f) {
/* initialize colors based on report type */
if (report->type & RPT_ERROR_ALL) {
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.0f;
rti->col[1] = 1.0f;
rti->col[2] = 0.0f;
}
else if (report->type & RPT_INFO_ALL) {
rti->col[0] = 0.3f;
rti->col[1] = 0.45f;
rti->col[2] = 0.7f;
}
rti->col[3] = 0.65f;
/* initialize color to a brighter shade of the target color */
rti->col[0] = target_col[0] + BRIGHTEN_AMOUNT;
rti->col[1] = target_col[1] + BRIGHTEN_AMOUNT;
rti->col[2] = target_col[2] + BRIGHTEN_AMOUNT;
rti->col[3] = 1.0f;
CLAMP3(rti->col, 0.0, 1.0);
rti->widthfac = 1.0f;
}
progress = powf((float)reports->reporttimer->duration / timeout, 2.0f);
color_progress = powf((float)reports->reporttimer->duration / color_timeout, 2.0);
flash_progress = powf((float)reports->reporttimer->duration / flash_timeout, 2.0);
/* save us from too many draws */
if (color_progress <= 1.0f) {
if (flash_progress <= 1.0f) {
send_note = 1;
/* fade colors out sharply according to progress through fade-out duration */
interp_v4_v4v4(rti->col, rti->col, neutral_col, color_progress);
/* flash report briefly according to progress through fade-out duration */
interp_v4_v4v4(rti->col, rti->col, target_col, flash_progress);
}
/* collapse report at end of timeout */