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().
This commit is contained in:
@@ -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. */
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user