[Bf-blender-cvs] [93544b641bd] master: UI: Visual style update to panels

Pablo Vazquez noreply at git.blender.org
Sun Oct 17 18:31:28 CEST 2021


Commit: 93544b641bd6687c9b0af3e203a4069977116a78
Author: Pablo Vazquez
Date:   Sun Oct 17 18:22:53 2021 +0200
Branches: master
https://developer.blender.org/rB93544b641bd6687c9b0af3e203a4069977116a78

UI: Visual style update to panels

Back in Blender 2.30, the GUI project brought panels into Blender among other important visual updates.
For the first time it was possible to move the wall of buttons around. Providing a clear separation
between sections (it even allowed the grouping of panels in tabs!)

During the 2.5 redesign, the separation between panels became a line on top of each panel, and panels received
theme settings for background and header colors. The default theme used the same color for both.

In 2.8 the background color of panels was different from headers in the default theme, so the separator
line was removed. While the separator line wasn't elegant (only on top, non-themeable, hard-coded emboss effect),
it provided a sort of separation between panels.

This patch solves the panels-separation by simply adding a margin space around them (not visible in default theme yet).
Even though the margin reduces the width of the working area slightly, it makes room for the upcoming always-visible scrollbars.

Other adjustments:
* Use arrow icon instead of triangle to collapse/expand
* Use rounded corners to match the rest of the UI (editor corners, nodes, etc).

{F10953929, size=full}

Margin on panels makes use of the `style->panelouter` property that hasn't been
used in a while. Also slight tweaks to `boxspace` and `templatespace` style properties so they
are multiples of 2 and operations on them round better.

There is technically no need to update the themes for them to work, so no theme changes are included in this patch.

{F10953931, size=full}

{F10953933, size=full}

{F10953934, size=full}

{F10954003, size=full}

----

A new theme setting under Style controls the roundness of all panels (added it to Style instead of ThemeSpace because I think controlling the panel roundness per editor is a bit overkill):
{F11091561, size=full, autoplay, loop}

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D12814

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

M	release/datafiles/userdef/userdef_default_theme.c
M	release/scripts/presets/interface_theme/Blender_Light.xml
M	release/scripts/startup/bl_ui/properties_constraint.py
M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/blenkernel/BKE_blender_version.h
M	source/blender/blenkernel/BKE_screen.h
M	source/blender/blenloader/intern/versioning_userdef.c
M	source/blender/editors/animation/fmodifier_ui.c
M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_intern.h
M	source/blender/editors/interface/interface_panel.c
M	source/blender/editors/screen/area.c
M	source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc
M	source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_ui.c
M	source/blender/makesrna/intern/rna_userdef.c
M	source/blender/modifiers/intern/MOD_ui_common.c
M	source/blender/shader_fx/intern/FX_ui_common.c

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

diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c
index 1f9316cacfd..eebdcf84fd2 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -260,6 +260,7 @@ const bTheme U_theme_default = {
     .icon_modifier = RGBA(0x84b8ffff),
     .icon_shading = RGBA(0xea7581ff),
     .icon_folder = RGBA(0xe3c16eff),
+    .panel_roundness = 0.4f,
   },
   .space_properties = {
     .back = RGBA(0x42424200),
diff --git a/release/scripts/presets/interface_theme/Blender_Light.xml b/release/scripts/presets/interface_theme/Blender_Light.xml
index 834139458d5..8b7995cef4c 100644
--- a/release/scripts/presets/interface_theme/Blender_Light.xml
+++ b/release/scripts/presets/interface_theme/Blender_Light.xml
@@ -9,6 +9,7 @@
         widget_emboss="#00000026"
         editor_outline="#1f1f1f"
         widget_text_cursor="#3399e6"
+        panel_roundness="0.4"
         transparent_checker_primary="#333333"
         transparent_checker_secondary="#262626"
         transparent_checker_size="8"
diff --git a/release/scripts/startup/bl_ui/properties_constraint.py b/release/scripts/startup/bl_ui/properties_constraint.py
index 2a0cf56534c..85381f5ee3c 100644
--- a/release/scripts/startup/bl_ui/properties_constraint.py
+++ b/release/scripts/startup/bl_ui/properties_constraint.py
@@ -70,7 +70,7 @@ class ConstraintButtonsPanel:
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_label = ""
-    bl_options = {'INSTANCED', 'HEADER_LAYOUT_EXPAND', 'DRAW_BOX'}
+    bl_options = {'INSTANCED', 'HEADER_LAYOUT_EXPAND'}
 
     @staticmethod
     def draw_influence(layout, con):
@@ -976,7 +976,6 @@ class ConstraintButtonsSubPanel:
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_label = ""
-    bl_options = {'DRAW_BOX'}
 
     def get_constraint(self, _context):
         con = self.custom_data
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 7a8b6d42cad..e5f6cff79ee 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -920,6 +920,7 @@ class USERPREF_PT_theme_interface_styles(ThemePanel, CenterAlignMixIn, Panel):
         flow.prop(ui, "editor_outline")
         flow.prop(ui, "widget_text_cursor")
         flow.prop(ui, "widget_emboss")
+        flow.prop(ui, "panel_roundness")
 
 
 class USERPREF_PT_theme_interface_transparent_checker(ThemePanel, CenterAlignMixIn, Panel):
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index ceb19e87b40..d8112de760d 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -39,7 +39,7 @@ extern "C" {
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION
-#define BLENDER_FILE_SUBVERSION 33
+#define BLENDER_FILE_SUBVERSION 34
 
 /* Minimum Blender version that supports reading file written with the current
  * version. Older Blender versions will test this and show a warning if the file
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 6f341a12b82..5c913ed851f 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -301,8 +301,6 @@ enum {
   PANEL_TYPE_LAYOUT_VERT_BAR = (1 << 3),
   /** This panel type represents data external to the UI. */
   PANEL_TYPE_INSTANCED = (1 << 4),
-  /** Draw panel like a box widget. */
-  PANEL_TYPE_DRAW_BOX = (1 << 6),
   /** Don't search panels with this type during property search. */
   PANEL_TYPE_NO_SEARCH = (1 << 7),
 };
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 60e202746ff..2c01fae3d6a 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -306,6 +306,10 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
     btheme->space_node.movie[3] = U_theme_default.space_node.movie[3];
   }
 
+  if (!USER_VERSION_ATLEAST(300, 34)) {
+    btheme->tui.panel_roundness = 0.4f;
+  }
+
   /**
    * Versioning code until next subversion bump goes here.
    *
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 40871fba2be..cea0e50a21f 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -187,7 +187,7 @@ static PanelType *fmodifier_panel_register(ARegionType *region_type,
 
   /* Give the panel the special flag that says it was built here and corresponds to a
    * modifier rather than a #PanelType. */
-  panel_type->flag = PANEL_TYPE_HEADER_EXPAND | PANEL_TYPE_DRAW_BOX | PANEL_TYPE_INSTANCED;
+  panel_type->flag = PANEL_TYPE_HEADER_EXPAND  | PANEL_TYPE_INSTANCED;
   panel_type->reorder = fmodifier_reorder;
   panel_type->get_list_data_expand_flag = get_fmodifier_expand_flag;
   panel_type->set_list_data_expand_flag = set_fmodifier_expand_flag;
