[Bf-blender-cvs] [0de14fbe78f] master: UI: Fix view reset when toggling subpanel expansion

Hans Goudey noreply at git.blender.org
Sun Jun 21 16:47:45 CEST 2020


Commit: 0de14fbe78f529edfd7aff151878ceb883006fee
Author: Hans Goudey
Date:   Sun Jun 21 10:47:37 2020 -0400
Branches: master
https://developer.blender.org/rB0de14fbe78f529edfd7aff151878ceb883006fee

UI: Fix view reset when toggling subpanel expansion

The view should only reset for the ctrl-click mode that collapses
all other panels.

===================================================================

M	source/blender/editors/interface/interface_panel.c

===================================================================

diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 924b886f167..ffaeb999df7 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -2051,10 +2051,13 @@ static void ui_handle_panel_header(
       /* Collapse and expand panels. */
 
       if (ctrl) {
-        /* Only collapse all for parent panels. */
+        /* For parent panels, collapse all other panels or toggle children. */
         if (block->panel->type != NULL && block->panel->type->parent == NULL) {
           if (block->panel->flag & PNL_CLOSED || BLI_listbase_is_empty(&block->panel->children)) {
             panels_collapse_all(C, area, region, block->panel);
+
+            /* Reset the view - we don't want to display a view without content. */
+            UI_view2d_offset(&region->v2d, 0.0f, 1.0f);
           }
           else {
             const int closed_flag = (align == BUT_HORIZONTAL) ? PNL_CLOSEDX : PNL_CLOSEDY;
@@ -2066,9 +2069,6 @@ static void ui_handle_panel_header(
                 block->panel, closed_flag, (first_child->flag & PNL_CLOSED) == 0);
             block->panel->flag |= closed_flag;
           }
-
-          /* reset the view - we don't want to display a view without content */
-          UI_view2d_offset(&region->v2d, 0.0f, 1.0f);
         }
       }



More information about the Bf-blender-cvs mailing list