Page MenuHome

UI: Join or Close Any Area
ClosedPublic

Authored by Harley Acheson (harley) on Jun 20 2020, 7:18 PM.
Tokens
"The World Burns" token, awarded by Frozen_Death_Knight."Burninate" token, awarded by AlexeyAdamitsky."100" token, awarded by EAW."Love" token, awarded by hadrien."Pirate Logo" token, awarded by WCN."Love" token, awarded by PrettyFireNOI7."Love" token, awarded by animelix."Like" token, awarded by Lumpengnom."Love" token, awarded by hitrpr."Love" token, awarded by 1D_Inc."Love" token, awarded by vitos1k."Love" token, awarded by damian."Love" token, awarded by julperado."Love" token, awarded by Draise."Like" token, awarded by campbellbarton."Love" token, awarded by HARDNAX."Burninate" token, awarded by Blender_Defender."Like" token, awarded by TakingFire."Love" token, awarded by beyond."Like" token, awarded by Maged_afra."Love" token, awarded by dpdp."Love" token, awarded by jonathanl."Love" token, awarded by gilberto_rodrigues."Like" token, awarded by Kdaf."Love" token, awarded by symstract."Burninate" token, awarded by Slowwkidd."Like" token, awarded by DaveDeer."Burninate" token, awarded by shader."Love" token, awarded by radi0n."Love" token, awarded by brilliant_ape."Grey Medal" token, awarded by girafic."Love" token, awarded by mswf."Burninate" token, awarded by Hto-Ya."Grey Medal" token, awarded by duarteframos."Love" token, awarded by erickblender."Love" token, awarded by monio."Love" token, awarded by kioku.

Details

Summary

This patch allows the "Area Join" procedure to work between any two neighboring areas. This new method should yield more predicable results since it uses the same single and simple non-recursive process for all joins, so no corner cases and no falling back on failures since there are none.

One way to use this is with the corner "action zones"...

Or your can use the context menu that appears when you right-click on any border between areas:

Additionally, the menu you get by right-clicking on any header is organized better and includes a "Close" option that will always close the area and replace it with the expansion of a neighbor:

Diff Detail

Repository
rB Blender

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Harley Acheson (harley) planned changes to this revision.Mar 15 2021, 3:30 PM

This patch is working great as-is, but since this missed 2.93 I’m going to do some more experimenting. I have an idea for a single, generalized, non-recursive solution for all neighboring joins and want to see if could be implemented in an elegant way. Will see.

Just updating this version because of recent changes to master.

Harley Acheson (harley) planned changes to this revision.Mar 15 2021, 5:16 PM
Harley Acheson (harley) updated this revision to Diff 35361.EditedMar 18 2021, 11:32 PM
Harley Acheson (harley) retitled this revision from UI: Join or Close Any Area to UI WIP: Join or Close Any Area.

New algorithm for joining. Now uses a single simple non-recursive process for joining of all areas. So no more dealing with specific scenarios and no corner cases to worry about, just a single process. Gives a much more predictable result, but still has some latitude for tuning in the closing of extra areas. This method is also better suited to providing live feedback, so will consider that next.

Might need some defines and some rethinking of variable names and comments, but working well enough to test.

Some cleanup, new defines, better comments.

Harley Acheson (harley) updated this revision to Diff 35365.EditedMar 19 2021, 2:14 AM

Improved live feedback of where proposed join will occur.

Harley Acheson (harley) edited the summary of this revision. (Show Details)Mar 19 2021, 2:47 AM

Cleanup of the live preview code.

Compiled this, I really like it. The preview is elegant and helpful, and so are the results. I haven't looked further at the code yet though

/home/hans/Blender-Git/blender/source/blender/editors/screen/screen_draw.c:244:12: error: ‘return’ with a value, in function returning void [-Werror=return-type]
  244 |     return false;
      |            ^~~~~
source/blender/editors/screen/screen_edit.c
472

Looks like this can be made static

Updated to incorporate suggested changes by @Hans Goudey (HooglyBoogly)

...preview is elegant and helpful, and so are the results.

