Depsgraph: Add function to update relations within a given graph
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 25 Oct 2017 10:27:37 +0000 (12:27 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 25 Oct 2017 11:28:39 +0000 (13:28 +0200)
source/blender/depsgraph/DEG_depsgraph_build.h
source/blender/depsgraph/intern/depsgraph_build.cc

index 84cf12ba67513d6b06eb175d51809285cad4cd0a..df82e9629004f3341468b4b4204b36b5ba32ebeb 100644 (file)
@@ -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);
 
index 87dcde045a67d474abadfda952804d2c88602b2c..9822cd154b1a37fe066fef4f384778c17b6ba6f2 100644 (file)
@@ -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. */