diff options
Diffstat (limited to 'source/blender/collada/MeshImporter.cpp')
-rw-r--r-- | source/blender/collada/MeshImporter.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index e95f8ed0888..4a8fca6d3cd 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -207,8 +207,9 @@ void VCOLDataWrapper::get_vcol(int v_index, MLoopCol *mloopcol) } -MeshImporter::MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Scene *sce, ViewLayer *view_layer): +MeshImporter::MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Main *bmain, Scene *sce, ViewLayer *view_layer): unitconverter(unitconv), + m_bmain(bmain), scene(sce), view_layer(view_layer), armature_importer(arm) { @@ -1035,7 +1036,7 @@ void MeshImporter::assign_material_to_geom( // Attention! This temporaly assigns material to object on purpose! // See note above. ob->actcol=0; - assign_material(G.main, ob, ma, mat_index + 1, BKE_MAT_ASSIGN_OBJECT); + assign_material(m_bmain, ob, ma, mat_index + 1, BKE_MAT_ASSIGN_OBJECT); MaterialIdPrimitiveArrayMap& mat_prim_map = geom_uid_mat_mapping_map[*geom_uid]; COLLADAFW::MaterialId mat_id = cmaterial.getMaterialId(); @@ -1090,7 +1091,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta const char *name = (id.length()) ? id.c_str() : NULL; // add object - Object *ob = bc_add_object(scene, view_layer, OB_MESH, name); + Object *ob = bc_add_object(m_bmain, scene, view_layer, OB_MESH, name); bc_set_mark(ob); // used later for material assignement optimization @@ -1102,11 +1103,11 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta Mesh *old_mesh = (Mesh *)ob->data; Mesh *new_mesh = uid_mesh_map[*geom_uid]; - BKE_mesh_assign_object(G.main, ob, new_mesh); + BKE_mesh_assign_object(m_bmain, ob, new_mesh); BKE_mesh_calc_normals(new_mesh); id_us_plus(&old_mesh->id); /* Because BKE_mesh_assign_object would have already decreased it... */ - BKE_libblock_free_us(G.main, old_mesh); + BKE_libblock_free_us(m_bmain, old_mesh); COLLADAFW::MaterialBindingArray& mat_array = geom->getMaterialBindings(); @@ -1145,7 +1146,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(G.main, (char *)str_geom_id.c_str()); + Mesh *me = BKE_mesh_add(m_bmain, (char *)str_geom_id.c_str()); id_us_min(&me->id); // is already 1 here, but will be set later in BKE_mesh_assign_object // store the Mesh pointer to link it later with an Object |