[Bf-blender-cvs] [7b9a14d] depsgraph_refactor: Replaced the `validate_links` method by `build_operations`.

Lukas Tönne noreply at git.blender.org
Tue May 13 18:41:08 CEST 2014


Commit: 7b9a14d01d63f7abb00a1e24beb968bf827d55ff
Author: Lukas Tönne
Date:   Sun May 11 12:11:31 2014 +0200
https://developer.blender.org/rB7b9a14d01d63f7abb00a1e24beb968bf827d55ff

Replaced the `validate_links` method by `build_operations`.

The `build_operations` will need to be complemented with all the build
steps for operations currently mixed in with the node/relations builder.

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

M	source/blender/depsgraph/intern/depsgraph.cpp
M	source/blender/depsgraph/intern/depsgraph.h
M	source/blender/depsgraph/intern/depsgraph_build.cpp
M	source/blender/depsgraph/intern/depsgraph_build.h
M	source/blender/depsgraph/intern/depsnode.cpp
M	source/blender/depsgraph/intern/depsnode.h
M	source/blender/depsgraph/intern/depsnode_component.cpp
M	source/blender/depsgraph/intern/depsnode_component.h
M	source/blender/depsgraph/intern/depsnode_operation.h

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

diff --git a/source/blender/depsgraph/intern/depsgraph.cpp b/source/blender/depsgraph/intern/depsgraph.cpp
index 64be3f0..c496e67 100644
--- a/source/blender/depsgraph/intern/depsgraph.cpp
+++ b/source/blender/depsgraph/intern/depsgraph.cpp
@@ -217,21 +217,6 @@ void Depsgraph::build_operations(const OperationBuilder &builder) const
 	}
 }
 
-/* Ensure that all implicit constraints between nodes are satisfied 
- * (e.g. components are only allowed to be executed in a certain order)
- */
-void Depsgraph::validate_links()
-{
-	/* go over each ID node to recursively call validate_links()
-	 * on it, which should be enough to ensure that all of those
-	 * subtrees are valid
-	 */
-	for (Depsgraph::IDNodeMap::const_iterator it = this->id_hash.begin(); it != this->id_hash.end(); ++it) {
-		DepsNode *node = it->second;
-		node->validate_links(this);
-	}
-}
-
 /* Sort nodes to determine evaluation order for operation nodes
  * where dependency relationships won't get violated.
  */
diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h
index 281594e..b07edb8 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -144,11 +144,6 @@ struct Depsgraph {
 	
 	void build_operations(const OperationBuilder &builder) const;
 	
-	/* Ensure that all implicit constraints between nodes are satisfied 
-	 * (e.g. components are only allowed to be executed in a certain order)
-	 */
-	void validate_links();
-	
 	/* Sort nodes to determine evaluation order for operation nodes
 	 * where dependency relationships won't get violated.
 	 */
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cpp b/source/blender/depsgraph/intern/depsgraph_build.cpp
index a975693..23bb6be 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -245,13 +245,19 @@ OperationBuilder::OperationBuilder(Depsgraph *graph) :
 
 OperationDepsNode *OperationBuilder::add_operation_node(ComponentDepsNode *comp_node, eDepsNode_Type type, eDepsOperation_Type optype,
                                                         DepsEvalOperationCb op, const string &description,
-                                                        PointerRNA ptr)
+                                                        PointerRNA ptr) const
 {
 	OperationDepsNode *op_node = comp_node->add_operation(type, optype, op, description);
 	op_node->ptr = ptr;
 	return op_node;
 }
 
+void OperationBuilder::add_relation(OperationDepsNode *node_from, OperationDepsNode *node_to,
+                                    eDepsRelation_Type type, const string &description) const
+{
+	m_graph->add_new_relation(node_from, node_to, type, description);
+}
+
 
 /* ************************************************* */
 /* Relations Builder */
@@ -383,9 +389,6 @@ void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene)
 	graph->build_operations(op_builder);
 	
 #if 0
-	/* ensure that all implicit constraints between nodes are satisfied */
-	DEG_graph_validate_links(graph);
-	
 	/* sort nodes to determine evaluation order (in most cases) */
 	DEG_graph_sort(graph);
 #endif
