[Bf-blender-cvs] [c679e8ac954] soc-2020-info-editor: UI: Use theme setting for alternating row in info editor
Mateusz GrzeliÅski
noreply at git.blender.org
Sat Jun 6 23:57:57 CEST 2020
Commit: c679e8ac9549edbc025dee0d68b117b4dc76b8a0
Author: Mateusz Grzeliński
Date: Sat Jun 6 23:57:22 2020 +0200
Branches: soc-2020-info-editor
https://developer.blender.org/rBc679e8ac9549edbc025dee0d68b117b4dc76b8a0
UI: Use theme setting for alternating row in info editor
Makes it consistent with outliner
===================================================================
M release/datafiles/userdef/userdef_default_theme.c
M source/blender/editors/include/UI_resources.h
M source/blender/editors/interface/resources.c
M source/blender/editors/space_info/info_draw.c
M source/blender/makesrna/intern/rna_userdef.c
===================================================================
diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c
index 3f81e230a57..286ce03305f 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -484,6 +484,7 @@ const bTheme U_theme_default = {
.outline_width = 1,
.facedot_size = 4,
.info_selected = RGBA(0x223A5Bff),
+ .row_alternate = RGBA(0xffffff07),
.info_active = RGBA(0x3B5689ff),
.info_selected_text = RGBA(0xffffffff),
.info_error = RGBA(0xff613dff),
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index c26df3a75e3..a8127b9c75d 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -372,6 +372,7 @@ int UI_GetThemeValueType(int colorid, int spacetype);
// get three color values, scaled to 0.0-1.0 range
void UI_GetThemeColor3fv(int colorid, float col[3]);
void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3]);
+void UI_GetThemeColorBlend4ubv(int colorid1, int colorid2, float fac, unsigned char col[4]);
void UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[3]);
void UI_GetThemeColorBlend4f(int colorid1, int colorid2, float fac, float r_col[4]);
// get the color, range 0.0-1.0, complete with shading offset
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 78c4caa6937..3e1e5c6b002 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1124,6 +1124,18 @@ void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, uchar col[
col[2] = floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
}
+void UI_GetThemeColorBlend4ubv(int colorid1, int colorid2, float fac, uchar col[4])
+{
+ const uchar *cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
+ const uchar *cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
+
+ CLAMP(fac, 0.0f, 1.0f);
+ col[0] = floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
+ col[1] = floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
+ col[2] = floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
+ col[3] = floorf((1.0f - fac) * cp1[3] + fac * cp2[3]);
+}
+
void UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[3])
{
const uchar *cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index 1ea660f3886..ca1a3c34fa7 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -57,16 +57,19 @@ static enum eTextViewContext_LineFlag report_line_data(TextViewContext *tvc,
UI_GetThemeColor4ubv((report->flag & SELECT) ? TH_INFO_SELECTED_TEXT : TH_TEXT, fg);
/* Zebra striping for background, only for deselected reports. */
- int bg_id, shade;
if (report->flag & SELECT) {
- bg_id = (report == active_report) ? TH_INFO_ACTIVE : TH_INFO_SELECTED;
- shade = 0;
+ int bg_id = (report == active_report) ? TH_INFO_ACTIVE : TH_INFO_SELECTED;
+ UI_GetThemeColor4ubv(bg_id, bg);
}
else {
- bg_id = TH_BACK;
- shade = (tvc->iter_tmp % 2) ? 4 : -4;
+ if (tvc->iter_tmp % 2) {
+ UI_GetThemeColor4ubv(TH_BACK, bg);
+ } else {
+ float col_alternating[4];
+ UI_GetThemeColor4fv(TH_ROW_ALTERNATE, col_alternating);
+ UI_GetThemeColorBlend4ubv(TH_BACK, TH_ROW_ALTERNATE, col_alternating[3], bg);
+ }
}
- UI_GetThemeColorShade4ubv(bg_id, shade, bg);
/* Icon color and backgound depend of report type. */
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 41c41a0dc93..6c94801bfb4 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2610,6 +2610,11 @@ static void rna_def_userdef_theme_space_info(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Active Line Background", "Background color of active line");
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");
+
prop = RNA_def_property(srna, "info_selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Selected Line Text Color", "Text color of selected line");
More information about the Bf-blender-cvs
mailing list