New uialign code, based on 2D positions of widgets.

This new code fixes a tons of issues with previous one, which basically was epic-failing
in many non-basic cases (especially mixed columns and rows with column-dominant layout).

It basically no more relies over order of buttons declaration in the uiBlock, instead it
finds and stores spatial neighbors and uses that data to compute needed stitching.
See code comments for details.

New code seems to be roughly ten times slower than old one (for complex grouped layouts),
that is, about a few microsecconds per alignment group - this remains reasonable.

Also, ui-align code becomming rather big in itself, it was separated in
own new `interface_align.c` file.

Reviewers: campbellbarton, severin

Reviewed By: campbellbarton, severin

Differential Revision: https://developer.blender.org/D1573
This commit is contained in:
2015-11-06 18:39:56 +01:00
parent a25df21631
commit 3d39b98f94
7 changed files with 645 additions and 191 deletions

View File

@@ -3548,9 +3548,9 @@ static int widget_roundbox_set(uiBut *but, rcti *rect)
if ((but->drawflag & UI_BUT_ALIGN) && but->type != UI_BTYPE_PULLDOWN) {
/* ui_block_position has this correction too, keep in sync */
if (but->drawflag & UI_BUT_ALIGN_TOP)
if (but->drawflag & (UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_STITCH_TOP))
rect->ymax += U.pixelsize;
if (but->drawflag & UI_BUT_ALIGN_LEFT)
if (but->drawflag & (UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_STITCH_LEFT))
rect->xmin -= U.pixelsize;
switch (but->drawflag & UI_BUT_ALIGN) {