[Bf-blender-cvs] [3276b83] master: UI: support for alpha tab background

Campbell Barton noreply at git.blender.org
Sat Feb 8 15:39:21 CET 2014


Commit: 3276b83fda1e49bd007872c8dcd0f1b4c62063a3
Author: Campbell Barton
Date:   Sun Feb 9 01:38:20 2014 +1100
https://developer.blender.org/rB3276b83fda1e49bd007872c8dcd0f1b4c62063a3

UI: support for alpha tab background

===================================================================

M	source/blender/editors/interface/interface_panel.c
M	source/blender/makesrna/intern/rna_userdef.c

===================================================================

diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 071a2b4..362df8b 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -1404,6 +1404,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
 	const int tab_v_pad = iroundf((4 + (2 * px * dpi_fac)) * zoom);  /* padding between tabs */
 	const float tab_curve_radius = ((px * 3) * dpi_fac) * zoom;
 	const int roundboxtype = UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT;
+	bool is_alpha;
 	bool do_scaletabs = false;
 #ifdef USE_FLAT_INACTIVE
 	bool is_active_prev = false;
@@ -1447,6 +1448,8 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
 	blend_color_interpolate_byte(theme_col_tab_highlight, theme_col_back, theme_col_text_hi, 0.2f);
 	blend_color_interpolate_byte(theme_col_tab_highlight_inactive, theme_col_tab_inactive, theme_col_text_hi, 0.12f);
 
+	is_alpha = (ar->overlap && (theme_col_back[3] != 255));
+
 	if (fstyle->kerning == 1) {
 		BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
 	}
@@ -1497,9 +1500,20 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
 	glEnable(GL_LINE_SMOOTH);
 
 	/* draw the background */
-	glColor3ubv(theme_col_tab_bg);
+	if (is_alpha) {
+		glEnable(GL_BLEND);
+		glColor4ubv(theme_col_tab_bg);
+	}
+	else {
+		glColor3ubv(theme_col_tab_bg);
+	}
+
 	glRecti(v2d->mask.xmin, v2d->mask.ymin, v2d->mask.xmin + category_tabs_width, v2d->mask.ymax);
 
+	if (is_alpha) {
+		glDisable(GL_BLEND);
+	}
+
 	for (pc_dyn = ar->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) {
 		const rcti *rct = &pc_dyn->rect;
 		const char *category_id = pc_dyn->idname;
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index c851acd..da2c801 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1091,7 +1091,7 @@ static void rna_def_userdef_theme_space_common(StructRNA *srna)
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
 	prop = RNA_def_property(srna, "tab_back", PROP_FLOAT, PROP_COLOR_GAMMA);
-	RNA_def_property_array(prop, 3);
+	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Tab Background", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");




More information about the Bf-blender-cvs mailing list