[Bf-blender-cvs] [81ab9ef968d] blender2.7: Fix T56595: Hair Dynamics stop working after saving new file

Sergey Sharybin noreply at git.blender.org
Thu Dec 27 11:42:03 CET 2018


Commit: 81ab9ef968d392aa8edc79566bf02e23f93da7a8
Author: Sergey Sharybin
Date:   Thu Dec 27 11:35:31 2018 +0100
Branches: blender2.7
https://developer.blender.org/rB81ab9ef968d392aa8edc79566bf02e23f93da7a8

Fix T56595: Hair Dynamics stop working after saving new file

The issue was caused by NaN valid of the average spring length being
stored in the file. This caused accumulation in the springs builder
to also deliver NaNs, which then caused solver itself to not do
anything.

Not sure why these values where never initialized prior to the
accumulation. Or even, why this runime data is stored in a DNA.

Some sanitizing is possible here, but needs to be done with care
to not disrupt Spring production.

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

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

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

diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 9666b1ef68f..5396a1905b9 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -1285,6 +1285,11 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 	if (!edgelist)
 		return 0;
 
+	clmd->sim_parms->avg_spring_len = 0.0f;
+	for (i = 0; i < mvert_num; i++) {
+		cloth->verts[i].avg_spring_len = 0.0f;
+	}
+
 	// structural springs
 	for ( i = 0; i < numedges; i++ ) {
 		spring = (ClothSpring *)MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );



More information about the Bf-blender-cvs mailing list