[Bf-blender-cvs] [6842958c9b8] master: UI: Add (internal) option to use property splitting for label-less items

Julian Eisel noreply at git.blender.org
Mon Apr 27 16:38:55 CEST 2020


Commit: 6842958c9b8f0502148443534a7b38faa0efcd9d
Author: Julian Eisel
Date:   Mon Apr 27 15:24:25 2020 +0200
Branches: master
https://developer.blender.org/rB6842958c9b8f0502148443534a7b38faa0efcd9d

UI: Add (internal) option to use property splitting for label-less items

Usually items without labels don't use the property split layout and
just use the full layout width. In some cases that is not wanted because
it looks odd if single items within the split layout use the full width.
The option is unused but would be needed for adding decorators to the
material properties.

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

M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_layout.c

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

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index cd2e2794192..f83088dd4d5 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1778,6 +1778,8 @@ enum {
   UI_ITEM_R_CHECKBOX_INVERT = 1 << 12,
   /** Don't add a real decorator item, just blank space. */
   UI_ITEM_R_FORCE_BLANK_DECORATE = 1 << 13,
+  /* Even create the property split layout if there's no name to show there. */
+  UI_ITEM_R_SPLIT_EMPTY_NAME = 1 << 14,
 };
 
 #define UI_HEADER_OFFSET ((void)0, 0.4f * UI_UNIT_X)
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 49ce1315e7f..2ca4af32bc2 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1969,7 +1969,7 @@ void uiItemFullR(uiLayout *layout,
    * Keep using 'use_prop_sep' instead of disabling it entirely because
    * we need the ability to have decorators still. */
   bool use_prop_sep_split_label = use_prop_sep;
-  bool forbid_single_col = false;
+  bool use_split_empty_name = (flag & UI_ITEM_R_SPLIT_EMPTY_NAME);
 
 #ifdef UI_PROP_DECORATE
   struct {
@@ -2082,7 +2082,7 @@ void uiItemFullR(uiLayout *layout,
       use_prop_sep_split_label = false;
       /* For checkboxes we make an expection: We allow showing them in a split row even without
        * label. It typically relates to its neighbor items, so no need for an extra label. */
-      forbid_single_col = true;
+      use_split_empty_name = true;
     }
   }
 #endif
@@ -2120,7 +2120,7 @@ void uiItemFullR(uiLayout *layout,
     }
 #endif /* UI_PROP_DECORATE */
 
-    if ((name[0] == '\0') && !forbid_single_col) {
+    if ((name[0] == '\0') && !use_split_empty_name) {
       /* Ensure we get a column when text is not set. */
       layout = uiLayoutColumn(layout_row ? layout_row : layout, true);
       layout->space = 0;



More information about the Bf-blender-cvs mailing list