diff options
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 6 | ||||
-rw-r--r-- | source/blender/blenloader/tests/blendfile_loading_base_test.cc | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index e4dc8d006ae..5cbfcb66bf9 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -512,12 +512,13 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) } } + BKE_view_layer_synced_ensure(scene, view_layer); /* for convenience set the same active object in all the layers */ if (scene->basact) { view_layer->basact = BKE_view_layer_base_find(view_layer, scene->basact->object); } - LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { + LISTBASE_FOREACH (Base *, base, BKE_view_layer_object_bases_get(view_layer)) { if ((base->flag & BASE_SELECTABLE) && (base->object->flag & SELECT)) { base->flag |= BASE_SELECTED; } @@ -537,13 +538,14 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) view_layer->flag &= ~VIEW_LAYER_RENDER; } + BKE_view_layer_synced_ensure(scene, view_layer); /* convert active base */ if (scene->basact) { view_layer->basact = BKE_view_layer_base_find(view_layer, scene->basact->object); } /* convert selected bases */ - LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { + LISTBASE_FOREACH (Base *, base, BKE_view_layer_object_bases_get(view_layer)) { if ((base->flag & BASE_SELECTABLE) && (base->object->flag & SELECT)) { base->flag |= BASE_SELECTED; } diff --git a/source/blender/blenloader/tests/blendfile_loading_base_test.cc b/source/blender/blenloader/tests/blendfile_loading_base_test.cc index 7df0ce944e4..615e30a728e 100644 --- a/source/blender/blenloader/tests/blendfile_loading_base_test.cc +++ b/source/blender/blenloader/tests/blendfile_loading_base_test.cc @@ -11,6 +11,7 @@ #include "BKE_global.h" #include "BKE_idtype.h" #include "BKE_image.h" +#include "BKE_layer.h" #include "BKE_main.h" #include "BKE_mball_tessellate.h" #include "BKE_modifier.h" @@ -125,6 +126,13 @@ bool BlendfileLoadingBaseTest::blendfile_load(const char *filepath) << test_assets_dir << "'"; return false; } + + /* Make sure that all view_layers in the file are synced. Depsgraph can make a copy of the whole + * scene, which will fail when one view layer isn't synced. */ + LISTBASE_FOREACH (ViewLayer *, view_layer, &bfile->curscene->view_layers) { + BKE_view_layer_synced_ensure(bfile->curscene, view_layer); + } + return true; } |