Thanks! I really like the ability to punch into areas, even bisecting them. So far feeling predictable and fun.

I haven't looked further at the code yet though

It is currently a net reduction in code, but probably too much so. The actual "join anything" code is a very straightforward 48 lines of screen_area_join(), although could use more comments. However it calls a new screen_area_trim() which is problematic to me. It is just 21 lines, but is far too terse and confusing. I need to find a way of doing that in a way that someone else will be able to follow (mostly the "vertical" and weird "reverse" arguments). That is mostly weird because of all the different orientations things can be in and because of how area_split() always returns smallest result no matter what you ask for.

Harley Acheson (harley) retitled this revision from UI WIP: Join or Close Any Area to UI: Join or Close Any Area.

Some reorganizing to make it easier to follow. Improved comments.

Harley Acheson (harley) edited the summary of this revision. (Show Details)Mar 19 2021, 7:50 PM

Not finding any errors, this is just some tuning changes.

When closing an area I was favoring a join from a neighbor that was most-aligned. However, there could could be multiple neighbors that are perfectly aligned. Although the closing works fine, which one it joined with would be unpredictable in the same circumstances. So added a tie-breaker, which is just to favor the larger area when alignment is the same.

When doing some joins the source and/or destination could be split (but never any other area). What happens with those extra areas afterward depends a bit on the circumstances. For example I want to always remove those extra areas when doing a "close" operation, but otherwise I quite often want to keep them if they are large enough. So I added an option to screen_area_join() on what to do with these things.

Feeling pretty buttery.

A bit simpler again. Realized I only needed differing behavior on closing join remainders for "close".

Misc changes - lots of time to test before 3.0

  • area_getorientation now testing for error of both areas being the same
  • properly showing user we don't allow joins of less than min sizes of areas.
  • simplified "close" code.

Experimenting with highlight method that can show areas joined and also partial areas that are closed.

Indication of the closing of partial areas now indicated much better.

Harley Acheson (harley) edited the summary of this revision. (Show Details)Mar 22 2021, 4:28 AM

Updated to current state of master, remove a whitespace error, and to further darken the sub-areas that would be closed.

Updating to current state of master, eternally hopeful that @Ton Roosendaal (ton) will review it one day...

Harley Acheson (harley) edited the summary of this revision. (Show Details)Apr 8 2021, 1:27 AM

Updating to the current state of master.

Campbell Barton (campbellbarton) requested changes to this revision.Apr 21 2021, 10:53 PM

Some notes.

  • Currently this allows joining areas not part of where the drag starts, this would allow accidental joins on drag.
  • The area type switcher changes color of the

Otherwise this works nicely.

This revision now requires changes to proceed.Apr 21 2021, 10:53 PM
  • The area type switcher changes color of the

I think this is related to T86450

Harley Acheson (harley) planned changes to this revision.Apr 21 2021, 11:51 PM

Will (attempt) to constrain the joining to only the two areas involved at the start.

Small simplification of area_getorientation(). No functional change.

Harley Acheson (harley) planned changes to this revision.Apr 22 2021, 3:47 AM

still trying to find a way to constrain where joins can occur.

  • The area type switcher changes color of the

I think this is related to T86450

Ah, seems so. No need to worry about it in this patch then.

@Campbell Barton (campbellbarton) - Currently this allows joining areas not part of where the drag starts, this would allow accidental joins on drag.

So far not finding a way to stop that in way that doesn't make it worse or add confusion.

Its actually very old behavior that we just don't notice much because currently we can't join as many areas. But if you line things up nicely you can see the exact same behavior in current master. In fact here you can see it working the same in 2.79:

Will keep experimenting to see If I find any solution that is nice.

Same behavior in 2.57 so this was introduced with the new window system for 2.5 series.

Harley Acheson (harley) requested review of this revision.Apr 23 2021, 12:43 AM

@Campbell Barton (campbellbarton) - Currently this allows joining areas not part of where the drag starts, this would allow accidental joins on drag.

This isn't a small and simple thing to just fix. What we are seeing here are conveniences built into Blender for about 10 years now, ever since we added the new editor system with the 2.5 series. The following shows changing join direction and source and target areas in 2.57.1:

