Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-02-08 18:38:20 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-08 18:39:09 +0400
commit3276b83fda1e49bd007872c8dcd0f1b4c62063a3 (patch)
tree3e5290b90c4469a74f7d2a5f628388bbb8304758
parent6952bf2728c11be9e3f3910c4ca3c752561cdd08 (diff)
UI: support for alpha tab background
-rw-r--r--source/blender/editors/interface/interface_panel.c16
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c2
2 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 071a2b4bb65..362df8b3d12 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 c851acd64d9..da2c8017178 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");