diff options
author | Hans Goudey <h.goudey@me.com> | 2022-02-26 01:18:07 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-02-26 01:18:07 +0300 |
commit | 7aa0be4b32bdbee61ea732f43175c8bc6585fc98 (patch) | |
tree | 2fa20485aeb2380d7191b5393c7c4a208b5f482b /source/blender/modifiers | |
parent | a911f075d7aa823b215d4e7baf91ea4f5bd6099c (diff) |
Fix: Failing OBJ export tests due to mesh normals commit
In some cases, the normal edit modifier calculated the normals on one
mesh with the "ensure" functions, then copied the mesh and retrieved
the layers "for write" on the copy. Since 59343ee1627f4c369e23, normal
layers are never copied, and normals are allocated with malloc instead
of calloc, so the mutable memory was uninitialized.
Fix by calculating normals on the correct mesh, and also add a warning
to the "for write" functions in the header.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_normal_edit.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c index 61099fedf46..642c0f0180f 100644 --- a/source/blender/modifiers/intern/MOD_normal_edit.c +++ b/source/blender/modifiers/intern/MOD_normal_edit.c @@ -551,8 +551,8 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd, CustomData *ldata = &result->ldata; - const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(mesh); - const float(*poly_normals)[3] = BKE_mesh_poly_normals_ensure(mesh); + const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(result); + const float(*poly_normals)[3] = BKE_mesh_poly_normals_ensure(result); clnors = CustomData_get_layer(ldata, CD_CUSTOMLOOPNORMAL); if (use_current_clnors) { |