diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 072362492d8..9ef71f23e79 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1355,56 +1355,51 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) const int category_tabs_width = round_fl_to_int(UI_PANEL_CATEGORY_MARGIN_WIDTH * zoom); const float dpi_fac = UI_DPI_FAC; /* Padding of tabs around text. */ const int tab_v_pad_text = round_fl_to_int(TABS_PADDING_TEXT_FACTOR * dpi_fac * zoom) + 2 * px; /* Padding between tabs. */ const int tab_v_pad = round_fl_to_int(TABS_PADDING_BETWEEN_FACTOR * dpi_fac * zoom); bTheme *btheme = UI_GetTheme(); const float tab_curve_radius = btheme->tui.wcol_tab.roundness * U.widget_unit * zoom; const int roundboxtype = is_left ? (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) : (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT); - bool is_alpha; bool do_scaletabs = false; #ifdef USE_FLAT_INACTIVE bool is_active_prev = false; #endif float scaletabs = 1.0f; /* Same for all tabs. */ /* Intentionally don't scale by 'px'. */ const int rct_xmin = is_left ? v2d->mask.xmin + 3 : (v2d->mask.xmax - category_tabs_width); const int rct_xmax = is_left ? v2d->mask.xmin + category_tabs_width : (v2d->mask.xmax - 3); const int text_v_ofs = (rct_xmax - rct_xmin) * 0.3f; int y_ofs = tab_v_pad; /* Primary theme colors. */ - uchar theme_col_back[4]; uchar theme_col_text[3]; uchar theme_col_text_hi[3]; /* Tab colors. */ uchar theme_col_tab_bg[4]; float theme_col_tab_active[4]; float theme_col_tab_inactive[4]; float theme_col_tab_outline[4]; - UI_GetThemeColor4ubv(TH_BACK, theme_col_back); UI_GetThemeColor3ubv(TH_TEXT, theme_col_text); UI_GetThemeColor3ubv(TH_TEXT_HI, theme_col_text_hi); UI_GetThemeColor4ubv(TH_TAB_BACK, theme_col_tab_bg); UI_GetThemeColor4fv(TH_TAB_ACTIVE, theme_col_tab_active); UI_GetThemeColor4fv(TH_TAB_INACTIVE, theme_col_tab_inactive); UI_GetThemeColor4fv(TH_TAB_OUTLINE, theme_col_tab_outline); - is_alpha = (region->overlap && (theme_col_back[3] != 255)); - BLF_enable(fontid, BLF_ROTATION); BLF_rotation(fontid, M_PI_2); // UI_fontstyle_set(&style->widget); ui_fontscale(&fstyle_points, aspect / (U.pixelsize * 1.1f)); BLF_size(fontid, fstyle_points, U.dpi); /* Check the region type supports categories to avoid an assert * for showing 3D view panels in the properties space. */ if ((1 << region->regiontype) & RGN_TYPE_HAS_CATEGORY_MASK) { BLI_assert(UI_panel_category_is_visible(region)); @@ -1433,49 +1428,48 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) rcti *rct = &pc_dyn->rect; rct->ymin = ((rct->ymin - v2d->mask.ymax) * scaletabs) + v2d->mask.ymax; rct->ymax = ((rct->ymax - v2d->mask.ymax) * scaletabs) + v2d->mask.ymax; } do_scaletabs = true; } /* Begin drawing. */ GPU_line_smooth(true); - - uint pos = GPU_vertformat_attr_add( - immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + uint pos; /* Draw the background. */ - if (is_alpha) { - GPU_blend(GPU_BLEND_ALPHA); - immUniformColor4ubv(theme_col_tab_bg); - } - else { + if (!region->overlap) { + pos = GPU_vertformat_attr_add( + immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immUniformColor3ubv(theme_col_tab_bg); - } - if (is_left) { - immRecti( - pos, v2d->mask.xmin, v2d->mask.ymin, v2d->mask.xmin + category_tabs_width, v2d->mask.ymax); - } - else { - immRecti( - pos, v2d->mask.xmax - category_tabs_width, v2d->mask.ymin, v2d->mask.xmax, v2d->mask.ymax); - } + if (is_left) { + immRecti(pos, + v2d->mask.xmin, + v2d->mask.ymin, + v2d->mask.xmin + category_tabs_width, + v2d->mask.ymax); + } + else { + immRecti(pos, + v2d->mask.xmax - category_tabs_width, + v2d->mask.ymin, + v2d->mask.xmax, + v2d->mask.ymax); + } - if (is_alpha) { - GPU_blend(GPU_BLEND_NONE); + immUnbindProgram(); } - immUnbindProgram(); - LISTBASE_FOREACH (PanelCategoryDyn *, pc_dyn, ®ion->panels_category) { const rcti *rct = &pc_dyn->rect; const char *category_id = pc_dyn->idname; const char *category_id_draw = IFACE_(category_id); const int category_width = BLI_rcti_size_y(rct) - (tab_v_pad_text * 2); size_t category_draw_len = BLF_DRAW_STR_DUMMY_MAX; #if 0 int category_width = BLF_width(fontid, category_id_draw, BLF_DRAW_STR_DUMMY_MAX); #endif @@ -1499,21 +1493,21 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) rct->ymax + (px * 3)); immUnbindProgram(); } is_active_prev = is_active; if (is_active) #endif { /* Draw filled rectangle and outline for tab. */ - UI_draw_roundbox_corner_set(roundboxtype); + UI_draw_roundbox_corner_set(region->overlap ? UI_CNR_ALL : roundboxtype); UI_draw_roundbox_4fv( &(const rctf){ .xmin = rct->xmin, .xmax = rct->xmax, .ymin = rct->ymin, .ymax = rct->ymax, }, true, tab_curve_radius, is_active ? theme_col_tab_active : theme_col_tab_inactive); @@ -1522,31 +1516,33 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) .xmin = rct->xmin, .xmax = rct->xmax, .ymin = rct->ymin, .ymax = rct->ymax, }, false, tab_curve_radius, theme_col_tab_outline); /* Disguise the outline on one side to join the tab to the panel. */ - pos = GPU_vertformat_attr_add( - immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - - immUniformColor4fv(is_active ? theme_col_tab_active : theme_col_tab_inactive); - immRecti(pos, - is_left ? rct->xmax - px : rct->xmin, - rct->ymin + px, - is_left ? rct->xmax : rct->xmin + px, - rct->ymax - px); - immUnbindProgram(); + if (!region->overlap) { + pos = GPU_vertformat_attr_add( + immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + + immUniformColor4fv(is_active ? theme_col_tab_active : theme_col_tab_inactive); + immRecti(pos, + is_left ? rct->xmax - px : rct->xmin, + rct->ymin + px, + is_left ? rct->xmax : rct->xmin + px, + rct->ymax - px); + immUnbindProgram(); + } } /* Tab titles. */ if (do_scaletabs) { category_draw_len = BLF_width_to_strlen( fontid, category_id_draw, category_draw_len, category_width, NULL); } BLF_position(fontid, rct->xmax - text_v_ofs, rct->ymin + tab_v_pad_text, 0.0f);