diff options
author | Ton Roosendaal <ton@blender.org> | 2013-01-10 22:20:29 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2013-01-10 22:20:29 +0400 |
commit | 70a59a326228af75e7daed0689f62900aef81a88 (patch) | |
tree | ed03b7245380ae53af9e02317b6d312cc9368cde /source/blender/blenkernel/intern/scene.c | |
parent | c92be1a9a5491621b42f791e5c596494e1937254 (diff) |
Depsgraph hack feature - experimental
Many depsgraph failures are because some data in the graph is being
recalculated too early (or not at all).
Since we better support animators with working renders, here's a hack to
allow manual additional updates on frame changes.
In Property Editor, Object, Panel "Relations Extra" you now have two
buttons:
- Extra Object Update
- Extra Data Update
This will do an extra update of object and/or its data ONLY on frame changes.
Update happens as last.
Tested on files collected in Wiki todo, several cases now work OK, especially
the lags on updates.
Diffstat (limited to 'source/blender/blenkernel/intern/scene.c')
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index bccbdc44584..9cf0724f82a 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1031,6 +1031,47 @@ static void scene_update_drivers(Main *UNUSED(bmain), Scene *scene) } } +/* deps hack - do extra recalcs at end */ +static void scene_depsgraph_hack(Scene *scene, Scene *scene_parent) +{ + Base *base; + + scene->customdata_mask = scene_parent->customdata_mask; + + /* sets first, we allow per definition current scene to have + * dependencies on sets, but not the other way around. */ + if (scene->set) + scene_depsgraph_hack(scene->set, scene_parent); + + for (base = scene->base.first; base; base = base->next) { + Object *ob = base->object; + + if (ob->depsflag) { + int recalc = 0; + // printf("depshack %s\n", ob->id.name+2); + + if (ob->depsflag & OB_DEPS_EXTRA_OB_RECALC) + recalc |= OB_RECALC_OB; + if (ob->depsflag & OB_DEPS_EXTRA_DATA_RECALC) + recalc |= OB_RECALC_DATA; + + ob->recalc |= recalc; + BKE_object_handle_update(scene_parent, ob); + + if (ob->dup_group && (ob->transflag & OB_DUPLIGROUP)) { + GroupObject *go; + + for (go = ob->dup_group->gobject.first; go; go = go->next) { + if (go->ob) + go->ob->recalc |= recalc; + } + group_handle_recalc_and_update(scene_parent, ob, ob->dup_group); + } + } + } + +} + static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scene_parent) { Base *base; @@ -1066,6 +1107,7 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen /* update masking curves */ BKE_mask_update_scene(bmain, scene, FALSE); + } /* this is called in main loop, doing tagged updates before redraw */ @@ -1158,6 +1200,8 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) /* BKE_object_handle_update() on all objects, groups and sets */ scene_update_tagged_recursive(bmain, sce, sce); + scene_depsgraph_hack(sce, sce); + /* notify editors and python about recalc */ BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_POST); BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_POST); |