Blender Git Loki

Git Commits -> Revision 0f72541

July 30, 2021, 14:56 (GMT)
LayerCollection: Refactor of resync-with-Collection-hierarchy process.

The goal of this refactor is to improve resync of LayerCollections
hierarchy to match again Collection one.

Current code would destroy and re-create valid layers whenever a parent
collection would be removed, which leads to losing way too often
layer-related settings when editing collection hierarchies.

While this could be partially addressed from operators side, there was
no way to fix those issues from lower level, more generic ID management
code like ID remapping or library override resync processes.

The new code builds a shallow wrapper around existing (aka old) layers
hierarchy, does a set of checks to define the status of all existing
layers, and try to find the closest matching unused layer in cases where
layers and collections hierarchies do not match anymore.

The intent is to both re-use as much as possible existing layers, and
to pick the 'best' possible layer to re-use, following those heuristics:
* Prefer layers children of current one first (in old hierarchy), and only
use those from other higher-level hierarchies if no (grand-)child is found.
* Prefer to use closest layers available in the old hierarchy.

NOTE: The new code is about 12%-15% slower than the previous one, which is
expected given the increased complexity. Note that this would not be an
issue in practice if this code was not called way too often (needs to
be converted to lazy update instead, which is a long known TODO).

NOTE: The LayerCollectionResync code uses its own built-in version of
FIFO queue, as performances in this code is currently a critical point
(it can get called tens of thousands of times during a single (heavy)
ID management operation currently, in a production file e.g.).

Differential Revision: https://developer.blender.org/D12016

Commit Details:

Full Hash: 0f7254199b6d8d2e37031cf745a90d8f2be1e80f
Parent Commit: 7fa2e08
Committed By: Fabian Schempp
Lines Changed: +295, -67

1 Modified Path:

/source/blender/blenkernel/intern/layer.c (+295, -67) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021