diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-11-26 16:28:47 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-11-26 16:28:47 +0300 |
commit | d00a3316e7f6bbcb52793efe28271da77b81ce4c (patch) | |
tree | 744b28c649aa30f23771d7acd693bf17f274816c /source/blender/editors/interface/interface_align.c | |
parent | b061b5ae7a9933132a169c6b7248b8026fb8c170 (diff) |
Fix assert in UI align code in some specific situations.
Situations like [top_button over [label, button]] need some subtle handling, since
we only store one neighbor per side of a button...
Diffstat (limited to 'source/blender/editors/interface/interface_align.c')
-rw-r--r-- | source/blender/editors/interface/interface_align.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_align.c b/source/blender/editors/interface/interface_align.c index 89a44db5fa3..e9d601457b4 100644 --- a/source/blender/editors/interface/interface_align.c +++ b/source/blender/editors/interface/interface_align.c @@ -164,11 +164,16 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other if (delta < max_delta) { /* We are only interested in neighbors that are at least as close as already found ones. */ if (delta <= butal->dists[side]) { - if (delta < butal->dists[side]) { - /* We found a closer neighbor. + { + /* We found an as close or closer neighbor. * If both buttons are alignable, we set them as each other neighbors. * Else, we have an unalignable one, we need to reset the others matching neighbor to NULL - * if its 'proximity distance' is really lower with current one. */ + * if its 'proximity distance' is really lower with current one. + * + * NOTE: We cannot only execute that piece of code in case we found a **closer** neighbor, + * due to the limited way we represent neighbors (buttons only know **one** neighbor + * on each side, when they can actually have several ones), it would prevent + * some buttons to be properly 'neighborly-initialized'. */ if (butal_can_align && butal_other_can_align) { butal->neighbors[side] = butal_other; butal_other->neighbors[side_opp] = butal; @@ -181,6 +186,7 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other } butal->dists[side] = butal_other->dists[side_opp] = delta; } + if (butal_can_align && butal_other_can_align) { const int side_s1 = SIDE1(side); const int side_s2 = SIDE2(side); |