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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-02-16 22:38:03 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-02-16 22:38:03 +0400
commit92436c94d3adbbfc285bd7b3041db36e66dae5d5 (patch)
tree2083c8ad4fa810a781e9631161aa88b12008453d /source/blender/blenkernel/intern/scene.c
parent90ed5ea4ea278b4aadf9187e4e2b92ef3221001b (diff)
parentfda8927d01ba719963154a56b45952ee541a869d (diff)
Merged changes in the trunk up to revision 54594.
Diffstat (limited to 'source/blender/blenkernel/intern/scene.c')
-rw-r--r--source/blender/blenkernel/intern/scene.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 81084661368..9934d9b6e9a 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1115,11 +1115,19 @@ static void scene_depsgraph_hack(Scene *scene, Scene *scene_parent)
}
+static void scene_flag_rbw_recursive(Scene *scene)
+{
+ if (scene->set)
+ scene_flag_rbw_recursive(scene->set);
+
+ if (BKE_scene_check_rigidbody_active(scene))
+ scene->rigidbody_world->flag |= RBW_FLAG_FRAME_UPDATE;
+}
+
static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scene_parent)
{
Base *base;
-
scene->customdata_mask = scene_parent->customdata_mask;
/* sets first, we allow per definition current scene to have
@@ -1127,11 +1135,27 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
if (scene->set)
scene_update_tagged_recursive(bmain, scene->set, scene_parent);
+ /* run rigidbody sim
+ * - calculate/read values from cache into RBO's, to get flushed
+ * later when objects are evaluated (if they're tagged for eval)
+ */
+ // XXX: this position may still change, objects not being updated correctly before simulation is run
+ // NOTE: current position is so that rigidbody sim affects other objects
+ if (BKE_scene_check_rigidbody_active(scene) && scene->rigidbody_world->flag & RBW_FLAG_FRAME_UPDATE) {
+ /* we use frame time of parent (this is "scene" itself for top-level of sets recursion),
+ * as that is the active scene controlling all timing in file at the moment
+ */
+ float ctime = BKE_scene_frame_get(scene_parent);
+
+ /* however, "scene" contains the rigidbody world needed for eval... */
+ BKE_rigidbody_do_simulation(scene, ctime);
+ }
+
/* scene objects */
for (base = scene->base.first; base; base = base->next) {
Object *ob = base->object;
- BKE_object_handle_update(scene_parent, ob);
+ BKE_object_handle_update_ex(scene_parent, scene->rigidbody_world, ob);
if (ob->dup_group && (ob->transflag & OB_DUPLIGROUP))
group_handle_recalc_and_update(scene_parent, ob, ob->dup_group);
@@ -1232,13 +1256,7 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
* such as Scene->World->MTex/Texture) can still get correctly overridden.
*/
BKE_animsys_evaluate_all_animation(bmain, sce, ctime);
- /*...done with recusrive funcs */
-
- /* run rigidbody sim */
- // XXX: this position may still change, objects not being updated correctly before simulation is run
- // NOTE: current position is so that rigidbody sim affects other objects
- if (BKE_scene_check_rigidbody_active(sce))
- BKE_rigidbody_do_simulation(sce, ctime);
+ /*...done with recursive funcs */
/* clear "LIB_DOIT" flag from all materials, to prevent infinite recursion problems later
* when trying to find materials with drivers that need evaluating [#32017]
@@ -1246,6 +1264,9 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
tag_main_idcode(bmain, ID_MA, FALSE);
tag_main_idcode(bmain, ID_LA, FALSE);
+ /* flag rigid body worlds for update */
+ scene_flag_rbw_recursive(sce);
+
/* BKE_object_handle_update() on all objects, groups and sets */
scene_update_tagged_recursive(bmain, sce, sce);