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:
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r--source/blender/editors/interface/interface_panel.c87
1 files changed, 62 insertions, 25 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index a64797af24f..66e9e54ef84 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -1075,13 +1075,14 @@ void UI_panels_draw(const bContext *C, ARegion *region)
void UI_panel_label_offset(const uiBlock *block, int *r_x, int *r_y)
{
Panel *panel = block->panel;
+ const uiStyle *style = UI_style_get();
const bool is_subpanel = (panel->type && panel->type->parent);
- *r_x = UI_UNIT_X * 1.0f;
+ *r_x = UI_UNIT_X * 1.0f + style->panelouter + U.pixelsize;
*r_y = UI_UNIT_Y * 1.5f;
if (is_subpanel) {
- *r_x += (0.7f * UI_UNIT_X);
+ *r_x += style->panelouter;
}
}
@@ -1119,15 +1120,15 @@ static void panel_draw_highlight_border(const Panel *panel,
}
float radius;
+ UI_draw_roundbox_corner_set(UI_CNR_ALL);
+
if (draw_box_style) {
/* Use the theme for box widgets. */
const uiWidgetColors *box_wcol = &UI_GetTheme()->tui.wcol_box;
- UI_draw_roundbox_corner_set(UI_CNR_ALL);
radius = box_wcol->roundness * U.widget_unit;
}
else {
- UI_draw_roundbox_corner_set(UI_CNR_NONE);
- radius = 0.0f;
+ radius = PNL_CNR_RAD;
}
float color[4];
@@ -1160,15 +1161,17 @@ static void panel_draw_aligned_widgets(const uiStyle *style,
/* Offset triangle and text to the right for subpanels. */
const rcti widget_rect = {
- .xmin = header_rect->xmin + (is_subpanel ? scaled_unit * 0.7f : 0),
+ .xmin = header_rect->xmin,
.xmax = header_rect->xmax,
.ymin = header_rect->ymin,
.ymax = header_rect->ymax,
};
uchar title_color[4];
+ uchar collapse_icon_color[4];
panel_title_color_get(panel, show_background, region_search_filter_active, title_color);
- title_color[3] = 255;
+ copy_v4_uchar(collapse_icon_color, *title_color);
+ collapse_icon_color[3] = 100;
/* Draw collapse icon. */
{
@@ -1180,16 +1183,22 @@ static void panel_draw_aligned_widgets(const uiStyle *style,
};
BLI_rctf_scale(&collapse_rect, 0.25f);
- float triangle_color[4];
- rgba_uchar_to_float(triangle_color, title_color);
-
- ui_draw_anti_tria_rect(&collapse_rect, UI_panel_is_closed(panel) ? 'h' : 'v', triangle_color);
+ GPU_blend(GPU_BLEND_ALPHA);
+ UI_icon_draw_ex(collapse_rect.xmin - 5.0f,
+ collapse_rect.ymin - 6.0f / aspect,
+ UI_panel_is_closed(panel) ? ICON_RIGHTARROW : ICON_DOWNARROW_HLT,
+ aspect * U.inv_dpi_fac,
+ 0.5f,
+ 0.0f,
+ collapse_icon_color,
+ false);
+ GPU_blend(GPU_BLEND_NONE);
}
/* Draw text label. */
if (panel->drawname[0] != '\0') {
const rcti title_rect = {
- .xmin = widget_rect.xmin + (panel->labelofs / aspect) + scaled_unit * 1.1f,
+ .xmin = widget_rect.xmin + (panel->labelofs / aspect),
.xmax = widget_rect.xmax,
.ymin = widget_rect.ymin - 2.0f / aspect,
.ymax = widget_rect.ymax,
@@ -1224,12 +1233,12 @@ static void panel_draw_aligned_widgets(const uiStyle *style,
/* The magic numbers here center the widget vertically and offset it to the left.
* Currently this depends on the height of the header, although it could be independent. */
GPU_matrix_translate_2f(widget_rect.xmax - scaled_unit * 1.15,
- widget_rect.ymin + (header_height - drag_widget_size) * 0.5f);
+ widget_rect.ymin + (header_height - drag_widget_size) * 0.33f);
- const int col_tint = 84;
+ const int col_tint = 40;
float color_high[4], color_dark[4];
UI_GetThemeColorShade4fv(TH_PANEL_HEADER, col_tint, color_high);
- UI_GetThemeColorShade4fv(TH_PANEL_BACK, -col_tint, color_dark);
+ UI_GetThemeColorShade4fv(TH_PANEL_HEADER, (-col_tint / 2), color_dark);
GPUBatch *batch = GPU_batch_preset_panel_drag_widget(
U.pixelsize, color_high, color_dark, drag_widget_size);
@@ -1246,11 +1255,6 @@ static void panel_draw_aligned_backdrop(const Panel *panel,
const bool draw_box_style = panel->type->flag & PANEL_TYPE_DRAW_BOX;
const bool is_subpanel = panel->type->parent != NULL;
const bool is_open = !UI_panel_is_closed(panel);
-
- if (is_subpanel && !is_open) {
- return;
- }
-
const uint pos = GPU_vertformat_attr_add(
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -1317,20 +1321,53 @@ static void panel_draw_aligned_backdrop(const Panel *panel,
}
}
else {
+ /* Regular (non box style) panels. */
+ const float margin_y = 2.5f;
+ float panel_backcolor[4];
+ float panel_headercolor[4];
+
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
GPU_blend(GPU_BLEND_ALPHA);
/* Panel backdrop. */
if (is_open || panel->type->flag & PANEL_TYPE_NO_HEADER) {
- immUniformThemeColor(is_subpanel ? TH_PANEL_SUB_BACK : TH_PANEL_BACK);
- immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
+ UI_draw_roundbox_corner_set(is_open ? UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT : UI_CNR_ALL);
+ UI_GetThemeColor4fv((is_subpanel ? TH_PANEL_SUB_BACK : TH_PANEL_BACK), panel_backcolor);
+
+ /* Change the width a little bit to line up with the sides. */
+ UI_draw_roundbox_4fv(
+ &(const rctf){
+ .xmin = rect->xmin,
+ .xmax = rect->xmax,
+ .ymin = rect->ymin,
+ .ymax = rect->ymax,
+ },
+ true,
+ PNL_CNR_RAD,
+ panel_backcolor);
}
/* Panel header backdrops for non sub-panels. */
- if (!is_subpanel) {
- immUniformThemeColor(UI_panel_matches_search_filter(panel) ? TH_MATCH : TH_PANEL_HEADER);
- immRectf(pos, rect->xmin, header_rect->ymin, rect->xmax, header_rect->ymax);
+ if (is_subpanel) {
+ UI_GetThemeColor4fv(UI_panel_matches_search_filter(panel) ? TH_MATCH : TH_PANEL_SUB_BACK,
+ panel_headercolor);
}
+ else {
+ UI_GetThemeColor4fv(UI_panel_matches_search_filter(panel) ? TH_MATCH : TH_PANEL_HEADER,
+ panel_headercolor);
+ }
+
+ UI_draw_roundbox_corner_set(is_open ? UI_CNR_TOP_RIGHT | UI_CNR_TOP_LEFT : UI_CNR_ALL);
+ UI_draw_roundbox_4fv(
+ &(const rctf){
+ .xmin = rect->xmin,
+ .xmax = rect->xmax,
+ .ymin = header_rect->ymin,
+ .ymax = header_rect->ymax - margin_y,
+ },
+ true,
+ PNL_CNR_RAD,
+ panel_headercolor);
GPU_blend(GPU_BLEND_NONE);
immUnbindProgram();