diff options
Diffstat (limited to 'source/blender/io/stl/importer/stl_import_mesh.cc')
-rw-r--r-- | source/blender/io/stl/importer/stl_import_mesh.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/source/blender/io/stl/importer/stl_import_mesh.cc b/source/blender/io/stl/importer/stl_import_mesh.cc index de993cd2f27..b8ebba380ef 100644 --- a/source/blender/io/stl/importer/stl_import_mesh.cc +++ b/source/blender/io/stl/importer/stl_import_mesh.cc @@ -76,11 +76,9 @@ Mesh *STLMeshHelper::to_mesh(Main *bmain, char *mesh_name) id_us_min(&mesh->id); mesh->totvert = verts_.size(); - CustomData_add_layer(&mesh->vdata, CD_MVERT, CD_SET_DEFAULT, nullptr, mesh->totvert); - MutableSpan<MVert> verts = mesh->verts_for_write(); - for (int i = 0; i < mesh->totvert; i++) { - copy_v3_v3(verts[i].co, verts_[i]); - } + CustomData_add_layer_named( + &mesh->vdata, CD_PROP_FLOAT3, CD_CONSTRUCT, nullptr, mesh->totvert, "position"); + mesh->positions_for_write().copy_from(verts_); mesh->totpoly = tris_.size(); mesh->totloop = tris_.size() * 3; |