From cccc6d6905be7ac32cbe8649faf6b17e9c9f636e Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 30 Aug 2022 16:27:43 -0500 Subject: Mesh: Avoid redundant custom data layer initialization In all these cases, it was clear that the layer values were set right after the layer was created anyway. So there's no point in using calloc or setting the values to zero first. See 25237d2625078c6d for more info. --- source/blender/io/alembic/intern/abc_customdata.cc | 2 +- source/blender/io/stl/importer/stl_import_mesh.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/io') diff --git a/source/blender/io/alembic/intern/abc_customdata.cc b/source/blender/io/alembic/intern/abc_customdata.cc index 644990afb35..9c71944fc92 100644 --- a/source/blender/io/alembic/intern/abc_customdata.cc +++ b/source/blender/io/alembic/intern/abc_customdata.cc @@ -540,7 +540,7 @@ void read_generated_coordinates(const ICompoundProperty &prop, cd_data = CustomData_get_layer(&mesh->vdata, CD_ORCO); } else { - cd_data = CustomData_add_layer(&mesh->vdata, CD_ORCO, CD_SET_DEFAULT, nullptr, totvert); + cd_data = CustomData_add_layer(&mesh->vdata, CD_ORCO, CD_CONSTRUCT, nullptr, totvert); } float(*orcodata)[3] = static_cast(cd_data); diff --git a/source/blender/io/stl/importer/stl_import_mesh.cc b/source/blender/io/stl/importer/stl_import_mesh.cc index 7686bfa1247..178b5b9347f 100644 --- a/source/blender/io/stl/importer/stl_import_mesh.cc +++ b/source/blender/io/stl/importer/stl_import_mesh.cc @@ -87,7 +87,7 @@ Mesh *STLMeshHelper::to_mesh(Main *bmain, char *mesh_name) mesh->mpoly = static_cast( CustomData_add_layer(&mesh->pdata, CD_MPOLY, CD_SET_DEFAULT, nullptr, mesh->totpoly)); mesh->mloop = static_cast( - CustomData_add_layer(&mesh->ldata, CD_MLOOP, CD_SET_DEFAULT, nullptr, mesh->totloop)); + CustomData_add_layer(&mesh->ldata, CD_MLOOP, CD_CONSTRUCT, nullptr, mesh->totloop)); threading::parallel_for(tris_.index_range(), 2048, [&](IndexRange tris_range) { for (const int i : tris_range) { -- cgit v1.2.3