UI: Fix FILE_PT_operator drawing when using UI layout panels
The `FILE_PT_operator` panel used in the file browser does not correctly allow the new UI layout panels to be drawn correctly. The layout panels depend on drawing the background so that different colors can denote each panel section. In the case of `FILE_PT_operator`, this background drawing is skipped entirely leading to a situation where there's no panel delineation at all. Forcing the background to be drawn leads to a second problem where the "typical" panel colors are not used in this part of the file browser. We need to match the surrounding area otherwise a much lighter shade of gray will be used and look out of place. The fix is to extend the processing for PANEL_TYPE_NO_HEADER to account for both of the above situations. Pull Request: https://projects.blender.org/blender/blender/pulls/118231
This commit is contained in:
committed by
Jesse Yurkovich
parent
9e8bbc1129
commit
c8f2a5cc42
@@ -1167,8 +1167,9 @@ static void panel_draw_aligned_backdrop(const ARegion *region,
|
||||
const rcti *rect,
|
||||
const rcti *header_rect)
|
||||
{
|
||||
const bool is_subpanel = panel->type->parent != nullptr;
|
||||
const bool is_open = !UI_panel_is_closed(panel);
|
||||
const bool is_subpanel = panel->type->parent != nullptr;
|
||||
const bool has_header = (panel->type->flag & PANEL_TYPE_NO_HEADER) == 0;
|
||||
|
||||
if (is_subpanel && !is_open) {
|
||||
return;
|
||||
@@ -1182,10 +1183,15 @@ static void panel_draw_aligned_backdrop(const ARegion *region,
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
|
||||
/* Panel backdrop. */
|
||||
if (is_open || panel->type->flag & PANEL_TYPE_NO_HEADER) {
|
||||
if (is_open || !has_header) {
|
||||
float panel_backcolor[4];
|
||||
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);
|
||||
if (!has_header) {
|
||||
UI_GetThemeColor4fv(TH_BACK, panel_backcolor);
|
||||
}
|
||||
else {
|
||||
UI_GetThemeColor4fv((is_subpanel ? TH_PANEL_SUB_BACK : TH_PANEL_BACK), panel_backcolor);
|
||||
}
|
||||
|
||||
rctf box_rect;
|
||||
box_rect.xmin = rect->xmin;
|
||||
@@ -1222,7 +1228,7 @@ static void panel_draw_aligned_backdrop(const ARegion *region,
|
||||
}
|
||||
|
||||
/* Panel header backdrops for non sub-panels. */
|
||||
if (!is_subpanel) {
|
||||
if (!is_subpanel && has_header) {
|
||||
float panel_headercolor[4];
|
||||
UI_GetThemeColor4fv(UI_panel_matches_search_filter(panel) ? TH_MATCH : TH_PANEL_HEADER,
|
||||
panel_headercolor);
|
||||
@@ -1259,7 +1265,7 @@ void ui_draw_aligned_panel(const ARegion *region,
|
||||
rect->ymax + int(floor(PNL_HEADER / block->aspect + 0.001f)),
|
||||
};
|
||||
|
||||
if (show_background) {
|
||||
if (show_background || (panel->type->flag & PANEL_TYPE_NO_HEADER)) {
|
||||
panel_draw_aligned_backdrop(region, panel, rect, &header_rect);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user