diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 524645a4bb2..49fb713ce06 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -601,7 +601,7 @@ bool DocumentImporter::writeMaterial(const COLLADAFW::Material *cmat) return true; const std::string& str_mat_id = cmat->getName().size() ? cmat->getName() : cmat->getOriginalId(); - Material *ma = BKE_material_add((char *)str_mat_id.c_str()); + Material *ma = BKE_material_add(G.main, (char *)str_mat_id.c_str()); this->uid_effect_map[cmat->getInstantiatedEffect()] = ma; this->uid_material_map[cmat->getUniqueId()] = ma; @@ -625,7 +625,7 @@ MTex *DocumentImporter::create_texture(COLLADAFW::EffectCommon *ef, COLLADAFW::T ma->mtex[i] = add_mtex(); ma->mtex[i]->texco = TEXCO_UV; - ma->mtex[i]->tex = add_texture("Texture"); + ma->mtex[i]->tex = add_texture(G.main, "Texture"); ma->mtex[i]->tex->type = TEX_IMAGE; ma->mtex[i]->tex->ima = uid_image_map[ima_uid]; @@ -831,8 +831,8 @@ bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera) cam_id = camera->getOriginalId(); cam_name = camera->getName(); - if (cam_name.size()) cam = (Camera *)BKE_camera_add((char *)cam_name.c_str()); - else cam = (Camera *)BKE_camera_add((char *)cam_id.c_str()); + if (cam_name.size()) cam = (Camera *)BKE_camera_add(G.main, (char *)cam_name.c_str()); + else cam = (Camera *)BKE_camera_add(G.main, (char *)cam_id.c_str()); if (!cam) { fprintf(stderr, "Cannot create camera.\n"); @@ -981,8 +981,8 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light) la_id = light->getOriginalId(); la_name = light->getName(); - if (la_name.size()) lamp = (Lamp *)BKE_lamp_add((char *)la_name.c_str()); - else lamp = (Lamp *)BKE_lamp_add((char *)la_id.c_str()); + if (la_name.size()) lamp = (Lamp *)BKE_lamp_add(G.main, (char *)la_name.c_str()); + else lamp = (Lamp *)BKE_lamp_add(G.main, (char *)la_id.c_str()); if (!lamp) { fprintf(stderr, "Cannot create lamp.\n"); diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index febfb772430..6d4e77f6a86 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -1296,7 +1296,7 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry *geom) } const std::string& str_geom_id = mesh->getName().size() ? mesh->getName() : mesh->getOriginalId(); - Mesh *me = BKE_mesh_add((char *)str_geom_id.c_str()); + Mesh *me = BKE_mesh_add(G.main, (char *)str_geom_id.c_str()); me->id.us--; // is already 1 here, but will be set later in set_mesh // store the Mesh pointer to link it later with an Object diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 7bdda387d5e..e000e603eae 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -151,7 +151,7 @@ Mesh *bc_to_mesh_apply_modifiers(Scene *scene, Object *ob, BC_export_mesh_type e } } - tmpmesh = BKE_mesh_add("ColladaMesh"); // name is not important here + tmpmesh = BKE_mesh_add(G.main, "ColladaMesh"); // name is not important here DM_to_mesh(dm, tmpmesh, ob); dm->release(dm); return tmpmesh;