Rigidbody: Fix regression introduced in ee3fadd
authorSergej Reich <sergej.reich@googlemail.com>
Tue, 5 Sep 2017 17:53:32 +0000 (19:53 +0200)
committerSergej Reich <sergej.reich@googlemail.com>
Tue, 5 Sep 2017 17:59:46 +0000 (19:59 +0200)
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.

source/blender/blenkernel/intern/pointcache.c

index 2a61efcd1f934d9747ab11b6e2cb7cb522fd2479..7a1b378b3c4a7a7f34a86e0f59d55c9c2d1569d4 100644 (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);
                                        }