Fix T56511: UILayout.prop_search misaligned

Add padding when used with property decorations.
This commit is contained in:
Campbell Barton 2018-08-24 12:09:56 +10:00
parent bae8ab3188
commit 7fa42b3e51
2 changed files with 18 additions and 3 deletions

@ -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()

@ -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);