[Bf-blender-cvs] [4ad5df88582] master: Fix T52374: Changes of rigid body related settings during simulation will break the simulation

Sergej Reich noreply at git.blender.org
Tue Sep 5 20:00:20 CEST 2017


Commit: 4ad5df885820f5f589e78d01ff3d53dd34546b31
Author: Sergej Reich
Date:   Tue Sep 5 07:12:30 2017 +0200
Branches: master
https://developer.blender.org/rB4ad5df885820f5f589e78d01ff3d53dd34546b31

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.

===================================================================

M	source/blender/blenkernel/intern/rigidbody.c

===================================================================

diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 167b3ad1fec..03eb83376e7 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1596,8 +1596,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;
 	}
 
@@ -1611,12 +1615,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;
 	}



More information about the Bf-blender-cvs mailing list