[Bf-blender-cvs] [6c83265] alembic: Sanity check and nicer substep loop for strands simulation.

Lukas Tönne noreply at git.blender.org
Thu Apr 2 14:00:06 CEST 2015


Commit: 6c832657ccb3383d0e0e92ae27a3933332c06915
Author: Lukas Tönne
Date:   Thu Apr 2 13:57:34 2015 +0200
Branches: alembic
https://developer.blender.org/rB6c832657ccb3383d0e0e92ae27a3933332c06915

Sanity check and nicer substep loop for strands simulation.

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

M	source/blender/physics/intern/BPH_mass_spring.cpp

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

diff --git a/source/blender/physics/intern/BPH_mass_spring.cpp b/source/blender/physics/intern/BPH_mass_spring.cpp
index 9e090bc..79d813b 100644
--- a/source/blender/physics/intern/BPH_mass_spring.cpp
+++ b/source/blender/physics/intern/BPH_mass_spring.cpp
@@ -1122,6 +1122,9 @@ bool BPH_cloth_solver_get_texture_data(Object *UNUSED(ob), ClothModifierData *cl
 
 bool BPH_strands_solve(Strands *strands, Implicit_Data *id, StrandSimParams *params, float timestep, ListBase *effectors)
 {
+	if (params->timescale == 0.0f || params->substeps < 1)
+		return false;
+	
 	float tf = params->timescale * timestep;
 	float dt = tf / params->substeps;
 	int numverts = strands->totverts;
@@ -1149,7 +1152,7 @@ bool BPH_strands_solve(Strands *strands, Implicit_Data *id, StrandSimParams *par
 	}
 #endif
 	
-	while (step < tf) {
+	for (step; step < tf; step += dt) {
 		ImplicitSolverResult result;
 		
 #if 0




More information about the Bf-blender-cvs mailing list