[Bf-blender-cvs] [e68cf37413b] soc-2021-adaptive-cloth: cloth: fix: reset per vertex spring count when building springs

ishbosamiya noreply at git.blender.org
Sun Aug 22 17:23:40 CEST 2021


Commit: e68cf37413bb29e6238bd4f8a5cad19dc18821b9
Author: ishbosamiya
Date:   Thu Aug 19 16:58:26 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBe68cf37413bb29e6238bd4f8a5cad19dc18821b9

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.

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

M	source/blender/blenkernel/intern/cloth.c

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

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) {



More information about the Bf-blender-cvs mailing list