From e68cf37413bb29e6238bd4f8a5cad19dc18821b9 Mon Sep 17 00:00:00 2001 From: ishbosamiya Date: Thu, 19 Aug 2021 16:58:26 +0530 Subject: cloth: fix: reset per vertex spring count when building springs While building the structural springs, the vertices that connect the springs, their spring count is incremented. Since the springs are being rebuilt entirely, the spring count should also be reset. --- source/blender/blenkernel/intern/cloth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 1e99921b911..ff304cf7c7e 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -1715,9 +1715,11 @@ bool cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) BLI_rng_free(rng); } + /* Reset the spring length and spring count */ clmd->sim_parms->avg_spring_len = 0.0f; for (int i = 0; i < mvert_num; i++) { cloth->verts[i].avg_spring_len = 0.0f; + cloth->verts[i].spring_count = 0; } if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SEW) { -- cgit v1.2.3