This isn't accidental behavior but very specific code added for these features. area_join_modal() has comments showing the intent to allow both direction swap and to allow retargetting of the join areas. And I like both.

For me this comes down to the definition of "accidental" and the differences in us testing this versus users using it. Users will always start with the intention of joining two specific areas. But once that starts they are unlikely to change direction, change source, change target, etc until they are far from the original two areas, and then - even after seeing a clear indication of the areas that will join - decide to continue anyway. That seems quite a few intentional steps away from accidental. I can't imagine what the bug report would look like.

I think we should consider committing this, as is, early on in this cycle.

I'm aware joining regions is intended to work this way on a technical level (and even makes sense when activating in some cases), it's just that before this patch it's not possible to click-drag merge an area outside of the one that was clicked on, after this patch it is.

If this isn't related to the logic in this patch and, it seems fine to make this change separately.

This revision is now accepted and ready to land.Apr 23 2021, 1:46 AM

@Campbell Barton (campbellbarton) - ...it's just that before this patch it's not possible to click-drag merge an area outside of the one that was clicked on, after this patch it is.

Not trying to be difficult, but I'd like to know what you mean specifically so I can investigate. The following animated gif capture, using 2.57.1, shows "click-drag merge an area outside of the one that was clicked on" so AFAICT exactly the same.

I realize that this patch makes it far easier to do so, since it does not require areas to be perfectly aligned. So only wanting to clarify in the small case we are talking about different things.

When testing this initially I noticed it was possible to accidentally join regions compared to the current logic.

Joining areas not connected to the region dragged on.

Accidental mouse motion joining an area unintentionally seems like a more likely issue though.


In both cases I think this can be resolved by only joining areas connected to the first edge the cursor crosses over.

@Campbell Barton (campbellbarton) - In both cases I think this can be resolved by only joining areas connected to the first edge the cursor crosses over.

Yes, I am also pretty sure that will work. But there is a still a fair chance it might suck, so needs some testing. The spoiler will be the ability to change directions...

You drag from A to B. That is implying that you like A and don't want B. With above rule that would mean that you could then change your mind and drag from B to any neighbor. But that makes B the source (the one that will remain). And you can change your mind and move back to A (the one you initially preferred), but then from there cannot do much else. Why you get more stopsign cursors at A than B might seem confusing.

Might have to be when the operation starts A->B that you can allow any join to or from either of those two, but nobody else.

The last time I was looking in there (it is not touched by this patch) there it might be non-obvious how to show "stopsign" icon properly, just because of the way that area_getorientation() now works. I'd say leave it to me for a bit and I'll do it nicely.

Joining areas not connected to the region dragged on.

Thanks for making this. This does seems like a potential for confusion. Slowly, it looks like this. And not addressed by rules above.

Accidental mouse motion joining an area unintentionally seems like a more likely issue though.

Thanks. Yes, for good or ill this looks like my intended behavior. But I can see how shallow angles like that could weird. And this solution, assuming any area can join with any neighbor doesn't lend itself to changing behavior depending on drag angle.

I still think we have the bones for something better here. But it is possible that in end this will be a wonderful thing for experienced users who like using corner action zones, but the people who find them sucky will still find them sucky.

This revision was automatically updated to reflect the committed changes.

In case anyone comes here to say “this sucks!” there are a couple changes planned.

It is now too easy to change direction and target. This is most obvious at shallow angles: you intend to drag down yet wander too far left and it will guess that you are now wanting to join to the left. This can be addressed in a few different ways that ultimately makes it easier to continue at current direction at the expense of making it harder to change direction. End result is that it should feel more forgiving and work better for users with movement precision issues.

Second issue is a bit less important. Joining code (for 10 years) allows you to reverse direction and change area target while dragging. The combination of the two means you can start a join, reverse, change target, reverse, change, and in the end join areas far removed from the initial two areas. This was hard to experience before this patch, but easy to do now. W’ell probably limit this, probably so that the final two join areas must include one of the two initial areas. As long as that can work without feeling constraining or confusing.