Cloth: Fix mistake in recent angular bending commit (b6f0f8a5b5a)
authorLuca Rood <dev@lucarood.com>
Tue, 11 Sep 2018 14:09:45 +0000 (16:09 +0200)
committerLuca Rood <dev@lucarood.com>
Tue, 11 Sep 2018 14:09:45 +0000 (16:09 +0200)
The angular spring force computation function was being called even in
linear mode, with empty angular springs.

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

index 6ea2eeca6f850e3053424161bf3df6405df68a3c..9ab688a367095b71ad61ff0cd192b30c5ad5a5a7 100644 (file)
@@ -341,13 +341,13 @@ BLI_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s)
        Cloth *cloth = clmd->clothObject;
        ClothSimSettings *parms = clmd->sim_parms;
        Implicit_Data *data = cloth->implicit;
-       bool new_compress = parms->bending_model == CLOTH_BENDING_ANGULAR;
-       bool resist_compress = (parms->flags & CLOTH_SIMSETTINGS_FLAG_RESIST_SPRING_COMPRESS) && !new_compress;
+       bool using_angular = parms->bending_model == CLOTH_BENDING_ANGULAR;
+       bool resist_compress = (parms->flags & CLOTH_SIMSETTINGS_FLAG_RESIST_SPRING_COMPRESS) && !using_angular;
 
        s->flags &= ~CLOTH_SPRING_FLAG_NEEDED;
 
        /* Calculate force of bending springs. */
-       if (s->type & CLOTH_SPRING_TYPE_BENDING) {
+       if ((s->type & CLOTH_SPRING_TYPE_BENDING) && using_angular) {
 #ifdef CLOTH_FORCE_SPRING_BEND
                float k, scaling;
 
@@ -386,7 +386,7 @@ BLI_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s)
                        BPH_mass_spring_force_spring_linear(data, s->ij, s->kl, s->restlen,
                                                            k_tension, parms->tension_damp,
                                                            k_compression, parms->compression_damp,
-                                                           resist_compress, new_compress, 0.0f);
+                                                           resist_compress, using_angular, 0.0f);
                }
 #endif
        }
index 11656ebaf7f912cdb1b5eb39c5d0a3b5d492c1aa..870f46b6e3abe03c0b9907d08f79af47f4b58ee8 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 11656ebaf7f912cdb1b5eb39c5d0a3b5d492c1aa
+Subproject commit 870f46b6e3abe03c0b9907d08f79af47f4b58ee8