diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-11-07 18:51:18 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-11-07 18:51:47 +0300 |
commit | 16fcf9dfbf6af527cfc06c5b251d144dc789f949 (patch) | |
tree | 93b509bc25ec9a0f1fc3a1839d4221f3dca9b895 | |
parent | 52e529b82d66606da91107a3bf04d25e0267b78f (diff) |
Depsgraph: Get away from legacy API used in event loop
A bit tricky for now, needs some clear design about when to do
on_visible_changed().
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_build.cc | 12 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 10 |
2 files changed, 21 insertions, 1 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc index b6bf6c6fa78..ab7e28e1638 100644 --- a/source/blender/depsgraph/intern/depsgraph_build.cc +++ b/source/blender/depsgraph/intern/depsgraph_build.cc @@ -206,6 +206,14 @@ void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene) DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph); + /* TODO(sergey): This is a bit tricky, but ensures that all the data + * is evaluated properly when depsgraph is becoming "visible". + * + * This now could happen for both visible scene is changed and extra + * dependency graph was created for render engine. + */ + const bool need_on_visible_update = (deg_graph->scene == NULL); + /* 1) Generate all the nodes in the graph first */ DEG::DepsgraphNodeBuilder node_builder(bmain, deg_graph); node_builder.begin_build(bmain); @@ -249,6 +257,10 @@ void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene) /* Relations are up to date. */ deg_graph->need_update = false; + + if (need_on_visible_update) { + DEG_graph_on_visible_update(bmain, graph); + } } /* Tag graph relations for update. */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 7167e61fccd..ba3dab60972 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -84,6 +84,8 @@ #include "RNA_enum_types.h" +#include "DEG_depsgraph.h" + /* Motion in pixels allowed before we don't consider single/double click. */ #define WM_EVENT_CLICK_WIGGLE_ROOM 2 @@ -309,7 +311,13 @@ void wm_event_do_refresh_wm_and_depsgraph(bContext *C) /* XXX, hack so operators can enforce datamasks [#26482], gl render */ scene->customdata_mask |= scene->customdata_mask_modal; - BKE_scene_update_tagged(bmain->eval_ctx, bmain, scene); + for (SceneLayer *scene_layer = scene->render_layers.first; + scene_layer != NULL; + scene_layer = scene_layer->next) + { + Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, scene_layer, true); + BKE_scene_graph_update_tagged(bmain->eval_ctx, depsgraph, bmain, scene); + } } } |