diff --git a/source/blender/depsgraph/intern/depsgraph_build.h b/source/blender/depsgraph/intern/depsgraph_build.h
index e3bceed..5db7771 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.h
+++ b/source/blender/depsgraph/intern/depsgraph_build.h
@@ -108,7 +108,10 @@ struct OperationBuilder {
 	
 	OperationDepsNode *add_operation_node(ComponentDepsNode *comp_node, eDepsNode_Type type, eDepsOperation_Type optype,
 	                                      DepsEvalOperationCb op, const string &description,
-	                                      PointerRNA ptr);
+	                                      PointerRNA ptr) const;
+	
+	void add_relation(OperationDepsNode *node_from, OperationDepsNode *node_to,
+	                  eDepsRelation_Type type, const string &description) const;
 	
 private:
 	Depsgraph *m_graph;
diff --git a/source/blender/depsgraph/intern/depsnode.cpp b/source/blender/depsgraph/intern/depsnode.cpp
index bb1c6a3..3db7a44 100644
--- a/source/blender/depsgraph/intern/depsnode.cpp
+++ b/source/blender/depsgraph/intern/depsnode.cpp
@@ -82,7 +82,7 @@ TimeSourceDepsNode *RootDepsNode::add_time_source(const string &name)
 	return time_source;
 }
 
-void RootDepsNode::build_operations(const OperationBuilder &builder) const
+void RootDepsNode::build_operations(const OperationBuilder &builder)
 {
 	if (time_source)
 		time_source->build_operations(builder);
@@ -93,7 +93,7 @@ static DepsNodeFactoryImpl<RootDepsNode> DNTI_ROOT;
 
 /* Time Source Node ======================================= */
 
-void TimeSourceDepsNode::build_operations(const OperationBuilder &builder) const
+void TimeSourceDepsNode::build_operations(const OperationBuilder &builder)
 {
 	/* TODO */
 }
@@ -182,7 +182,7 @@ void IDDepsNode::clear_components()
 	components.clear();
 }
 
-void IDDepsNode::build_operations(const OperationBuilder &builder) const
+void IDDepsNode::build_operations(const OperationBuilder &builder)
 {
 	for (IDDepsNode::ComponentMap::const_iterator it = this->components.begin(); it != this->components.end(); ++it) {
 		DepsNode *component = it->second;
@@ -190,73 +190,6 @@ void IDDepsNode::build_operations(const OperationBuilder &builder) const
 	}
 }
 
