Revert 0ea03b5137: Remove Fading of Editor Border Highlights

This implementation is fatally flawed in a couple ways, the most
important of which is related to multiple windows on separate monitors.
Basically the refresh would cause recreation of action zones when they
are not expected to change, resulting in complaint #141521. This also
causes too many refreshes of gizmos. I don't currently have any ideas
on a better way of doing this so we'll have to do without for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/141743
This commit is contained in:
Harley Acheson
2025-07-10 18:02:53 +02:00
committed by Harley Acheson
parent b5ca00a403
commit f0d1af3836
2 changed files with 30 additions and 59 deletions

View File

@@ -108,8 +108,20 @@ static void drawscredge_area(const ScrArea &area, float edge_thickness)
GPU_batch_draw(batch);
}
static void screen_draw_editor_outlines(bScreen *screen, wmWindow *win)
void ED_screen_draw_edges(wmWindow *win)
{
bScreen *screen = WM_window_get_active_screen(win);
screen->do_draw = false;
if (screen->state != SCREENNORMAL) {
return;
}
if (BLI_listbase_is_single(&screen->areabase) && win->global_areas.areabase.first == nullptr) {
/* Do not show edges on windows without global areas and with only one editor. */
return;
}
ARegion *region = screen->active_region;
ScrArea *active_area = nullptr;
@@ -139,60 +151,6 @@ static void screen_draw_editor_outlines(bScreen *screen, wmWindow *win)
}
}
static ScrArea *current_active_area = nullptr;
static ScrArea *last_active_area = nullptr;
double now = BLI_time_now_seconds();
static double start_time = now;
double end_time = start_time + AREA_ACTIVE_FADEIN;
if (active_area != current_active_area) {
if (now > start_time + AREA_ACTIVE_FADEIN) {
start_time = now;
end_time = start_time + AREA_ACTIVE_FADEIN;
}
last_active_area = current_active_area;
current_active_area = active_area;
}
float col_inactive[4];
float col_active[4];
float col_active_last[4];
UI_GetThemeColor4fv(TH_EDITOR_OUTLINE_ACTIVE, col_active);
UI_GetThemeColor4fv(TH_EDITOR_OUTLINE, col_inactive);
copy_v4_v4(col_active_last, col_inactive);
if (now < end_time) {
const float factor = pow((now - start_time) / (end_time - start_time), 2);
UI_GetThemeColorBlend4f(TH_EDITOR_OUTLINE, TH_EDITOR_OUTLINE_ACTIVE, factor, col_active);
UI_GetThemeColorBlend4f(TH_EDITOR_OUTLINE_ACTIVE, TH_EDITOR_OUTLINE, factor, col_active_last);
screen->do_refresh = true;
}
rctf bounds;
UI_draw_roundbox_corner_set(UI_CNR_ALL);
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
BLI_rctf_rcti_copy(&bounds, &area->totrct);
float *color = (area == active_area) ? col_active :
(area == last_active_area) ? col_active_last :
col_inactive;
UI_draw_roundbox_4fv_ex(&bounds, nullptr, nullptr, 1.0f, color, U.pixelsize, EDITORRADIUS);
}
}
void ED_screen_draw_edges(wmWindow *win)
{
bScreen *screen = WM_window_get_active_screen(win);
screen->do_draw = false;
if (screen->state != SCREENNORMAL) {
return;
}
if (BLI_listbase_is_single(&screen->areabase) && win->global_areas.areabase.first == nullptr) {
/* Do not show edges on windows without global areas and with only one editor. */
return;
}
rcti scissor_rect;
BLI_rcti_init_minmax(&scissor_rect);
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
@@ -238,10 +196,25 @@ void ED_screen_draw_edges(wmWindow *win)
drawscredge_area(*area, edge_thickness);
}
float outline1[4];
float outline2[4];
rctf bounds;
UI_GetThemeColor4fv(TH_EDITOR_OUTLINE, outline1);
UI_GetThemeColor4fv(TH_EDITOR_OUTLINE_ACTIVE, outline2);
UI_draw_roundbox_corner_set(UI_CNR_ALL);
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
BLI_rctf_rcti_copy(&bounds, &area->totrct);
UI_draw_roundbox_4fv_ex(&bounds,
nullptr,
nullptr,
1.0f,
(area == active_area) ? outline2 : outline1,
U.pixelsize,
EDITORRADIUS);
}
GPU_blend(GPU_BLEND_NONE);
GPU_scissor_test(false);
screen_draw_editor_outlines(screen, win);
}
void screen_draw_move_highlight(const wmWindow *win, bScreen *screen, eScreenAxis dir_axis)

View File

@@ -85,8 +85,6 @@ enum class AreaDockTarget {
#define AREA_JOIN_FADEOUT 0.15f /* seconds */
#define AREA_SPLIT_FADEOUT 0.15f /* seconds */
#define AREA_ACTIVE_FADEIN 0.15f /* seconds */
/* `area.cc` */
/**