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.
This commit is contained in:
2021-06-23 12:07:47 +02:00
parent e291432f5f
commit eed9ac5b6e

View File

@@ -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;