diff options
author | ishbosamiya <ishbosamiya@gmail.com> | 2021-08-19 14:28:26 +0300 |
---|---|---|
committer | ishbosamiya <ishbosamiya@gmail.com> | 2021-08-19 14:28:26 +0300 |
commit | e68cf37413bb29e6238bd4f8a5cad19dc18821b9 (patch) | |
tree | e30c529ffe2e225150d8ffa4bb3fa425afe96c64 | |
parent | 5afe71daf54212c3488306c986fb73504183bfb6 (diff) |
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.
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 2 |
1 files changed, 2 insertions, 0 deletions
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) { |