Fix: Use DEG_get_ctime() for rigidbody sims instead of BKE_scene_frame_get()

There are still probably other massive problems to solve (i.e. which copies
of data cache/sim gets written/read from for COW eval) that need to be solved
before we can get the sims actually running though.
This commit is contained in:
Joshua Leung
2018-05-18 18:04:27 +02:00
parent 30673ff325
commit de7635f607

View File

@@ -67,6 +67,7 @@
#include "BKE_scene.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
/* ************************************** */
/* Memory Management */
@@ -1697,7 +1698,7 @@ void BKE_rigidbody_do_simulation(struct Depsgraph *depsgraph, Scene *scene, floa
void BKE_rigidbody_rebuild_sim(struct Depsgraph *depsgraph,
Scene *scene)
{
float ctime = BKE_scene_frame_get(scene);
float ctime = DEG_get_ctime(depsgraph);
DEG_debug_print_eval_time(depsgraph, __func__, scene->id.name, scene, ctime);
/* rebuild sim data (i.e. after resetting to start of timeline) */
if (BKE_scene_check_rigidbody_active(scene)) {
@@ -1708,7 +1709,7 @@ void BKE_rigidbody_rebuild_sim(struct Depsgraph *depsgraph,
void BKE_rigidbody_eval_simulation(struct Depsgraph *depsgraph,
Scene *scene)
{
float ctime = BKE_scene_frame_get(scene);
float ctime = DEG_get_ctime(depsgraph);
DEG_debug_print_eval_time(depsgraph, __func__, scene->id.name, scene, ctime);
/* evaluate rigidbody sim */
if (BKE_scene_check_rigidbody_active(scene)) {
@@ -1721,7 +1722,7 @@ void BKE_rigidbody_object_sync_transforms(struct Depsgraph *depsgraph,
Object *ob)
{
RigidBodyWorld *rbw = scene->rigidbody_world;
float ctime = BKE_scene_frame_get(scene);
float ctime = DEG_get_ctime(depsgraph);
DEG_debug_print_eval_time(depsgraph, __func__, ob->id.name, ob, ctime);
/* read values pushed into RBO from sim/cache... */
BKE_rigidbody_sync_transforms(rbw, ob, ctime);