[Bf-blender-cvs] [6af61d081bb] temp-vert-normals-cleanup: Cleanup: Use ensure poly normals in solidify functions
Hans Goudey
noreply at git.blender.org
Wed Dec 29 21:45:39 CET 2021
Commit: 6af61d081bbbcbe7e126487b804f0f4467f665d5
Author: Hans Goudey
Date: Wed Dec 29 14:45:21 2021 -0600
Branches: temp-vert-normals-cleanup
https://developer.blender.org/rB6af61d081bbbcbe7e126487b804f0f4467f665d5
Cleanup: Use ensure poly normals in solidify functions
===================================================================
M source/blender/modifiers/intern/MOD_solidify_extrude.c
M source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
===================================================================
diff --git a/source/blender/modifiers/intern/MOD_solidify_extrude.c b/source/blender/modifiers/intern/MOD_solidify_extrude.c
index a91ceb0b3df..992061668bf 100644
--- a/source/blender/modifiers/intern/MOD_solidify_extrude.c
+++ b/source/blender/modifiers/intern/MOD_solidify_extrude.c
@@ -244,14 +244,7 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
if (need_poly_normals) {
/* calculate only face normals */
- poly_nors = MEM_malloc_arrayN(numPolys, sizeof(*poly_nors), __func__);
- BKE_mesh_calc_normals_poly(orig_mvert,
- (int)numVerts,
- orig_mloop,
- (int)numLoops,
- orig_mpoly,
- (int)numPolys,
- poly_nors);
+ poly_nors = BKE_mesh_poly_normals_ensure(mesh);
}
STACK_INIT(new_vert_arr, numVerts * 2);
@@ -1216,10 +1209,6 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
MEM_freeN(old_vert_arr);
}
- if (poly_nors) {
- MEM_freeN(poly_nors);
- }
-
return result;
}
diff --git a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
index 997f5943060..9b634065cbe 100644
--- a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
+++ b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
@@ -170,8 +170,6 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
const short mat_ofs = mat_nrs > 1 ? smd->mat_ofs : 0;
const short mat_ofs_rim = mat_nrs > 1 ? smd->mat_ofs_rim : 0;
- float(*poly_nors)[3] = NULL;
-
/* #ofs_front and #ofs_back are the offset from the original
* surface along the normal, where #oft_front is along the positive
* and #oft_back is along the negative normal. */
@@ -218,9 +216,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
#define MOD_SOLIDIFY_EMPTY_TAG ((uint)-1)
/* Calculate only face normals. */
- poly_nors = MEM_malloc_arrayN(numPolys, sizeof(*poly_nors), __func__);
- BKE_mesh_calc_normals_poly(
- orig_mvert, (int)numVerts, orig_mloop, (int)numLoops, orig_mpoly, (int)numPolys, poly_nors);
+ float(*poly_nors)[3] = BKE_mesh_poly_normals_ensure(mesh);
NewFaceRef *face_sides_arr = MEM_malloc_arrayN(
numPolys * 2, sizeof(*face_sides_arr), "face_sides_arr in solidify");
@@ -2565,7 +2561,6 @@ 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