[Bf-blender-cvs] [0e667723d4d] master: UI: Draw background for headerless panels with region-overlap

Campbell Barton noreply at git.blender.org
Thu May 16 10:10:33 CEST 2019


Commit: 0e667723d4d51b061036384db29ce7926d437ddf
Author: Campbell Barton
Date:   Thu May 16 18:06:55 2019 +1000
Branches: master
https://developer.blender.org/rB0e667723d4d51b061036384db29ce7926d437ddf

UI: Draw background for headerless panels with region-overlap

These were drawing without a backdrop.

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

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

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

diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 7c60ac75df8..f334d4a921a 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1687,6 +1687,12 @@ void UI_block_draw(const bContext *C, uiBlock *block)
   }
   else if (block->panel) {
     bool show_background = ar->alignment != RGN_ALIGN_FLOAT;
+    if (show_background) {
+      if (block->panel->type && (block->panel->type->flag & PNL_NO_HEADER)) {
+        /* Without a header there is no background except for region overlap. */
+        show_background = ar->overlap != 0;
+      }
+    }
     ui_draw_aligned_panel(&style, block, &rect, UI_panel_category_is_visible(ar), show_background);
   }
 
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 46b1279643e..aa7ff015bad 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -649,8 +649,17 @@ void ui_draw_aligned_panel(uiStyle *style,
                           /* FIXME(campbell): currently no background means floating panel which
                            * can't be dragged. This may be changed in future. */
                           show_background);
+  const int panel_col = is_subpanel ? TH_PANEL_SUB_BACK : TH_PANEL_BACK;
 
   if (panel->type && (panel->type->flag & PNL_NO_HEADER)) {
+    if (show_background) {
+      uint pos = GPU_vertformat_attr_add(
+          immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+      immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+      immUniformThemeColor(panel_col);
+      immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
+      immUnbindProgram();
+    }
     return;
   }
 
@@ -781,8 +790,6 @@ void ui_draw_aligned_panel(uiStyle *style,
 
     if (show_background) {
       /* panel backdrop */
-      int panel_col = is_subpanel ? TH_PANEL_SUB_BACK : TH_PANEL_BACK;
-
       immUniformThemeColor(panel_col);
       immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
     }



More information about the Bf-blender-cvs mailing list