Fix for [#24195] Cloth modifier doesn't work after changing subsurf on the object

* Cloth has to reset itself properly on vertex count changes as it can be after a constructive modifier (unlike softbody)
This commit is contained in:
Janne Karhu
2010-10-11 09:02:19 +00:00
parent 67a1a871a9
commit 7ab02f1ec1

View File

@@ -446,7 +446,9 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
return dm;
}
if(clmd->sim_parms->reset || (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0))
if(clmd->sim_parms->reset
|| (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0)
|| (clmd->clothObject && result->getNumVerts(result) != clmd->clothObject->numverts))
{
clmd->sim_parms->reset = 0;
cache->flag |= PTCACHE_OUTDATED;
@@ -457,17 +459,6 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
return result;
}
/* verify we still have the same number of vertices, if not do nothing.
* note that this should only happen if the number of vertices changes
* during an animation due to a preceding modifier, this should not
* happen because of object changes! */
if(clmd->clothObject) {
if(result->getNumVerts(result) != clmd->clothObject->numverts) {
BKE_ptcache_invalidate(cache);
return result;
}
}
// unused in the moment, calculated separately in implicit.c
clmd->sim_parms->dt = clmd->sim_parms->timescale / clmd->sim_parms->stepsPerFrame;