diff options
Diffstat (limited to 'source/blender/blenkernel/intern/cloth.c')
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 3932a8ead2f..e1b5dd6d39d 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -474,11 +474,13 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived (clmd->clothObject && dm->getNumVerts(dm) != clmd->clothObject->numverts)) { clmd->sim_parms->reset = 0; - cache->flag |= PTCACHE_OUTDATED; + cloth_free_modifier(clmd); + + cache->state.flag |= PTC_STATE_OUTDATED; BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED); BKE_ptcache_validate(cache, 0); - cache->last_exact= 0; - cache->flag &= ~PTCACHE_REDO_NEEDED; + cache->state.last_exact= 0; + cache->state.flag &= ~PTC_STATE_REDO_NEEDED; } // unused in the moment, calculated separately in implicit.c @@ -514,10 +516,13 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived return; if ((framenr == startframe) && (clmd->sim_parms->preroll == 0)) { + cloth_free_modifier(clmd); + BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED); - do_init_cloth(ob, clmd, dm, framenr); BKE_ptcache_validate(cache, framenr); - cache->flag &= ~PTCACHE_REDO_NEEDED; + cache->state.flag &= ~PTC_STATE_REDO_NEEDED; + + do_init_cloth(ob, clmd, dm, framenr); clmd->clothObject->last_frame= framenr; return; } @@ -531,7 +536,7 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived BKE_ptcache_validate(cache, framenr); - if (cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED) + if (cache_result == PTCACHE_READ_INTERPOLATED && cache->state.flag & PTC_STATE_REDO_NEEDED) BKE_ptcache_write(&pid, framenr); clmd->clothObject->last_frame= framenr; @@ -541,20 +546,15 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived else if (cache_result==PTCACHE_READ_OLD) { implicit_set_positions(clmd); } - else if ( /*ob->id.lib ||*/ (cache->flag & PTCACHE_BAKED)) { /* 2.4x disabled lib, but this can be used in some cases, testing further - campbell */ - /* if baked and nothing in cache, do nothing */ - BKE_ptcache_invalidate(cache); - return; - } if (framenr!=clmd->clothObject->last_frame+1) return; /* if on second frame, write cache for first frame */ - if (cache->simframe == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) + if (cache->state.simframe == startframe && (cache->state.flag & PTC_STATE_OUTDATED || cache->state.last_exact==0)) BKE_ptcache_write(&pid, startframe); - clmd->sim_parms->timescale *= framenr - cache->simframe; + clmd->sim_parms->timescale *= framenr - cache->state.simframe; /* do simulation */ BKE_ptcache_validate(cache, framenr); |