Cleanup: Don't set mesh normals directly for metaballs

At the cost of a memory copy, this allows using a C++ type to store
normals in mesh runtime data in upcoming patches.
This commit is contained in:
Hans Goudey 2022-11-16 12:37:35 -06:00
parent 99c970a94d
commit 89ca298210
1 changed files with 4 additions and 1 deletions

View File

@ -1499,7 +1499,10 @@ Mesh *BKE_mball_polygonize(Depsgraph *depsgraph, Scene *scene, Object *ob)
for (int i = 0; i < mesh->totvert; i++) {
normalize_v3(process.no[i]);
}
mesh->runtime->vert_normals = process.no;
memcpy(BKE_mesh_vertex_normals_for_write(mesh),
process.no,
sizeof(float[3]) * size_t(mesh->totvert));
MEM_freeN(process.no);
BKE_mesh_vertex_normals_clear_dirty(mesh);
mesh->totloop = loop_offset;