Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergej Reich <sergej.reich@googlemail.com>2017-09-05 08:12:30 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-09-06 10:32:38 +0300
commitd84f55955526748a1147d4513252544f9527a3ad (patch)
tree32c261b2651dc91a0b2d3d0f029798f50812e42f /source/blender
parentec50734106e23e57418a3caf78153e4fbdc21f72 (diff)
Fix T52374: Changes of rigid body related settings during simulation will break the simulation
Revert 9cd6b03, 3edc8c1, b87d10d and do a better fix for T50230.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index e8c0cf53d0b..c251e5b5d78 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1600,8 +1600,12 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime)
BKE_ptcache_id_time(&pid, scene, ctime, &startframe, &endframe, NULL);
cache = rbw->pointcache;
+ if (ctime <= startframe) {
+ rbw->ltime = startframe;
+ return;
+ }
/* make sure we don't go out of cache frame range */
- if (ctime > endframe) {
+ else if (ctime > endframe) {
ctime = endframe;
}
@@ -1615,12 +1619,9 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime)
// RB_TODO deal with interpolated, old and baked results
bool can_simulate = (ctime == rbw->ltime + 1) && !(cache->flag & PTCACHE_BAKED);
- if (cache->flag & PTCACHE_OUTDATED || cache->last_exact == 0) {
- rbw->ltime = cache->startframe;
- }
-
- if (BKE_ptcache_read(&pid, ctime, can_simulate)) {
+ if (BKE_ptcache_read(&pid, ctime, can_simulate) == PTCACHE_READ_EXACT) {
BKE_ptcache_validate(cache, (int)ctime);
+ rbw->ltime = ctime;
return;
}