UI: avoid aligning labels for ui_item_with_label

Key-map display was doing thousands of redundant alignment operations.
Set the spacing instead as align was only set to use zero spacing.

This would have prevented the crash reported by T78636.
This commit is contained in:
Campbell Barton 2020-07-16 17:00:16 +10:00
parent 75520894c7
commit ad4928a171
Notes: blender-bot 2023-02-14 06:19:41 +01:00
Referenced by commit adfde60831, Fix T79524: Button alignment broken in some cases
Referenced by issue #79524, UI: Some buttons are not aligned
1 changed files with 5 additions and 2 deletions

View File

@ -947,8 +947,11 @@ static uiBut *ui_item_with_label(uiLayout *layout,
const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0);
#endif
/* Always align item with label since text is already given enough space not to overlap. */
sub = uiLayoutRow(layout, true);
/* Previously 'align' was enabled to make sure the label is spaced closely to the button.
* Set the space to zero instead as aligning a large number of labels can end up aligning
* thousands of buttons when displaying key-map search (a heavy operation), see: T78636. */
sub = uiLayoutRow(layout, false);
sub->space = 0;
UI_block_layout_set_current(block, sub);
#ifdef UI_PROP_DECORATE