[Bf-blender-cvs] [6054fff2a6] cloth-improvements: Fix regression on sewing springs caused by plasticity
Luca Rood
noreply at git.blender.org
Tue Jan 24 03:28:23 CET 2017
Commit: 6054fff2a61e076599657665285ff87fab759360
Author: Luca Rood
Date: Tue Jan 24 00:25:45 2017 -0200
Branches: cloth-improvements
https://developer.blender.org/rB6054fff2a61e076599657665285ff87fab759360
Fix regression on sewing springs caused by plasticity
===================================================================
M source/blender/physics/intern/BPH_mass_spring.cpp
M source/blender/physics/intern/implicit_blender.c
===================================================================
diff --git a/source/blender/physics/intern/BPH_mass_spring.cpp b/source/blender/physics/intern/BPH_mass_spring.cpp
index 6077dc9e04..eb0b1a4bed 100644
--- a/source/blender/physics/intern/BPH_mass_spring.cpp
+++ b/source/blender/physics/intern/BPH_mass_spring.cpp
@@ -380,7 +380,7 @@ BLI_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
// TODO: verify, half verified (couldn't see error)
// sewing springs usually have a large distance at first so clamp the force so we don't get tunnelling through colission objects
BPH_mass_spring_force_spring_linear(data, s->ij, s->kl, s->restlen, &s->lenfact, k_tension, 0.0f,
- d_tension, 0.0f, no_compress, parms->max_sewing, 0.0f, 1.0f, !collision_pass);
+ d_tension, 0.0f, no_compress, parms->max_sewing, 0.0f, 1.0f, false);
}
else {
scaling_compression = parms->compression + s->lin_stiffness * fabsf(parms->max_compression - parms->compression);
diff --git a/source/blender/physics/intern/implicit_blender.c b/source/blender/physics/intern/implicit_blender.c
index 0f17ed67ee..801c548840 100644
--- a/source/blender/physics/intern/implicit_blender.c
+++ b/source/blender/physics/intern/implicit_blender.c
@@ -1613,7 +1613,7 @@ bool BPH_mass_spring_force_spring_linear(Implicit_Data *data, int i, int j, floa
dfdx_spring(dfdx, dir, length, restlen, tension);
/* compute plasticity offset factor */
- if (do_plast && length > restlen * yield_fact) {
+ if (do_plast && (restlenorig > 0.0f) && (length > restlen * yield_fact)) {
restlen += ((length / yield_fact) - restlen) * plasticity;
*lenfact = restlen / restlenorig;
}
@@ -1632,7 +1632,7 @@ bool BPH_mass_spring_force_spring_linear(Implicit_Data *data, int i, int j, floa
mul_m3_fl(dfdx, fbstar_jacobi(length, restlen, kb, cb));
/* compute plasticity offset factor */
- if (do_plast && length < restlen / yield_fact) {
+ if (do_plast && (restlenorig > 0.0f) && length < restlen / yield_fact) {
restlen -= (restlen - (length * yield_fact)) * plasticity;
*lenfact = restlen / restlenorig;
}
@@ -1783,7 +1783,7 @@ bool BPH_mass_spring_force_spring_angular(Implicit_Data *data, int i, int j, int
force = stiffness * (angle - restang);
/* compute plasticity offset */
- if (do_plast) {
+ if (do_plast && (restangorig > 0.0f)) {
if (angle > restang) {
if (angle - restang > yield_ang) {
restang += (angle - restang - yield_ang) * plasticity;
More information about the Bf-blender-cvs
mailing list