This is an easy & safe, yet not-so-nice way to address the
LayerCollections vs. Collections hierarchy resync problem.
Currently this resync is enforced everytime something changes in the
Collections hierarchy, which is extremely inneficient, and can even
produce 'loss' of LayerCollection data during complex Collection
processes.
Current example is during Library Overrides resync process. New code:
- Makes resync significantly faster (between 10 and 15%).
- Fixes 'disappearing' layer collections settings on sub-collections' layers.
I am fully aware that this is not a proper fix for this issue. However,
implementing and testing the 'lazy update' solution as proposed by
T73411: Fix ViewLayers cache building requires a significant amount of time (especially in testing
and tracking all places where code would need to ensure LayerCollections
are up-to-date), which I do not have currently.
And this fixes an annoying issue for the studio (layers of sub-collections
losing their 'exclude' settings on every resync). With the extra benefit
of making insane production .blend files loading going from e.g
8m50s to 7m40s...
So I think this can be accepted as temporary fix.
Proper fix (lazy update) should be part of a 'Core technical dept fix'
project I think...