From 022de797f1773f512f21cf9038787dd77e0fd5de Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 6 Sep 2019 17:00:09 +0200 Subject: Depsgraph: Introduce depsgraph registry Allows to access dependency graphs created for render engines to inform them about changes in .blend file structure from the Python handlers. Reviewers: brecht Differential Revision: https://developer.blender.org/D5724 --- source/blender/depsgraph/intern/depsgraph_tag.cc | 29 ++++++------------------ 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'source/blender/depsgraph/intern/depsgraph_tag.cc') diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index fd74529a30d..2fdce0e30a5 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -30,7 +30,6 @@ #include #include "BLI_utildefines.h" -#include "BLI_listbase.h" #include "BLI_math_bits.h" #include "BLI_task.h" @@ -64,6 +63,7 @@ extern "C" { #include "intern/builder/deg_builder.h" #include "intern/depsgraph.h" #include "intern/depsgraph_update.h" +#include "intern/depsgraph_registry.h" #include "intern/eval/deg_eval_copy_on_write.h" #include "intern/eval/deg_eval_flush.h" #include "intern/node/deg_node.h" @@ -605,13 +605,8 @@ NodeType geometry_tag_to_component(const ID *id) void id_tag_update(Main *bmain, ID *id, int flag, eUpdateSource update_source) { graph_id_tag_update(bmain, NULL, id, flag, update_source); - LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { - LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) { - Depsgraph *depsgraph = (Depsgraph *)BKE_scene_get_depsgraph(bmain, scene, view_layer, false); - if (depsgraph != NULL) { - graph_id_tag_update(bmain, depsgraph, id, flag, update_source); - } - } + for (DEG::Depsgraph *depsgraph : DEG::get_all_registered_graphs(bmain)) { + graph_id_tag_update(bmain, depsgraph, id, flag, update_source); } } @@ -769,13 +764,8 @@ void DEG_graph_id_type_tag(Depsgraph *depsgraph, short id_type) void DEG_id_type_tag(Main *bmain, short id_type) { - LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { - LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) { - Depsgraph *depsgraph = (Depsgraph *)BKE_scene_get_depsgraph(bmain, scene, view_layer, false); - if (depsgraph != NULL) { - DEG_graph_id_type_tag(depsgraph, id_type); - } - } + for (DEG::Depsgraph *depsgraph : DEG::get_all_registered_graphs(bmain)) { + DEG_graph_id_type_tag(reinterpret_cast<::Depsgraph *>(depsgraph), id_type); } } @@ -788,13 +778,8 @@ void DEG_graph_on_visible_update(Main *bmain, Depsgraph *depsgraph, const bool d void DEG_on_visible_update(Main *bmain, const bool do_time) { - LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { - LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) { - Depsgraph *depsgraph = (Depsgraph *)BKE_scene_get_depsgraph(bmain, scene, view_layer, false); - if (depsgraph != NULL) { - DEG_graph_on_visible_update(bmain, depsgraph, do_time); - } - } + for (DEG::Depsgraph *depsgraph : DEG::get_all_registered_graphs(bmain)) { + DEG_graph_on_visible_update(bmain, reinterpret_cast<::Depsgraph *>(depsgraph), do_time); } } -- cgit v1.2.3