diff options
Diffstat (limited to 'source/blender/io')
8 files changed, 17 insertions, 4 deletions
diff --git a/source/blender/io/alembic/exporter/abc_subdiv_disabler.cc b/source/blender/io/alembic/exporter/abc_subdiv_disabler.cc index 514ce389e36..712b04f3992 100644 --- a/source/blender/io/alembic/exporter/abc_subdiv_disabler.cc +++ b/source/blender/io/alembic/exporter/abc_subdiv_disabler.cc @@ -14,6 +14,7 @@ #include "DNA_modifier_types.h" #include "DNA_object_types.h" +#include "BKE_layer.h" #include "BKE_modifier.h" namespace blender::io::alembic { @@ -34,7 +35,8 @@ void SubdivModifierDisabler::disable_modifiers() Scene *scene = DEG_get_input_scene(depsgraph_); ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph_); - LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { + BKE_view_layer_synced_ensure(scene, view_layer); + LISTBASE_FOREACH (Base *, base, BKE_view_layer_object_bases_get(view_layer)) { Object *object = base->object; if (object->type != OB_MESH) { diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc index 8f8acde7ba3..11c26fd2f72 100644 --- a/source/blender/io/alembic/intern/alembic_capi.cc +++ b/source/blender/io/alembic/intern/alembic_capi.cc @@ -617,6 +617,7 @@ static void import_endjob(void *user_data) /* Sync the collection, and do view layer operations. */ BKE_layer_collection_resync_allow(); BKE_main_collection_sync(data->bmain); + BKE_view_layer_synced_ensure(scene, view_layer); for (AbcObjectReader *reader : data->readers) { Object *ob = reader->object(); base = BKE_view_layer_base_find(view_layer, ob); diff --git a/source/blender/io/collada/BlenderContext.cpp b/source/blender/io/collada/BlenderContext.cpp index e76eea24dca..807488233ce 100644 --- a/source/blender/io/collada/BlenderContext.cpp +++ b/source/blender/io/collada/BlenderContext.cpp @@ -9,8 +9,11 @@ #include "BlenderContext.h" #include "ExportSettings.h" +#include "BKE_layer.h" #include "BKE_scene.h" +#include "BLI_listbase.h" + bool bc_is_base_node(LinkNode *export_set, Object *ob, const Scene *scene, ViewLayer *view_layer) { Object *root = bc_get_highest_exported_ancestor_or_self(export_set, ob, scene, view_layer); @@ -37,8 +40,8 @@ void bc_get_children(std::vector<Object *> &child_set, const Scene *scene, ViewLayer *view_layer) { - Base *base; - for (base = (Base *)view_layer->object_bases.first; base; base = base->next) { + BKE_view_layer_synced_ensure(scene, view_layer); + LISTBASE_FOREACH (Base *, base, BKE_view_layer_object_bases_get(view_layer)) { Object *cob = base->object; if (cob->parent == ob) { switch (ob->type) { diff --git a/source/blender/io/collada/collada_utils.cpp b/source/blender/io/collada/collada_utils.cpp index 82c471a6524..03bc14c6d13 100644 --- a/source/blender/io/collada/collada_utils.cpp +++ b/source/blender/io/collada/collada_utils.cpp @@ -197,6 +197,7 @@ Object *bc_add_object(Main *bmain, Scene *scene, ViewLayer *view_layer, int type LayerCollection *layer_collection = BKE_layer_collection_get_active(view_layer); BKE_collection_object_add(bmain, layer_collection->collection, ob); + BKE_view_layer_synced_ensure(scene, view_layer); Base *base = BKE_view_layer_base_find(view_layer, ob); /* TODO: is setting active needed? */ BKE_view_layer_base_select_and_set_active(view_layer, base); diff --git a/source/blender/io/gpencil/intern/gpencil_io_base.cc b/source/blender/io/gpencil/intern/gpencil_io_base.cc index b5838ad9485..bcf9a36c200 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_base.cc +++ b/source/blender/io/gpencil/intern/gpencil_io_base.cc @@ -20,6 +20,7 @@ #include "BKE_context.h" #include "BKE_gpencil.h" #include "BKE_gpencil_geom.h" +#include "BKE_layer.h" #include "BKE_main.h" #include "BKE_material.h" #include "BKE_scene.h" @@ -127,13 +128,15 @@ void GpencilIO::prepare_camera_params(Scene *scene, const GpencilIOParams *ipara void GpencilIO::create_object_list() { + Scene *scene = CTX_data_scene(params_.C); ViewLayer *view_layer = CTX_data_view_layer(params_.C); float3 camera_z_axis; copy_v3_v3(camera_z_axis, rv3d_->viewinv[2]); ob_list_.clear(); - LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { + BKE_view_layer_synced_ensure(scene, view_layer); + LISTBASE_FOREACH (Base *, base, BKE_view_layer_object_bases_get(view_layer)) { Object *object = base->object; if (object->type != OB_GPENCIL) { diff --git a/source/blender/io/stl/importer/stl_import.cc b/source/blender/io/stl/importer/stl_import.cc index 545d72e3350..e5fde6658ab 100644 --- a/source/blender/io/stl/importer/stl_import.cc +++ b/source/blender/io/stl/importer/stl_import.cc @@ -104,6 +104,7 @@ void importer_main(Main *bmain, Object *obj = BKE_object_add_only_object(bmain, OB_MESH, ob_name); BKE_mesh_assign_object(bmain, obj, mesh); BKE_collection_object_add(bmain, lc->collection, obj); + BKE_view_layer_synced_ensure(scene, view_layer); Base *base = BKE_view_layer_base_find(view_layer, obj); BKE_view_layer_base_select_and_set_active(view_layer, base); diff --git a/source/blender/io/usd/intern/usd_capi_import.cc b/source/blender/io/usd/intern/usd_capi_import.cc index 0487be3cc6d..54ad7ef5410 100644 --- a/source/blender/io/usd/intern/usd_capi_import.cc +++ b/source/blender/io/usd/intern/usd_capi_import.cc @@ -333,6 +333,7 @@ static void import_endjob(void *customdata) /* Sync the collection, and do view layer operations. */ BKE_layer_collection_resync_allow(); BKE_main_collection_sync(data->bmain); + BKE_view_layer_synced_ensure(scene, view_layer); for (USDPrimReader *reader : data->archive->readers()) { if (!reader) { continue; diff --git a/source/blender/io/wavefront_obj/importer/obj_importer.cc b/source/blender/io/wavefront_obj/importer/obj_importer.cc index 910fee0117a..ccbcce64d65 100644 --- a/source/blender/io/wavefront_obj/importer/obj_importer.cc +++ b/source/blender/io/wavefront_obj/importer/obj_importer.cc @@ -76,6 +76,7 @@ static void geometry_to_blender_objects(Main *bmain, /* Sync the collection after all objects are created. */ BKE_layer_collection_resync_allow(); BKE_main_collection_sync(bmain); + BKE_view_layer_synced_ensure(scene, view_layer); /* After collection sync, select objects in the view layer and do DEG updates. */ for (Object *obj : objects) { |