From 68c12c80e501803f88b62f5f6f0f6a56bb53f303 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 16 May 2019 11:54:50 +1000 Subject: Theme: add color difference for every other row D4862 by @CandleComet with minor edits. --- source/blender/blenkernel/BKE_blender_version.h | 2 +- source/blender/blenloader/intern/versioning_userdef.c | 4 ++++ source/blender/editors/include/UI_resources.h | 1 + source/blender/editors/interface/resources.c | 4 ++++ source/blender/editors/space_outliner/outliner_draw.c | 5 ++++- source/blender/makesdna/DNA_userdef_types.h | 3 ++- source/blender/makesrna/intern/rna_userdef.c | 5 +++++ 7 files changed, 21 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index a36ead4630e..ccf760d891e 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -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 diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index 909334ae26f..574f708764f 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -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. */ diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 7abc27c5b37..7a88cf02679 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -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, diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 14fad2f3072..9f64643a4f0 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -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; diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 6547b46a6e6..9801eba872c 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -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; diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 2247ec2e6ee..43191ec97d7 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -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]; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 38877ba6fdd..367d0af1078 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -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) -- cgit v1.2.3