Fix T76940: Empty HUD (Redo Panel)

If the redo panel was made visible with the same size it had before
(e.g. stored in the file), the runtime region coordinates wouldn't get
set and ended up being all 0. E.g. the simplest way to cause this was
having a collapsed HUD, saving the file, re-opening it with the same
effective DPI and doing an operation so the closed HUD would appear
again.

Now the size is always recalculated if the visibility state of the HUD
changes.
This commit is contained in:
Julian Eisel 2020-05-22 18:33:23 +02:00
parent 43d33b3626
commit 3bc15c097c
Notes: blender-bot 2023-02-14 06:32:27 +01:00
Referenced by issue #76940, Empty HUD (Redo Panel)
1 changed files with 4 additions and 1 deletions

View File

@ -177,11 +177,13 @@ static void hud_region_layout(const bContext *C, ARegion *region)
return;
}
ScrArea *area = CTX_wm_area(C);
int size_y = region->sizey;
ED_region_panels_layout(C, region);
if (region->panels.first && (region->sizey != size_y)) {
if (region->panels.first &&
((area->flag & AREA_FLAG_REGION_SIZE_UPDATE) || (region->sizey != size_y))) {
int winx_new = UI_DPI_FAC * (region->sizex + 0.5f);
int winy_new = UI_DPI_FAC * (region->sizey + 0.5f);
View2D *v2d = &region->v2d;
@ -339,6 +341,7 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *area)
}
else {
if (region->flag & RGN_FLAG_HIDDEN) {
/* Also forces recalculating HUD size in hud_region_layout(). */
area->flag |= AREA_FLAG_REGION_SIZE_UPDATE;
}
region->flag &= ~RGN_FLAG_HIDDEN;