[Bf-blender-cvs] [a794da5200b] blender2.8: Fix T55517: Property-split fails w/ expanded enum

Campbell Barton noreply at git.blender.org
Mon Jun 18 08:07:11 CEST 2018


Commit: a794da5200b20c3abaefa4a64624401be3af61cc
Author: Campbell Barton
Date:   Mon Jun 18 07:52:17 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBa794da5200b20c3abaefa4a64624401be3af61cc

Fix T55517: Property-split fails w/ expanded enum

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

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 9348ee1fe3a..1ce34fec118 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1488,6 +1488,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
 #ifdef UI_PROP_DECORATE
 	struct {
 		bool use_prop_decorate;
+		int len;
 		uiLayout *layout;
 		uiBut *but;
 	} ui_decorate = {
@@ -1583,6 +1584,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
 		if (ui_decorate.use_prop_decorate) {
 			layout_row = uiLayoutRow(layout, true);
 			layout_row->space = 0;
+			ui_decorate.len = 1;
 		}
 #endif  /* UI_PROP_DECORATE */
 
@@ -1621,6 +1623,10 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
 					but->drawflag |= UI_BUT_TEXT_RIGHT;
 					but->drawflag &= ~UI_BUT_TEXT_LEFT;
 				}
+
+#ifdef UI_PROP_DECORATE
+				ui_decorate.len = len;
+#endif
 			}
 			else {
 				if (name) {
@@ -1635,7 +1641,12 @@ 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;
-			name = "";
+			if ((type == PROP_ENUM) && (flag & UI_ITEM_R_EXPAND)) {
+				/* pass (expanded enums each have their own name) */
+			}
+			else {
+				name = "";
+			}
 		}
 
 #ifdef UI_PROP_DECORATE
@@ -1702,7 +1713,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
 		layout_col->space = 0;
 		layout_col->emboss = UI_EMBOSS_NONE;
 		int i;
-		for (i = 0; but_decorate; i++) {
+		for (i = 0; i < ui_decorate.len && but_decorate; i++) {
 			/* The icons are set in 'ui_but_anim_flag' */
 			if (is_anim) {
 				but = uiDefIconBut(
@@ -1724,7 +1735,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
 			BLI_insertlinkafter(&block->buttons, but_decorate, but);
 			but_decorate = but->next;
 		}
-		BLI_assert(len ? (ELEM(i, 1, len)) : i == 1);
+		BLI_assert(ELEM(i, 1, ui_decorate.len));
 	}
 #endif  /* UI_PROP_DECORATE */



More information about the Bf-blender-cvs mailing list