Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-06-23 13:07:47 +0300
committerBastien Montagne <bastien@blender.org>2021-06-23 13:15:09 +0300
commiteed9ac5b6e28ee4986cc639befd5819698407ad8 (patch)
tree257a9f0e15cc6365fa31e36d97902907954d84e7
parente291432f5f89e67f03e89ca59efea9004d7a8eca (diff)
Fix Scene/MasterCollection handling in `BKE_main_collection_sync_remap()`.
Those were missing proper (explicit) object cache clear, and DEG tagging. Note that this was most likely not an common issue in practice (Collection object cache clearing recursively goes into all parents, so master collection would only miss it in case they had no child collections at all, and tagging of those happens almost always at other steps on remapping). But better to be explicit and consistent here in any case.
-rw-r--r--source/blender/blenkernel/intern/layer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 2ac10586fd9..fb9c38f51b7 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1000,7 +1000,7 @@ void BKE_main_collection_sync_remap(const Main *bmain)
/* On remapping of object or collection pointers free caches. */
/* TODO: try to make this faster */
- for (const Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
MEM_SAFE_FREE(view_layer->object_bases_array);
@@ -1009,6 +1009,10 @@ void BKE_main_collection_sync_remap(const Main *bmain)
view_layer->object_bases_hash = NULL;
}
}
+
+ BKE_collection_object_cache_free(scene->master_collection);
+ DEG_id_tag_update_ex((Main *)bmain, &scene->master_collection->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_id_tag_update_ex((Main *)bmain, &scene->id, ID_RECALC_COPY_ON_WRITE);
}
for (Collection *collection = bmain->collections.first; collection;