-/* Validate links between components */
-void IDDepsNode::validate_links(Depsgraph *graph)
-{
-#if 0
-	/* XXX WARNING: using ListBase is dangerous for virtual C++ classes,
-	 * loses vtable info!
-	 * Disabled for now due to unclear purpose, later use a std::vector or similar here
-	 */
-	
-	ListBase dummy_list = {NULL, NULL}; // XXX: perhaps this should live in the node?
-	
-	/* get our components ......................................................................... */
-	ComponentDepsNode *params = find_component(DEPSNODE_TYPE_PARAMETERS);
-	ComponentDepsNode *anim = find_component(DEPSNODE_TYPE_ANIMATION);
-	ComponentDepsNode *trans = find_component(DEPSNODE_TYPE_TRANSFORM);
-	ComponentDepsNode *geom = find_component(DEPSNODE_TYPE_GEOMETRY);
-	ComponentDepsNode *proxy = find_component(DEPSNODE_TYPE_PROXY);
-	ComponentDepsNode *pose = find_component(DEPSNODE_TYPE_EVAL_POSE);
-	ComponentDepsNode *psys = find_component(DEPSNODE_TYPE_EVAL_PARTICLES);
-	ComponentDepsNode *seq = find_component(DEPSNODE_TYPE_SEQUENCER);
-	
-	/* enforce (gross) ordering of these components................................................. */
-	// TODO: create relationships to do this...
-	
-	/* parameters should always exist... */
-	#pragma message("DEPSGRAPH PORTING XXX: params not always created, assert disabled for now")
-//	BLI_assert(params != NULL);
-	BLI_addhead(&dummy_list, params);
-	
-	/* anim before params */
-	if (anim && params) {
-		BLI_addhead(&dummy_list, anim);
-	}
-	
-	/* proxy before anim (or params) */
-	if (proxy) {
-		BLI_addhead(&dummy_list, proxy);
-	}
-	
-	/* transform after params */
-	if (trans) {
-		BLI_addtail(&dummy_list, trans);
-	}
-	
-	/* geometry after transform */
-	if (geom) {
-		BLI_addtail(&dummy_list, geom);
-	}
-	
-	/* pose eval after transform */
-	if (pose) {
-		BLI_addtail(&dummy_list, pose);
-	}
-#endif
-	
-	/* for each component, validate it's internal nodes ............................................ */
-	
-	/* NOTE: this is done after the component-level restrictions are done,
-	 * so that we can take those restrictions as a guide for our low-level
-	 * component restrictions...
-	 */
-	for (IDDepsNode::ComponentMap::const_iterator it = this->components.begin(); it != this->components.end(); ++it) {
-		DepsNode *component = it->second;
-		component->validate_links(graph);
-	}
-}
-
 void IDDepsNode::tag_update(Depsgraph *graph)
 {
 	for (ComponentMap::const_iterator it = components.begin(); it != components.end(); ++it) {
@@ -302,18 +235,12 @@ void SubgraphDepsNode::copy(DepsgraphCopyContext *dcc, const SubgraphDepsNode *s
 	/* for now, subgraph itself isn't copied... */
 }
 
-void SubgraphDepsNode::build_operations(const OperationBuilder &builder) const
+void SubgraphDepsNode::build_operations(const OperationBuilder &builder)
 {
 	if (graph)
 		graph->build_operations(builder);
 }
 
-/* Validate subgraph links... */
-void SubgraphDepsNode::validate_links(Depsgraph *graph)
-{
-	
-}
-
 DEG_DEPSNODE_DEFINE(SubgraphDepsNode, DEPSNODE_TYPE_SUBGRAPH, "Subgraph Node");
 static DepsNodeFactoryImpl<SubgraphDepsNode> DNTI_SUBGRAPH;
 
diff --git a/source/blender/depsgraph/intern/depsnode.h b/source/blender/depsgraph/intern/depsnode.h
index 10ec09b..f41b115 100644
--- a/source/blender/depsgraph/intern/depsnode.h
+++ b/source/blender/depsgraph/intern/depsnode.h
@@ -78,11 +78,8 @@ public:
 	virtual void init(const ID *id, const string &subdata) {}
 	virtual void copy(DepsgraphCopyContext *dcc, const DepsNode *src) {}
 	
-	virtual void build_operations(const OperationBuilder &builder) const = 0;
-	
-	/* Recursively ensure that all implicit/builtin link rules have been applied */
-	/* i.e. init()/cleanup() callbacks as last items for components + component ordering rules obeyed */
-	virtual void validate_links(Depsgraph *graph) {}
+	/* Generate inner nodes */
+	virtual void build_operations(const OperationBuilder &builder) = 0;
 	
 	virtual OperationDepsNode *find_entry_operation() const { return NULL; }
 	virtual OperationDepsNode *find_exit_operation() const { return NULL; }
@@ -109,7 +106,7 @@ struct ComponentDepsNode;
 struct TimeSourceDepsNode : public DepsNode {
 	// XXX: how do we keep track of the chain of time sources for propagation of delays?
 	
-	void build_operations(const OperationBuilder &builder) const;
+	void build_operations(const OperationBuilder &builder);
 	
 	double cfra;                    /* new "current time" */
 	double offset;                  /* time-offset relative to the "official" time source that this one has */
@@ -121,7 +118,7 @@ struct TimeSourceDepsNode : public DepsNode {
 struct RootDepsNode : public DepsNode {
 	TimeSourceDepsNode *add_time_source(const string &name = "");
 	
-	void build_operations(const OperationBuilder &builder) const;
+	void build_operations(const OperationBuilder 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list