Blender Git Commit Log

Git Commits -> Revision b18d024

Revision b18d024 by Bastien Montagne (master)
July 28, 2021, 13:51 (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: b18d0244fc075ad39693c9cfc980ab44a00bfd65
Parent Commit: 31fcb93
Lines Changed: +295, -67

1 Modified Path:

/source/blender/blenkernel/intern/layer.c (+295, -67) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021