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:
authorAlexander Gavrilov <angavrilov@gmail.com>2019-05-22 17:59:06 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2019-05-22 17:59:22 +0300
commit5397d8d268244c34ecab94f89885e64925acc50e (patch)
treee032eec7627c852d64705bb69caf150cacceb34c /source/blender/editors/interface/interface_panel.c
parent8f2538f4fba84c965b5b85e12eb441a97cfa5e58 (diff)
UI: allow shrinking panel height to zero when open.
Currently if a panel becomes empty (draw simply returns), it stays at the last non-empty height. This seems to be caused by some legacy checks that may be completely obsolete, but the safest fix is to at least allow resetting height when the panel is open.
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r--source/blender/editors/interface/interface_panel.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index aa7ff015bad..14e880c927a 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -367,7 +367,7 @@ Panel *UI_panel_begin(
return pa;
}
-void UI_panel_end(uiBlock *block, int width, int height)
+void UI_panel_end(uiBlock *block, int width, int height, bool open)
{
Panel *pa = block->panel;
@@ -390,21 +390,21 @@ void UI_panel_end(uiBlock *block, int width, int height)
pa->sizey = height;
}
else {
- /* check if we need to do an animation */
- if (!ELEM(width, 0, pa->sizex) || !ELEM(height, 0, pa->sizey)) {
- pa->runtime_flag |= PNL_ANIM_ALIGN;
- if (height != 0) {
- pa->ofsy += pa->sizey - height;
- }
- }
+ int old_sizex = pa->sizex, old_sizey = pa->sizey;
/* update width/height if non-zero */
if (width != 0) {
pa->sizex = width;
}
- if (height != 0) {
+ if (height != 0 || open) {
pa->sizey = height;
}
+
+ /* check if we need to do an animation */
+ if (pa->sizex != old_sizex || pa->sizey != old_sizey) {
+ pa->runtime_flag |= PNL_ANIM_ALIGN;
+ pa->ofsy += old_sizey - pa->sizey;
+ }
}
}