diff options
Diffstat (limited to 'source/blender/collada/DocumentImporter.cpp')
-rw-r--r-- | source/blender/collada/DocumentImporter.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index f7fdfb06a40..bc986f11394 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -57,12 +57,13 @@ extern "C" { #include "BLI_fileops.h" #include "BKE_camera.h" +#include "BKE_collection.h" #include "BKE_main.h" +#include "BKE_layer.h" #include "BKE_lamp.h" #include "BKE_library.h" #include "BKE_texture.h" #include "BKE_fcurve.h" -#include "BKE_depsgraph.h" #include "BKE_scene.h" #include "BKE_global.h" #include "BKE_material.h" @@ -82,6 +83,9 @@ extern "C" { } +#include "DEG_depsgraph.h" +#include "DEG_depsgraph_build.h" + #include "ExtraHandler.h" #include "ErrorHandler.h" #include "DocumentImporter.h" @@ -130,7 +134,7 @@ bool DocumentImporter::import() loader.registerExtraDataCallbackHandler(ehandler); // deselect all to select new objects - BKE_scene_base_deselect_all(CTX_data_scene(mContext)); + BKE_scene_layer_base_deselect_all(CTX_data_scene_layer(mContext)); std::string mFilename = std::string(this->import_settings->filepath); const std::string encodedFilename = bc_url_encode(mFilename); @@ -230,7 +234,7 @@ void DocumentImporter::finish() } // update scene - DAG_relations_tag_update(bmain); + DEG_relations_tag_update(bmain); WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, NULL); } @@ -241,7 +245,7 @@ void DocumentImporter::finish() armature_importer.set_tags_map(this->uid_tags_map); armature_importer.make_armatures(mContext, *objects_to_scale); armature_importer.make_shape_keys(); - DAG_relations_tag_update(bmain); + DEG_relations_tag_update(bmain); #if 0 armature_importer.fix_animation(); @@ -263,19 +267,11 @@ void DocumentImporter::finish() std::vector<Object *>::iterator it; for (it = libnode_ob.begin(); it != libnode_ob.end(); it++) { Object *ob = *it; - - Base *base = BKE_scene_base_find(sce, ob); - if (base) { - BLI_remlink(&sce->base, base); - BKE_libblock_free_us(G.main, base->object); - if (sce->basact == base) - sce->basact = NULL; - MEM_freeN(base); - } + BKE_collections_object_remove(G.main, sce, ob, true); } libnode_ob.clear(); - DAG_relations_tag_update(bmain); + DEG_relations_tag_update(bmain); } bc_match_scale(objects_to_scale, unit_converter, !this->import_settings->import_units); @@ -413,8 +409,8 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod fprintf(stderr, "create <instance_node> under node id=%s from node id=%s\n", instance_node ? instance_node->getOriginalId().c_str() : NULL, source_node ? source_node->getOriginalId().c_str() : NULL); Object *obn = BKE_object_copy(G.main, source_ob); - DAG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); - BKE_scene_base_add(sce, obn); + DEG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); + BKE_collection_object_add_from(sce, source_ob, obn); if (instance_node) { anim_importer.read_node_transform(instance_node, obn); |