Page MenuHome

Least Astonishment in LayerCollection.exclude
Needs ReviewPublic

Authored by Szymon Ulatowski (szulat) on Mar 4 2020, 2:39 AM.

Details

Summary

My friend, who uses Collections for creating "configurable" backgrounds for product photography, complained a lot about the most annoying thing about Collections: disabling and re-enabling a Collection is "destructive": for the lower levels of the Collection hierarchy, all children are simply enabled, regardless of their previous state. At first, it looks like a plain oversight; now, after playing with the code I learned the intended behavior is not so obvious and the current "enable everything" handing was probably chosen for being safe and good enough.

Still, I'd like to share my thoughts and the patch for changing the default behavior.

Before:

After:

The thing works by simply saving the previous state of the Child's EXCLUDE flag (in the next free bit of flags) whenever the Parent Collection wants to exclude the Child so then it can be restored when the parent is reenabled.

Advantages:

  • For most uses it behaves exactly as the current "enable all" approach: if you don't disable individual Collections, they will still be disabled and enabled by their parent checkboxes as usual. If you enable individual Collections inside another Collection then probably you want them to retain their individual state and you don't want the default behavior.
  • Disabling and then reenabling the same checkbox brings back the previous state (and I really feel disturbed when it does not happen in any application!)
  • Relatively simple and harmless, as it just limits how the existing recursive "exclude" property is propagated

Disadvantages:

  • in Collection trees of 3 and more levels it is possible to change the state in a way that is no longer obvious. See the picture below:


Red checkmarks in the picture is the hidden stored state of checkbox remembering its previous exclusion state. What is weird, enabling "Room" in picture 5 restores the "Round table" but it does not restore "Furniture", this is because "Furniture" was previously disabled manually (clicking in picture 3) but it feels wrong. Not a disaster, because you will always see what is affected by your clicking, but the alternate SHIFT+click for enabling all children would be useful.
I wonder if the ideal behavior is even possible and if it is possible assuming we only devote one flag bit for collection...

For serious development I guess it would need more changes, perhaps making the new flag accessible thorugh RNA? handle versioning? (although the default value of 0 of the new flag just works).

Tell me what you think :) and please forgive any awkwardness, this is my first contact with the blender source!

Diff Detail

Repository
rB Blender
Branch
previously_excluded (branched from master)
Build Status
Buildable 7094
Build 7094: arc lint + arc unit

Event Timeline

Szymon Ulatowski (szulat) retitled this revision from remember previously excluded collections to Least Astonishment in LayerCollection.exclude.Mar 4 2020, 3:41 AM
Szymon Ulatowski (szulat) edited the summary of this revision. (Show Details)

The functionality seems fine to me, just need to review the implementation.

This revision now requires changes to proceed.Tue, Mar 10, 11:21 AM

Obey the comments style guide