Fix T101394: Ensure all viewlayers on scene copy.

When a scene copy is called, all viewlayers are ensured before they are
copied. In case of multiple viewlayers, a viewlayer can be out of sync.
This triggers an assert in the BKE_view_layer_copy_data.

Reviewed By: mont29

Maniphest Tasks: T101394

Differential Revision: https://developer.blender.org/D16214
This commit is contained in:
Monique Dewanchand 2022-10-16 11:16:07 +02:00 committed by Monique
parent 0c50f9c4aa
commit 4c320e2639
Notes: blender-bot 2023-02-14 08:35:51 +01:00
Referenced by issue #101394, Importing file after making a new collection active hits an assert (View Layer Object Base out of sync)
1 changed files with 3 additions and 0 deletions

View File

@ -280,6 +280,9 @@ static void scene_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int
}
/* View Layers */
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene_src->view_layers) {
BKE_view_layer_synced_ensure(scene_src, view_layer);
}
BLI_duplicatelist(&scene_dst->view_layers, &scene_src->view_layers);
for (ViewLayer *view_layer_src = static_cast<ViewLayer *>(scene_src->view_layers.first),
*view_layer_dst = static_cast<ViewLayer *>(scene_dst->view_layers.first);