[Bf-blender-cvs] [a9b67ae19f0] temp-vert-normals-cleanup: Fix warning in solidify non-manifold code

Hans Goudey noreply at git.blender.org
Wed Jan 5 18:11:26 CET 2022


Commit: a9b67ae19f02707b5f3f85ecb0a4eda4c7dc2848
Author: Hans Goudey
Date:   Tue Jan 4 23:41:30 2022 -0600
Branches: temp-vert-normals-cleanup
https://developer.blender.org/rBa9b67ae19f02707b5f3f85ecb0a4eda4c7dc2848

Fix warning in solidify non-manifold code

===================================================================

M	source/blender/modifiers/intern/MOD_solidify_nonmanifold.c

===================================================================

diff --git a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
index c8c36262175..1aa52d44509 100644
--- a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
+++ b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
@@ -214,8 +214,9 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
 
 #define MOD_SOLIDIFY_EMPTY_TAG ((uint)-1)
 
-  /* Calculate only face normals. */
-  float(*poly_nors)[3] = BKE_mesh_poly_normals_ensure(mesh);
+  /* Calculate only face normals. Copied because they are modified directly below. */
+  float(*poly_nors)[3] = MEM_malloc_arrayN(numPolys, sizeof(float[3]), __func__);
+  memcpy(poly_nors, BKE_mesh_poly_normals_ensure(mesh), sizeof(float[3]) * numPolys);
 
   NewFaceRef *face_sides_arr = MEM_malloc_arrayN(
       numPolys * 2, sizeof(*face_sides_arr), "face_sides_arr in solidify");
@@ -2560,6 +2561,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
       MEM_freeN(p->link_edges);
     }
     MEM_freeN(face_sides_arr);
+    MEM_freeN(poly_nors);
   }
 
 #undef MOD_SOLIDIFY_EMPTY_TAG



More information about the Bf-blender-cvs mailing list