[Bf-blender-cvs] [eed9ac5b6e2] master: Fix Scene/MasterCollection handling in `BKE_main_collection_sync_remap()`.

Bastien Montagne noreply at git.blender.org
Wed Jun 23 12:15:16 CEST 2021


Commit: eed9ac5b6e28ee4986cc639befd5819698407ad8
Author: Bastien Montagne
Date:   Wed Jun 23 12:07:47 2021 +0200
Branches: master
https://developer.blender.org/rBeed9ac5b6e28ee4986cc639befd5819698407ad8

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.

===================================================================

M	source/blender/blenkernel/intern/layer.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list