diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-25 13:27:37 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-25 14:28:39 +0300 |
commit | da78338da035a95b6eb5c5c52144ffa0e7bcb236 (patch) | |
tree | 365e59606249df0802844cb2e82bee49607cb289 /source/blender | |
parent | 005cb90113361356b040337bf5af503d1f4f34a0 (diff) |
Depsgraph: Add function to update relations within a given graph
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/depsgraph/DEG_depsgraph_build.h | 5 | ||||
-rw-r--r-- | 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<DEG::Depsgraph *>(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. */ |