@@ -221,7 +221,7 @@ static PanelType *fmodifier_subpanel_register(ARegionType *region_type,
   panel_type->draw_header = draw_header;
   panel_type->draw = draw;
   panel_type->poll = poll;
-  panel_type->flag = PANEL_TYPE_DEFAULT_CLOSED | PANEL_TYPE_DRAW_BOX;
+  panel_type->flag = PANEL_TYPE_DEFAULT_CLOSED ;
 
   BLI_assert(parent != NULL);
   BLI_strncpy(panel_type->parent_id, parent->idname, BKE_ST_MAXNAME);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index ddd5e77cbb6..c808a42a44a 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -252,7 +252,8 @@ enum {
 
 #define UI_PANEL_CATEGORY_MARGIN_WIDTH (U.widget_unit * 1.0f)
 
-#define UI_PANEL_BOX_STYLE_MARGIN (U.widget_unit * 0.2f)
+#define UI_PANEL_MARGIN_X (U.widget_unit * 0.4f)
+#define UI_PANEL_MARGIN_Y (U.widget_unit * 0.2f)
 
 /* but->drawflag - these flags should only affect how the button is drawn. */
 /* NOTE: currently, these flags *are not passed* to the widget's state() or draw() functions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index c7781d65058..0301ab9156e 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -116,7 +116,7 @@ extern const char ui_radial_dir_to_numpad[8];
 extern const short ui_radial_dir_to_angle[8];
 
 /* internal panel drawing defines */
-#define PNL_HEADER (UI_UNIT_Y * 1.2) /* 24 default */
+#define PNL_HEADER (UI_UNIT_Y * 1.25) /* 24 default */
 
 /* bit button defines */
 /* Bit operations */
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index a64797af24f..e5f84f63d35 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -1112,23 +1112,14 @@ static void panel_draw_highlight_border(const Panel *panel,
                                         const rcti *rect,
                                         const rcti *header_rect)
 {
-  const bool draw_box_style = panel->type->flag & PANEL_TYPE_DRAW_BOX;
   const bool is_subpanel = panel->type->parent != NULL;
   if (is_subpanel) {
     return;
   }
 
-  float radius;
-  if (draw_box_style) {
-    /* Use the theme for box widgets. */
-    const uiWidgetColors *box_wcol = &UI_GetTheme()->tui.wcol_box;
-    UI_draw_roundbox_corner_set(UI_CNR_ALL);
-    radius = box_wcol->roundness * U.widget_unit;
-  }
-  else {
-    UI_draw_roundbox_corner_set(UI_CNR_NONE);
-    radius = 0.0f;
-  }
+  const bTheme *btheme = UI_GetTheme();
+  const float radius = btheme->tui.panel_roundness * U.widget_unit * 0.5f;
+  UI_draw_roundbox_corner_set(UI_CNR_ALL);
 
   float color[4];
   UI_GetThemeColor4fv(TH_SELECT_ACTIVE, color);
@@ -1172,18 +1163,17 @@ static void panel_draw_aligned_widgets(const uiStyle *style,
 
   /* Draw collapse icon. */
   {
-    rctf collapse_rect = {
-        .xmin = widget_rect.xmin,
-        .xmax = widget_rect.xmin + header_height,
-        .ymin = widget_rect.ymin,
-        .ymax = widget_rect.ymax,
-    };
-    BLI_rctf_scale(&collapse_rect, 0.25f);
-
-    float triangle_color[4];
-    rgba_uchar_to_float(triangle_color, title_color);
-
-    ui_draw_anti_tria_rect(&collapse_rect, UI_panel_is_closed(panel) ? 'h' : 'v', triangle_color);
+    const float size_y = BLI_rcti_size_y(&widget_rect);
+    GPU_blend(GPU_BLEND_ALPHA);
+    UI_icon_draw_ex(widget_rect.xmin + size_y * 0.2f,
+                    widget_rect.ymin + size_y * 0.2f,
+                    UI_panel_is_closed(panel) ? ICON_RIGHTARROW : ICON_DOWNARROW_HLT,
+                    aspect * U.inv_dpi_fac,
+                    0.7f,
+                    0.0f,
+                    title_color,
+                    false);
+    GPU_blend(GPU_BLEND_NONE);
   }
 
   /* Draw text label. */
@@ -1243,7 +1233,6 @@ static void panel_draw_aligned_backdrop(const Panel *panel,
                                         const rcti *rect,
                                         const rcti *header_rect)
 {
-  const bool draw_box_style = panel->type->flag & PANEL_TYPE_DRAW_BOX;
   const bool is_subpanel = panel->type->parent != NULL;
   const bool is_open = !UI_panel_is_closed(panel);
 
@@ -1251,90 +1240,52 @@ static void panel_draw_aligned_backdrop(const Panel *panel,
     return;
   }
 
-  const uint pos = GPU_vertformat_attr_add(
-      immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+  const bTheme *btheme = UI_GetTheme();
+  const float radius = btheme->tui.panel_roundness * U.widget_unit * 0.5f;
 
-  /* Draw with an opaque box backdrop for box style panels. */
-  if (draw_box_style) {
-    /* Use the theme for box widgets. */
-    const uiWidgetColors *box_wcol = &UI_GetTheme()->tui.wcol_box;
-
-    if (is_subpanel) {
-      /* Use rounded bottom corners for the last subpanel. */
-      if (panel->next == NULL) {
-        UI_draw_roundbox_corner_se

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list