[Bf-blender-cvs] [ab9c34e7e7c] master: Fix T104316: Width of headerless panels on regions with overlap

Leon Schittek noreply at git.blender.org
Fri Feb 3 21:42:12 CET 2023


Commit: ab9c34e7e7c3c71100b6a075b39a25a05d9f2726
Author: Leon Schittek
Date:   Fri Feb 3 21:40:13 2023 +0100
Branches: master
https://developer.blender.org/rBab9c34e7e7c3c71100b6a075b39a25a05d9f2726

Fix T104316: Width of headerless panels on regions with overlap

In some cases panels without headers were drawn too wide in sidebars
with region overlap.

Instead of always using the maximum width the view allows, headerless
panels now also use the width calculated in
`panel_draw_width_from_max_width_get`. The function already returns the
correct width in all cases and also takes care of insetting the panels,
when their backdrop needs to be drawn, which is necessary for headerless
panels, too, when there is region overlap.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D17194

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

M	source/blender/editors/screen/area.c

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

diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 305439724d0..c3df23500d4 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -2946,7 +2946,7 @@ void ED_region_panels_layout_ex(const bContext *C,
     margin_x = category_tabs_width;
   }
 
-  const int width_no_header = BLI_rctf_size_x(&v2d->cur) - margin_x;
+  const int max_panel_width = BLI_rctf_size_x(&v2d->cur) - margin_x;
   /* Works out to 10 * UI_UNIT_X or 20 * UI_UNIT_X. */
   const int em = (region->type->prefsizex) ? 10 : 20;
 
@@ -2974,22 +2974,14 @@ void ED_region_panels_layout_ex(const bContext *C,
         continue;
       }
     }
-    const int width = panel_draw_width_from_max_width_get(region, pt, width_no_header);
+    const int width = panel_draw_width_from_max_width_get(region, pt, max_panel_width);
 
     if (panel && UI_panel_is_dragging(panel)) {
       /* Prevent View2d.tot rectangle size changes while dragging panels. */
       update_tot_size = false;
     }
 
-    ed_panel_draw(C,
-                  region,
-                  &region->panels,
-                  pt,
-                  panel,
-                  (pt->flag & PANEL_TYPE_NO_HEADER) ? width_no_header : width,
-                  em,
-                  NULL,
-                  search_filter);
+    ed_panel_draw(C, region, &region->panels, pt, panel, width, em, NULL, search_filter);
   }
 
   /* Draw "poly-instantiated" panels that don't have a 1 to 1 correspondence with their types. */
@@ -3005,7 +2997,7 @@ void ED_region_panels_layout_ex(const bContext *C,
           !STREQ(category, panel->type->category)) {
         continue;
       }
-      const int width = panel_draw_width_from_max_width_get(region, panel->type, width_no_header);
+      const int width = panel_draw_width_from_max_width_get(region, panel->type, max_panel_width);
 
       if (panel && UI_panel_is_dragging(panel)) {
         /* Prevent View2d.tot rectangle size changes while dragging panels. */
@@ -3021,7 +3013,7 @@ void ED_region_panels_layout_ex(const bContext *C,
                     &region->panels,
                     panel->type,
                     panel,
-                    (panel->type->flag & PANEL_TYPE_NO_HEADER) ? width_no_header : width,
+                    width,
                     em,
                     unique_panel_str,
                     search_filter);



More information about the Bf-blender-cvs mailing list