Theme: add color difference for every other row

D4862 by @CandleComet with minor edits.
This commit is contained in:
Campbell Barton 2019-05-16 11:54:50 +10:00
parent 2384564149
commit 68c12c80e5
9 changed files with 23 additions and 3 deletions

View File

@ -749,6 +749,7 @@ const bTheme U_theme_default = {
.facedot_size = 4,
.match = RGBA(0x337f334c),
.selected_highlight = RGBA(0x314e784c),
.row_alternate = RGBA(0x91919110),
},
.space_node = {
.back = RGBA(0x23232300),

View File

@ -983,6 +983,7 @@
<ThemeOutliner
match="#337f33"
selected_highlight="#314e78"
row_alternate="#3f3f3f1a"
>
<space>
<ThemeSpaceGeneric

View File

@ -27,7 +27,7 @@
* \note Use #STRINGIFY() rather than defining with quotes.
*/
#define BLENDER_VERSION 280
#define BLENDER_SUBVERSION 64
#define BLENDER_SUBVERSION 65
/** Several breakages with 280, e.g. collections vs layers. */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0

View File

@ -134,6 +134,10 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
FROM_DEFAULT_V4_UCHAR(space_clip.scrubbing_background);
}
if (!USER_VERSION_ATLEAST(280, 65)) {
FROM_DEFAULT_V4_UCHAR(space_outliner.row_alternate);
}
/**
* Include next version bump.
*/

View File

@ -255,6 +255,7 @@ typedef enum ThemeColorID {
TH_MATCH, /* highlight color for search matches */
TH_SELECT_HIGHLIGHT, /* highlight color for selected outliner item */
TH_ROW_ALTERNATE, /* overlay on every other row */
TH_SKIN_ROOT,

View File

@ -795,6 +795,10 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
cp = ts->selected_highlight;
break;
case TH_ROW_ALTERNATE:
cp = ts->row_alternate;
break;
case TH_SKIN_ROOT:
cp = ts->skin_root;
break;

View File

@ -3198,7 +3198,10 @@ static void outliner_back(ARegion *ar)
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColorShade(TH_BACK, 6);
float col_alternating[4];
UI_GetThemeColor4fv(TH_ROW_ALTERNATE, col_alternating);
immUniformThemeColorBlend(TH_BACK, TH_ROW_ALTERNATE, col_alternating[3]);
const float x1 = 0.0f, x2 = ar->v2d.cur.xmax;
float y1 = ystart, y2;

View File

@ -363,6 +363,8 @@ typedef struct ThemeSpace {
char match[4];
/** Outliner - selected item. */
char selected_highlight[4];
/** Outliner - row color difference. */
char row_alternate[4];
/** Skin modifier root color. */
char skin_root[4];
@ -374,7 +376,6 @@ typedef struct ThemeSpace {
char anim_non_active[4];
/** Preview range overlay. */
char anim_preview_range[4];
char _pad2[4];
/** NLA 'Tweaking' action/strip. */
char nla_tweaking[4];

View File

@ -2235,6 +2235,11 @@ static void rna_def_userdef_theme_space_outliner(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Selected Highlight", "");
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_userpref(BlenderRNA *brna)