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:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-05-12 11:57:11 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-05-12 14:06:37 +0300
commita09341469ee3874a0874492a7dcad79c2b99179a (patch)
tree207b387dc710256ac628c91b3cc1cf69fbba5513 /source/blender/blenkernel/intern/rigidbody.c
parent051688b34c60a5eec7cc0227d0bda26b916d1cb8 (diff)
Depsgraph: Add evaluation callbacks for granular nodes update
This commit only adds callbacks which then later be used with major dependency graph commit, keeping the upcoming commit more clean to follow. Should be no functional changes so far still.
Diffstat (limited to 'source/blender/blenkernel/intern/rigidbody.c')
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index aaf54b82f32..ff9e1a2b831 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -54,6 +54,7 @@
#include "DNA_scene_types.h"
#include "BKE_cdderivedmesh.h"
+#include "BKE_depsgraph.h"
#include "BKE_effect.h"
#include "BKE_global.h"
#include "BKE_library.h"
@@ -61,6 +62,7 @@
#include "BKE_object.h"
#include "BKE_pointcache.h"
#include "BKE_rigidbody.h"
+#include "BKE_scene.h"
#ifdef WITH_BULLET
@@ -1610,3 +1612,51 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime) {}
#endif
#endif /* WITH_BULLET */
+
+/* -------------------- */
+/* Depsgraph evaluation */
+
+void BKE_rigidbody_rebuild_sim(EvaluationContext *UNUSED(eval_ctx),
+ Scene *scene)
+{
+ float ctime = BKE_scene_frame_get(scene);
+
+ if (G.debug & G_DEBUG_DEPSGRAPH) {
+ printf("%s at %f\n", __func__, ctime);
+ }
+
+ /* rebuild sim data (i.e. after resetting to start of timeline) */
+ if (BKE_scene_check_rigidbody_active(scene)) {
+ BKE_rigidbody_rebuild_world(scene, ctime);
+ }
+}
+
+void BKE_rigidbody_eval_simulation(EvaluationContext *UNUSED(eval_ctx),
+ Scene *scene)
+{
+ float ctime = BKE_scene_frame_get(scene);
+
+ if (G.debug & G_DEBUG_DEPSGRAPH) {
+ printf("%s at %f\n", __func__, ctime);
+ }
+
+ /* evaluate rigidbody sim */
+ if (BKE_scene_check_rigidbody_active(scene)) {
+ BKE_rigidbody_do_simulation(scene, ctime);
+ }
+}
+
+void BKE_rigidbody_object_sync_transforms(EvaluationContext *UNUSED(eval_ctx),
+ Scene *scene,
+ Object *ob)
+{
+ RigidBodyWorld *rbw = scene->rigidbody_world;
+ float ctime = BKE_scene_frame_get(scene);
+
+ if (G.debug & G_DEBUG_DEPSGRAPH) {
+ printf("%s on %s\n", __func__, ob->id.name);
+ }
+
+ /* read values pushed into RBO from sim/cache... */
+ BKE_rigidbody_sync_transforms(rbw, ob, ctime);
+}