diff options
author | Bastien Montagne <bastien@blender.org> | 2021-07-12 17:03:46 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-07-26 18:36:46 +0300 |
commit | abf3ce811f6e33213a51941b477668750d45c5b4 (patch) | |
tree | fb7d706710472120312d5d4e2e5cf6062f588541 /source/blender/blenkernel/intern/lib_override.c | |
parent | cee67f3be2b3af987a34bb48f909ffad51c4eb0f (diff) |
LayerCollections: Add a way to prevent their resync with Collection hierarchy.
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.
NOTE: This is not a proper fix for the underlying issue. However,
implementing and testing the 'lazy update' solution as proposed by
{T73411} 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 is not possible currently.
Differential Revision: https://developer.blender.org/D11889
Diffstat (limited to 'source/blender/blenkernel/intern/lib_override.c')
-rw-r--r-- | source/blender/blenkernel/intern/lib_override.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c index 9871bf5dc83..0ef9692f7e5 100644 --- a/source/blender/blenkernel/intern/lib_override.c +++ b/source/blender/blenkernel/intern/lib_override.c @@ -1722,6 +1722,11 @@ void BKE_lib_override_library_main_resync(Main *bmain, COLLECTION_RESTRICT_RENDER; } + /* Necessary to improve performances, and prevent layers matching override sub-collections to be + * lost when re-syncing the parent override collection. + * Ref. T73411. */ + BKE_layer_collection_resync_forbid(); + int library_indirect_level = lib_override_libraries_index_define(bmain); while (library_indirect_level >= 0) { /* Update overrides from each indirect level separately. */ @@ -1734,6 +1739,8 @@ void BKE_lib_override_library_main_resync(Main *bmain, library_indirect_level--; } + BKE_layer_collection_resync_allow(); + /* Essentially ensures that potentially new overrides of new objects will be instantiated. */ lib_override_library_create_post_process( bmain, scene, view_layer, NULL, NULL, override_resync_residual_storage, true); |