Rigidbody: Fix regression introduced in ee3fadd

Baking rigid body cache was broken if some cached frames already
existed.

This is just a band aid for release, the logic need to be looked into
further.
This commit is contained in:
Sergej Reich 2017-09-05 19:53:32 +02:00
parent 4ad5df8858
commit 0fd31c53ee
1 changed files with 7 additions and 1 deletions

View File

@ -3619,7 +3619,13 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
psys_get_pointcache_start_end(scene, pid->calldata, &cache->startframe, &cache->endframe);
}
if (((cache->flag & PTCACHE_BAKED) == 0) && (render || bake)) {
// XXX workaround for regression inroduced in ee3fadd, needs looking into
if (pid->type == PTCACHE_TYPE_RIGIDBODY) {
if ((cache->flag & PTCACHE_REDO_NEEDED || (cache->flag & PTCACHE_SIMULATION_VALID)==0) && (render || bake)) {
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
}
}
else if (((cache->flag & PTCACHE_BAKED) == 0) && (render || bake)) {
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
}