Page MenuHome

UI: Improvements to Tolerant Area Joins
AbandonedPublic

Authored by Harley Acheson (harley) on Sep 8 2019, 9:02 PM.

Details

Summary

TL;DR version: fixes issues like those shown in the video at the end of this page: https://developer.blender.org/rB6d37654ce8e0d442741d284bb36536aa75078c33

Long Version:

My earlier changes to area joins works great in most simple situations, but will fail in some complex arrangements. It was a bit naive. For example both areas to be joined could have multiple simultaneous neighbors on all edges, so it isn't enough to consider only the edges of the two areas to be joined. All edges must be examined and multiples potentially changed.

This fixes that perfectly. It starts by adding two helper routines, screen_edges_halign() & screen_edges_valign(), which can vertically or horizontally align screen verts within a range. So if you have a number of vertical edges for different areas that are within a tolerance, they can all be set to a new value without affecting horizontal position. Or so the same for horizontal edges.

Then screen_areas_align() is added that takes two screen areas and an int that specifies their relationship (output from area_getorientation()). This adjusts all screen edges to allow the two areas to be merged.

For example if we have two areas that are to be merged vertically, so sharing a horizontal edge. We have to adjust all vertical edges that exactly match the horizontal positions of the two area's vertical edges. All of them are changed to a new value based on an average taken from the two areas to be joined. Further, because this uses an average my very conservative tolerance value is increased a bit (to just half of a U.widget_unit). In theory there could be many times when this tolerance could be much greater, but will require a bit more work to examine the edge lengths, and will be a fun exercise for later.

Diff Detail

Repository
rB Blender

Event Timeline

Updated to current state of master.

Join tolerance increased again, now a full widget_unit. The value just needs to remain less than header height. Have found not times when this screws up, but very nice to have this even more forgiving.

Also made some small changes to screen_edges_valign() and screen_edges_halign() so they can be used for (possible) future Edge Alignment and Break Alignment operators.

Here's a good example of how tolerate the joins can be after this patch is applied:

Harley Acheson (harley) updated this revision to Diff 19211.EditedOct 27 2019, 8:08 PM

Updated to current state of master. Also adds an "Align Edges" operator. So if you right-click on an edge that has other similar edges you can align them. Why? Because when edges are perfectly aligned Blender treats them as one, so you can drag them both together. But it is difficult to manually put them into such a state because that would require you dragging them to the same pixel.

@Harley Acheson (harley) Is this patch still relevant with D8084 and other improvements you've done more recently?