diff options
author | Nathan Craddock <Zachman> | 2019-03-28 19:54:35 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-03-28 22:02:59 +0300 |
commit | 1ef59026e4a20919cd6822d0b789eed09f25e42b (patch) | |
tree | 8c05687f2fd133937242e6abe420e1de179e4595 | |
parent | 56428a46b9ae0f82b37ee041849bb7847b9afabb (diff) |
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
-rw-r--r-- | release/datafiles/userdef/userdef_default_theme.c | 2 | ||||
-rw-r--r-- | release/scripts/presets/interface_theme/blender_light.xml | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_blender_version.h | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 8 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_userdef.c | 4 | ||||
-rw-r--r-- | source/blender/editors/include/UI_resources.h | 1 | ||||
-rw-r--r-- | source/blender/editors/interface/resources.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_ops.c | 56 |
8 files changed, 52 insertions, 33 deletions
diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c index 463b7f5919f..6f9f2a98a6a 100644 --- a/release/datafiles/userdef/userdef_default_theme.c +++ b/release/datafiles/userdef/userdef_default_theme.c @@ -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), }, diff --git a/release/scripts/presets/interface_theme/blender_light.xml b/release/scripts/presets/interface_theme/blender_light.xml index 5ca74524398..fbdf82f77ab 100644 --- a/release/scripts/presets/interface_theme/blender_light.xml +++ b/release/scripts/presets/interface_theme/blender_light.xml @@ -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" diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 62934b702f8..66d0c3c4cac 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -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 diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index c4775b77eee..522d036818d 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -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. */ + } } diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index ee6b0ab9533..5bff0cd1c93 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -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 diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 85b2ccf2077..ae2f0269a9c 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -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]); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index e39f244fd40..72739b99e14 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -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; diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 4f7e0f70ad9..0abad05cc76 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -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 */ |