From da78338da035a95b6eb5c5c52144ffa0e7bcb236 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 25 Oct 2017 12:27:37 +0200 Subject: Depsgraph: Add function to update relations within a given graph --- source/blender/depsgraph/DEG_depsgraph_build.h | 5 +++++ source/blender/depsgraph/intern/depsgraph_build.cc | 23 +++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h index 84cf12ba675..df82e962900 100644 --- a/source/blender/depsgraph/DEG_depsgraph_build.h +++ b/source/blender/depsgraph/DEG_depsgraph_build.h @@ -65,6 +65,11 @@ void DEG_graph_build_from_scene(struct Depsgraph *graph, /* Tag relations from the given graph for update. */ void DEG_graph_tag_relations_update(struct Depsgraph *graph); +/* Create or update relations in the specified graph. */ +void DEG_graph_relations_update(struct Depsgraph *graph, + struct Main *bmain, + struct Scene *scene); + /* Tag all relations in the database for update.*/ void DEG_relations_tag_update(struct Main *bmain); diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc index 87dcde045a6..9822cd154b1 100644 --- a/source/blender/depsgraph/intern/depsgraph_build.cc +++ b/source/blender/depsgraph/intern/depsgraph_build.cc @@ -257,6 +257,17 @@ void DEG_graph_tag_relations_update(Depsgraph *graph) deg_graph->need_update = true; } +/* Create or update relations in the specified graph. */ +void DEG_graph_relations_update(Depsgraph *graph, Main *bmain, Scene *scene) +{ + DEG::Depsgraph *deg_graph = (DEG::Depsgraph *)graph; + if (!deg_graph->need_update) { + /* Graph is up to date, nothing to do. */ + return; + } + DEG_graph_build_from_scene(graph, bmain, scene); +} + /* Tag all relations for update. */ void DEG_relations_tag_update(Main *bmain) { @@ -282,17 +293,7 @@ void DEG_scene_relations_update(Main *bmain, Scene *scene) DEG_graph_build_from_scene(scene->depsgraph_legacy, bmain, scene); return; } - - DEG::Depsgraph *graph = reinterpret_cast(scene->depsgraph_legacy); - if (!graph->need_update) { - /* Graph is up to date, nothing to do. */ - return; - } - - /* Build new nodes and relations. */ - DEG_graph_build_from_scene(reinterpret_cast< ::Depsgraph * >(graph), - bmain, - scene); + DEG_graph_relations_update(scene->depsgraph_legacy, bmain, scene); } /* Rebuild dependency graph only for a given scene. */ -- cgit v1.2.3