[Bf-blender-cvs] [578879253dc] blender2.8: UI: use horizontal alignment for expanded enums

Campbell Barton noreply at git.blender.org
Tue Sep 4 06:02:38 CEST 2018


Commit: 578879253dcf04c293a6ef0e0b4c96b4558d4140
Author: Campbell Barton
Date:   Tue Sep 4 14:07:26 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB578879253dcf04c293a6ef0e0b4c96b4558d4140

UI: use horizontal alignment for expanded enums

With the property separate option, the direction of expanded enums
now follows the current layout.

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

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

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

diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 86f1e5e158a..91756f9ae27 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1692,15 +1692,23 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
 				}
 			}
 
-			/* Watch out! We can only write into the new column now. */
-			layout = uiLayoutColumn(layout_split, true);
-			layout->space = 0;
+			/* Watch out! We can only write into the new layout now. */
 			if ((type == PROP_ENUM) && (flag & UI_ITEM_R_EXPAND)) {
-				/* pass (expanded enums each have their own name) */
+				/* Expanded enums each have their own name. */
+
+				/* Often expanded enum's are better arranged into a row, so check the existing layout. */
+				if (ui_layout_local_dir(layout) == UI_LAYOUT_HORIZONTAL) {
+					layout = uiLayoutRow(layout_split, true);
+				}
+				else {
+					layout = uiLayoutColumn(layout_split, true);
+				}
 			}
 			else {
 				name = "";
+				layout = uiLayoutColumn(layout_split, true);
 			}
+			layout->space = 0;
 
 #ifdef UI_PROP_SEP_ICON_WIDTH_EXCEPTION
 			if (type == PROP_BOOLEAN && (icon == ICON_NONE) && !icon_only) {



More information about the Bf-blender-cvs mailing list