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:
authorJoshua Leung <aligorith@gmail.com>2013-02-15 15:49:22 +0400
committerJoshua Leung <aligorith@gmail.com>2013-02-15 15:49:22 +0400
commit4d32e9a49e910ee872143103b1d747bf9f81e029 (patch)
tree6294938fd3c1f72ee542f019b1b4da41e10f613f /source/blender/blenkernel/intern/depsgraph.c
parent6786975f78eabe7795d4e052c43af2cc298364c9 (diff)
Bugfix [#33970] Background Scene does not show animation of rigid body objects
This was caused by multiple instantiations of the same basic problem. The rigidbody handling code often assumed that "scene" pointers referred to the scene where an object participating in the sim resided (and where the rigidbody world for that sim lived). However, when dealing with background sets, "scene" often only refers to the active scene, and not the set that the object actually came from. Hence, the rigidbody code would often (wrongly) conclude that there was nothing to do. For example, we may have the following backgound set/scene chaining scenario: "active" <-- ... <-- set i (rigidbody objects live here) <-- ... <-- set n The fix here is a multi-part fix: 1) Moved sim-world calculation from BKE_scene_update_newframe() to scene_update_tagged_recursive() + This is currently the only way that rigidbody sims in background sets will get calculated, as part of the recursion - These checks will get run on each update. <--- FIXME!!! 2) Tweaked depsgraph code so that when checking if there are any time-dependent features on objects to tag for updating, the checking is done relative to the scene that the object actually resides in (and not the active scene). Otherwise, even if we recalculate the sim, the affected objects won't get tagged for updating. This tagging is needed to actually flush the transforms out of the RigidBodyObject structs (written by the sim/cache) and into the Object transforms (obmat's) 3) Removed the requirement for rigidbody world to actually exist before we can flush rigidbody transforms. In many cases, it should be sufficient to assume that because the object with rigidbody data attached has been tagged for updates, it should have updates to perform. Of course, we still check on this data if we've got it, but that's only if the sim is in the active scene. - TODO: if we have further problems, we should investigate passing the "actual" scene down alongside the "active" scene for BKE_object_handle_update().
Diffstat (limited to 'source/blender/blenkernel/intern/depsgraph.c')
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index dab4235559a..99d0c5ed964 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -2353,6 +2353,7 @@ static void dag_object_time_update_flags(Scene *scene, Object *ob)
if (object_modifiers_use_time(ob)) ob->recalc |= OB_RECALC_DATA;
if ((ob->pose) && (ob->pose->flag & POSE_CONSTRAINTS_TIMEDEPEND)) ob->recalc |= OB_RECALC_DATA;
+ // XXX: scene here may not be the scene that contains the rigidbody world affecting this!
if (ob->rigidbody_object && BKE_scene_check_rigidbody_active(scene))
ob->recalc |= OB_RECALC_OB;
@@ -2440,7 +2441,11 @@ void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const s
if (do_time) {
/* now if DagNode were part of base, the node->lay could be checked... */
/* we do all now, since the scene_flush checks layers and clears recalc flags even */
- dag_object_time_update_flags(scene, ob);
+
+ /* NOTE: "sce_iter" not "scene" so that rigidbodies in background scenes work
+ * (i.e. muting + rbw availability can be checked and tagged properly) [#33970]
+ */
+ dag_object_time_update_flags(sce_iter, ob);
}
/* handled in next loop */