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
This commit is contained in:
Erik Abrahamsson 2020-11-25 16:37:33 -05:00 committed by Hans Goudey
parent 05c4efc9b1
commit f7223d5f72
Notes: blender-bot 2023-02-14 06:23:08 +01:00
Referenced by issue #83094, The alternate rows in the Sequencer are green (macOS)
5 changed files with 15 additions and 5 deletions

View File

@ -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),

View File

@ -818,6 +818,7 @@
metadatabg="#000000"
metadatatext="#ffffff"
preview_range="#a14d0066"
row_alternate = "#ffffff0d"
>
<space>
<ThemeSpaceGeneric

View File

@ -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

View File

@ -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);

View File

@ -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)