[Bf-blender-cvs] [7fa42b3e519] blender2.8: Fix T56511: UILayout.prop_search misaligned

Campbell Barton noreply at git.blender.org
Fri Aug 24 04:05:17 CEST 2018


Commit: 7fa42b3e519173c29a2ae250cea15f35e32521c2
Author: Campbell Barton
Date:   Fri Aug 24 12:09:56 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB7fa42b3e519173c29a2ae250cea15f35e32521c2

Fix T56511: UILayout.prop_search misaligned

Add padding when used with property decorations.

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

M	release/scripts/startup/bl_ui/properties_physics_common.py
M	source/blender/editors/interface/interface_layout.c

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

diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py
index 83bfab5581d..9653d98d428 100644
--- a/release/scripts/startup/bl_ui/properties_physics_common.py
+++ b/release/scripts/startup/bl_ui/properties_physics_common.py
@@ -239,11 +239,11 @@ def effector_weights_ui(self, context, weights, weight_type):
     layout = self.layout
     layout.use_property_split = True
 
-    layout.prop(weights, "group")
-
     # NOTE: TODO temporarly used until the animate properties are properly skipped.
     layout.use_property_decorate = False  # No animation (remove this later on).
 
+    layout.prop(weights, "group")
+
     flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
 
     col = flow.column()
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index ec35325416a..a9703736916 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -809,6 +809,11 @@ static uiBut *ui_item_with_label(
 		        x, y, prop_but_width, h);
 	}
 
+	/* Only for alignment. */
+	if ((layout->item.flag & UI_ITEM_PROP_DECORATE) != 0) {
+		uiItemL(sub, NULL, ICON_BLANK1);
+	}
+
 	UI_block_layout_set_current(block, layout);
 	return but;
 }
@@ -1509,6 +1514,8 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
 #ifdef UI_PROP_DECORATE
 	struct {
 		bool use_prop_decorate;
+		/* For button types that handle own decorations (or add own padding for alignment). */
+		bool use_prop_decorate_done;
 		int len;
 		uiLayout *layout;
 		uiBut *but;
@@ -1728,6 +1735,11 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
 
 		if (layout->redalert)
 			UI_but_flag_enable(but, UI_BUT_REDALERT);
+
+#ifdef UI_PROP_DECORATE
+		/* ui_item_with_label handles this. */
+		ui_decorate.use_prop_decorate_done = true;
+#endif
 	}
 	/* single button */
 	else {
@@ -1749,7 +1761,10 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
 	}
 
 #ifdef UI_PROP_DECORATE
-	if (ui_decorate.use_prop_decorate) {
+	if (ui_decorate.use_prop_decorate_done) {
+		/* pass */
+	}
+	else if (ui_decorate.use_prop_decorate) {
 		const bool is_anim = RNA_property_animateable(ptr, prop);
 		uiBut *but_decorate = ui_decorate.but ? ui_decorate.but->next : block->buttons.first;
 		uiLayout *layout_col = uiLayoutColumn(ui_decorate.layout, false);



More information about the Bf-blender-cvs mailing list