diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 22 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc | 27 |
2 files changed, 21 insertions, 28 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 5760e13b800..5d974192241 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -204,8 +204,24 @@ static SceneCollection *scene_collection_from_new_tree(SceneCollection *sc_refer return NULL; } +static void layer_collections_sync_flags(ListBase *layer_collections_dst, const ListBase *layer_collections_src) +{ + LayerCollection *layer_collection_dst = (LayerCollection *)layer_collections_dst->first; + const LayerCollection *layer_collection_src = (const LayerCollection *)layer_collections_src->first; + while (layer_collection_dst != NULL) { + layer_collection_dst->flag = layer_collection_src->flag; + layer_collections_sync_flags(&layer_collection_dst->layer_collections, + &layer_collection_src->layer_collections); + /* TODO(sergey/dfelinto): Overrides. */ + layer_collection_dst = layer_collection_dst->next; + layer_collection_src = layer_collection_src->next; + } +} + + /* recreate the LayerCollection tree */ -static void layer_collections_recreate(SceneLayer *sl_dst, ListBase *lb_src, SceneCollection *mc_dst, SceneCollection *mc_src) +static void layer_collections_recreate( + SceneLayer *sl_dst, ListBase *lb_src, SceneCollection *mc_dst, SceneCollection *mc_src) { for (LayerCollection *lc_src = lb_src->first; lc_src; lc_src = lc_src->next) { SceneCollection *sc_dst = scene_collection_from_new_tree(lc_src->scene_collection, mc_dst, mc_src); @@ -269,8 +285,12 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons BLI_listbase_clear(&sl_dst->layer_collections); BLI_listbase_clear(&sl_dst->object_bases); BLI_listbase_clear(&sl_dst->drawdata); + layer_collections_recreate(sl_dst, &sl_src->layer_collections, mc_dst, mc_src); + /* Now we handle the syncing for visibility, selectability, ... */ + layer_collections_sync_flags(&sl_dst->layer_collections, &sl_src->layer_collections); + Object *active_ob = OBACT_NEW(sl_src); for (Base *base_src = sl_src->object_bases.first, *base_dst = sl_dst->object_bases.first; base_src; diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 294e5e9651e..3184c7c9066 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -279,21 +279,6 @@ bool id_copy_no_main(const ID *id, ID **newid) return result; } -void layer_collections_sync_flags(ListBase *layer_collections_dst, - const ListBase *layer_collections_src) -{ - LayerCollection *layer_collection_dst = (LayerCollection *)layer_collections_dst->first; - const LayerCollection *layer_collection_src = (const LayerCollection *)layer_collections_src->first; - while (layer_collection_dst != NULL) { - layer_collection_dst->flag = layer_collection_src->flag; - layer_collections_sync_flags(&layer_collection_dst->layer_collections, - &layer_collection_src->layer_collections); - /* TODO(sergey): Overrides. */ - layer_collection_dst = layer_collection_dst->next; - layer_collection_src = layer_collection_src->next; - } -} - /* Similar to BKE_scene_copy() but does not require main. * * TODO(sergey): Get rid of this once T51804 is handled. @@ -316,18 +301,6 @@ Scene *scene_copy_no_main(Scene *scene) (Scene *)id_for_copy, SCE_COPY_LINK_OB); - /* TODO(sergey): Make this part of BKE_scene_copy(). */ - { - SceneLayer *new_scene_layer = (SceneLayer *)new_scene->render_layers.first; - const SceneLayer *scene_layer = (const SceneLayer *)scene->render_layers.first; - while (new_scene_layer != NULL) { - layer_collections_sync_flags(&new_scene_layer->layer_collections, - &scene_layer->layer_collections); - new_scene_layer = new_scene_layer->next; - scene_layer = scene_layer->next; - } - } - #ifdef NESTED_ID_NASTY_WORKAROUND nested_id_hack_restore_pointers(&scene->id, &new_scene->id); #endif |