diff options
author | Erik Abrahamsson <erik85> | 2020-11-26 00:37:33 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-11-26 00:37:33 +0300 |
commit | f7223d5f722ac430041a748248b45c8590c3ffad (patch) | |
tree | c07aafdfbc7086a68779e983d680e44118605a0c | |
parent | 05c4efc9b1993f4d11a7d749fe4a9e9d80cc1f2e (diff) |
UI: Allow theming the alternate row color in the sequencer
Previously, the alternate row color in the Video Sequence Editor was
just a shaded version of the editor's background color. This makes it
theme-able just like in the file browser and outliner, although the
default color is very slightly different.
Differential Revision: https://developer.blender.org/D9634
5 files changed, 15 insertions, 5 deletions
diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c index bdbd8386856..bd0c1fccb98 100644 --- a/release/datafiles/userdef/userdef_default_theme.c +++ b/release/datafiles/userdef/userdef_default_theme.c @@ -663,6 +663,7 @@ const bTheme U_theme_default = { .gp_vertex_select = RGBA(0xff8500ff), .anim_preview_range = RGBA(0xa14d0066), .metadatatext = RGBA(0xffffffff), + .row_alternate = RGBA(0xffffff0d), }, .space_image = { .back = RGBA(0x44444400), diff --git a/release/scripts/presets/interface_theme/blender_light.xml b/release/scripts/presets/interface_theme/blender_light.xml index 7c9b769e806..fd80c6b27a5 100644 --- a/release/scripts/presets/interface_theme/blender_light.xml +++ b/release/scripts/presets/interface_theme/blender_light.xml @@ -818,6 +818,7 @@ metadatabg="#000000" metadatatext="#ffffff" preview_range="#a14d0066" + row_alternate = "#ffffff0d" > <space> <ThemeSpaceGeneric diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index 5aa0e46aa46..d9940cc809f 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -260,6 +260,7 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme) for (int i = 0; i < COLLECTION_COLOR_TOT; ++i) { FROM_DEFAULT_V4_UCHAR(collection_color[i].color); } + FROM_DEFAULT_V4_UCHAR(space_sequencer.row_alternate); } #undef FROM_DEFAULT_V4_UCHAR diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 8ac562f0ae0..081714991ff 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -566,8 +566,7 @@ static void draw_seq_outline(Sequence *seq, } else { /* Color for unselected strips is a bit darker than the background. */ - UI_GetThemeColor3ubv(TH_BACK, col); - UI_GetColorPtrShade3ubv(col, col, -40); + UI_GetThemeColorShade3ubv(TH_BACK, -40, col); } /* Outline while translating strips: @@ -1859,16 +1858,19 @@ static void draw_seq_backdrop(View2D *v2d) uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - /* Darker gray overlay over the view backdrop. */ + /* Darker overlay over the view backdrop. */ immUniformThemeColorShade(TH_BACK, -20); immRectf(pos, v2d->cur.xmin, -1.0, v2d->cur.xmax, 1.0); /* Alternating horizontal stripes. */ i = max_ii(1, ((int)v2d->cur.ymin) - 1); + float col_alternating[4]; + UI_GetThemeColor4fv(TH_ROW_ALTERNATE, col_alternating); + while (i < v2d->cur.ymax) { if (i & 1) { - immUniformThemeColorShade(TH_BACK, -15); + immUniformThemeColorBlendShade(TH_BACK, TH_ROW_ALTERNATE, col_alternating[3], -25); } else { immUniformThemeColorShade(TH_BACK, -25); @@ -1879,7 +1881,7 @@ static void draw_seq_backdrop(View2D *v2d) i++; } - /* Darker lines separating the horizontal bands. */ + /* Lines separating the horizontal bands. */ i = max_ii(1, ((int)v2d->cur.ymin) - 1); int line_len = (int)v2d->cur.ymax - i + 1; immUniformThemeColor(TH_GRID); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 6ddc2e3ef57..08912e11146 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -3246,6 +3246,11 @@ static void rna_def_userdef_theme_space_seq(BlenderRNA *brna) RNA_def_property_array(prop, 4); RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay"); 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_action(BlenderRNA *brna) |