[Bf-blender-cvs] [a6adf33] depsgraph_refactor: Added back the root node construction to the depsgraph build function.

Lukas Tönne noreply at git.blender.org
Wed Apr 9 10:30:23 CEST 2014


Commit: a6adf3330fd96a148e817dce83e387ac04989481
Author: Lukas Tönne
Date:   Wed Apr 9 10:21:55 2014 +0200
https://developer.blender.org/rBa6adf3330fd96a148e817dce83e387ac04989481

Added back the root node construction to the depsgraph build function.

===================================================================

M	source/blender/depsgraph/intern/depsgraph_build.cpp
M	source/blender/depsgraph/intern/depsgraph_build.h

===================================================================

diff --git a/source/blender/depsgraph/intern/depsgraph_build.cpp b/source/blender/depsgraph/intern/depsgraph_build.cpp
index 23faee8..48cdc0b 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -182,6 +182,13 @@ DepsgraphNodeBuilder::~DepsgraphNodeBuilder()
 {
 }
 
+RootDepsNode *DepsgraphNodeBuilder::add_root_node()
+{
+	RootDepsNode *root_node = (RootDepsNode *)m_graph->get_node(NULL, "", DEPSNODE_TYPE_ROOT, "Root (Scene)");
+	m_graph->root_node = root_node;
+	return root_node;
+}
+
 IDDepsNode *DepsgraphNodeBuilder::add_id_node(IDPtr id)
 {
 	return m_graph->get_id_node(id);
@@ -429,6 +436,11 @@ DepsgraphRelationBuilder::DepsgraphRelationBuilder(Depsgraph *graph) :
 {
 }
 
+RootDepsNode *DepsgraphRelationBuilder::find_node(const RootKey &key) const
+{
+	return m_graph->root_node;
+}
+
 IDDepsNode *DepsgraphRelationBuilder::find_node(const IDKey &key) const
 {
 	IDDepsNode *node = m_graph->find_id_node(key.id);
@@ -768,26 +780,24 @@ void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene)
 	BKE_main_id_tag_idcode(bmain, ID_WO, false);
 	BKE_main_id_tag_idcode(bmain, ID_TE, false);
 	
+	
 	DepsgraphNodeBuilder node_builder(bmain, graph);
-	node_builder.build_scene(scene);
-
-	DepsgraphRelationBuilder relation_builder(graph);
-	relation_builder.build_scene(scene);
-
-#if 0
 	/* create root node for scene first
 	 * - this way it should be the first in the graph,
 	 *   reflecting its role as the entrypoint
 	 */
-	graph->root_node = (RootDepsNode *)graph->get_node(NULL, "", DEPSNODE_TYPE_ROOT, "Root (Scene)");
+	node_builder.add_root_node();
+	node_builder.build_scene(scene);
+
+	DepsgraphRelationBuilder relation_builder(graph);
+	/* hook scene up to the root node as entrypoint to graph */
+	relation_builder.add_relation(RootKey(), IDKey(scene), DEPSREL_TYPE_ROOT_TO_ACTIVE, "Root to Active Scene");
+	relation_builder.build_scene(scene);
 	
+#if 0
 	/* build graph for scene and all attached data */
 	DepsNode *scene_node = deg_build_scene_graph(graph, bmain, scene);
 	
-	/* hook this up to a "root" node as entrypoint to graph... */
-	graph->add_new_relation(graph->root_node, scene_node, 
-	                     DEPSREL_TYPE_ROOT_TO_ACTIVE, "Root to Active Scene");
-	
 	/* ensure that all implicit constraints between nodes are satisfied */
 	DEG_graph_validate_links(graph);
 	
diff --git a/source/blender/depsgraph/intern/depsgraph_build.h b/source/blender/depsgraph/intern/depsgraph_build.h
index b21948e..43538cc 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.h
+++ b/source/blender/depsgraph/intern/depsgraph_build.h
@@ -42,6 +42,7 @@ struct World;
 
 struct Depsgraph;
 struct DepsNode;
+struct RootDepsNode;
 struct IDDepsNode;
 struct TimeSourceDepsNode;
 struct ComponentDepsNode;
@@ -51,6 +52,7 @@ struct DepsgraphNodeBuilder {
 	DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph);
 	~DepsgraphNodeBuilder();
 	
+	RootDepsNode *add_root_node();
 	IDDepsNode *add_id_node(IDPtr id);
 	TimeSourceDepsNode *add_time_source(IDPtr id);
 	ComponentDepsNode *add_component_node(IDDepsNode *id_node, eDepsNode_Type comp_type, const string &subdata = "");
@@ -72,6 +74,10 @@ private:
 	Depsgraph *m_graph;
 };
 
+struct RootKey
+{
+};
+
 struct IDKey
 {
 	IDKey(IDPtr id) : id(id) {}
@@ -111,6 +117,7 @@ struct DepsgraphRelationBuilder {
 	void build_compositor(Scene *scene);
 	
 protected:
+	RootDepsNode *find_node(const RootKey &key) const;
 	IDDepsNode *find_node(const IDKey &key) const;
 	ComponentDepsNode *find_node(const ComponentKey &key) const;
 	OperationDepsNode *find_node(const OperationKey &key) const;




More information about the Bf-blender-cvs mailing list