[Bf-blender-cvs] [16fcf9dfbf6] blender2.8: Depsgraph: Get away from legacy API used in event loop
Sergey Sharybin
noreply at git.blender.org
Tue Nov 7 16:59:33 CET 2017
Commit: 16fcf9dfbf6af527cfc06c5b251d144dc789f949
Author: Sergey Sharybin
Date: Tue Nov 7 16:51:18 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB16fcf9dfbf6af527cfc06c5b251d144dc789f949
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().
===================================================================
M source/blender/depsgraph/intern/depsgraph_build.cc
M source/blender/windowmanager/intern/wm_event_system.c
===================================================================
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);
+ }
}
}
More information about the Bf-blender-cvs
mailing list