From 479ce00809af30167a88525cdc7cddc704ed67ba Mon Sep 17 00:00:00 2001 From: Red Mser Date: Wed, 26 Aug 2020 16:53:58 -0500 Subject: UI: Use alternating row theme color in file browser The outliner already uses the alternating row theme color as an overlay for every other row. This uses the same color for the file browser, instead of a hardcoded shading. The file browser background color is slightly tweaked to match the outliner, and the Blender Light theme is updated to use a lighter background color like the outliner. Reviewed by: Hans Goudey, Julian Eisel Differential Revision: https://developer.blender.org/D8717 --- source/blender/blenloader/intern/versioning_userdef.c | 5 +++++ source/blender/editors/space_file/file_draw.c | 4 +++- source/blender/makesrna/intern/rna_userdef.c | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index 1437d46bd8d..d04907872b7 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -228,6 +228,11 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme) */ { /* Keep this block, even when empty. */ + + /* The new defaults for the file browser theme are the same as + * the outliner's, and it's less disruptive to just copy them. */ + copy_v4_v4_uchar(btheme->space_file.back, btheme->space_outliner.back); + copy_v4_v4_uchar(btheme->space_file.row_alternate, btheme->space_outliner.row_alternate); } #undef FROM_DEFAULT_V4_UCHAR diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 51e6c99ff39..7039eba7db1 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -441,7 +441,9 @@ static void draw_background(FileLayout *layout, View2D *v2d) uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immUniformThemeColorShade(TH_BACK, -7); + float col_alternating[4]; + UI_GetThemeColor4fv(TH_ROW_ALTERNATE, col_alternating); + immUniformThemeColorBlend(TH_BACK, TH_ROW_ALTERNATE, col_alternating[3]); /* alternating flat shade background */ for (i = 2; (i <= layout->rows + 1); i += 2) { diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 2cee99cd372..699e08302e7 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2478,6 +2478,11 @@ static void rna_def_userdef_theme_space_file(BlenderRNA *brna) RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Selected File", ""); RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); + + prop = RNA_def_property(srna, "row_alternate", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Alternate Rows", "Overlay color on every other row"); + RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); } static void rna_def_userdef_theme_space_outliner(BlenderRNA *brna) -- cgit v1.2.3