[Bf-blender-cvs] [b7e2048] depsgraph_refactor: Assign zero cost to NOOP nodes, the priority for these only depends on the cost of child nodes then.

Lukas Tönne noreply at git.blender.org
Mon May 26 17:24:28 CEST 2014


Commit: b7e20481fa3a654175f3b46c6815e9f396dbb39f
Author: Lukas Tönne
Date:   Mon May 26 17:03:40 2014 +0200
https://developer.blender.org/rBb7e20481fa3a654175f3b46c6815e9f396dbb39f

Assign zero cost to NOOP nodes, the priority for these only depends
on the cost of child nodes then.

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

M	source/blender/depsgraph/intern/depsgraph_eval.cpp
M	source/blender/depsgraph/intern/depsnode_operation.h

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

diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cpp b/source/blender/depsgraph/intern/depsgraph_eval.cpp
index b69372c..bb70808 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_eval.cpp
@@ -111,7 +111,10 @@ static void calculate_eval_priority(OperationDepsNode *node)
 	node->done = 1;
 	
 	if (node->flag & DEPSOP_FLAG_NEEDS_UPDATE) {
-		node->eval_priority = 1.0f;
+		/* XXX standard cost of a node, could be estimated somewhat later on */
+		const float cost = 1.0f;
+		/* NOOP nodes have no cost */
+		node->eval_priority = node->is_noop() ? cost : 0.0f;
 		
 		for (OperationDepsNode::Relations::const_iterator it = node->outlinks.begin(); it != node->outlinks.end(); ++it) {
 			DepsRelation *rel = *it;
diff --git a/source/blender/depsgraph/intern/depsnode_operation.h b/source/blender/depsgraph/intern/depsnode_operation.h
index 2218f39..ddfafa8 100644
--- a/source/blender/depsgraph/intern/depsnode_operation.h
+++ b/source/blender/depsgraph/intern/depsnode_operation.h
@@ -65,6 +65,8 @@ struct OperationDepsNode : public DepsNode {
 	
 	void tag_update(Depsgraph *graph);
 	
+	bool is_noop() const { return evaluate == NULL; }
+	
 	ComponentDepsNode *owner;     /* component that contains the operation */
 	
 	DepsEvalOperationCb evaluate; /* callback for operation */




More information about the Bf-blender-cvs mailing list