From 6a3c3c77b3ebdbcd44559bf91ea7d5cf3c5e4953 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 19 Apr 2022 17:08:02 -0500 Subject: Mesh: Avoid unnecessary normal calculation and dirty tags This is mostly a cleanup to avoid hardcoding the eager calculation of normals it isn't necessary, by reducing calls to `BKE_mesh_calc_normals` and by removing calls to `BKE_mesh_normals_tag_dirty` when the mesh is newly created and already has dirty normals anyway. This reduces boilerplate code and makes the "dirty by default" state more clear. Any regressions from this commit should be easy to fix, though the lazy calculation is solid enough that none are expected. --- source/blender/blenkernel/intern/cloth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/cloth.c') diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index f7454a02de6..0d6a0c045a5 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -1171,6 +1171,7 @@ static Mesh *cloth_make_rest_mesh(ClothModifierData *clmd, Mesh *mesh) for (unsigned i = 0; i < mesh->totvert; i++, verts++) { copy_v3_v3(mvert[i].co, verts->xrest); } + BKE_mesh_normals_tag_dirty(new_mesh); return new_mesh; } @@ -1507,7 +1508,6 @@ static bool cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) if (clmd->sim_parms->shapekey_rest && !(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_DYNAMIC_BASEMESH)) { tmp_mesh = cloth_make_rest_mesh(clmd, mesh); - BKE_mesh_calc_normals(tmp_mesh); } EdgeSet *existing_vert_pairs = BLI_edgeset_new("cloth_sewing_edges_graph"); -- cgit v1.2.3