[Bf-blender-cvs] [3b0d5e7] depsgraph_refactor: Removed 'add_operation' from Depsgraph.

Lukas Tönne noreply at git.blender.org
Sat Apr 12 12:56:38 CEST 2014


Commit: 3b0d5e71eec266f6566a4d69ea14cfc13bafe398
Author: Lukas Tönne
Date:   Sat Apr 12 12:49:40 2014 +0200
https://developer.blender.org/rB3b0d5e71eec266f6566a4d69ea14cfc13bafe398

Removed 'add_operation' from Depsgraph.

This is now always done in the respective component node directly.

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

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

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

diff --git a/source/blender/depsgraph/intern/depsgraph.cpp b/source/blender/depsgraph/intern/depsgraph.cpp
index 453e888..ba3b051 100644
--- a/source/blender/depsgraph/intern/depsgraph.cpp
+++ b/source/blender/depsgraph/intern/depsgraph.cpp
@@ -174,29 +174,6 @@ DepsNode *Depsgraph::find_node_from_pointer(const PointerRNA *ptr, const Propert
 
 /* Convenience Functions ---------------------------- */
 
-/* Create a new node for representing an operation and add this to graph */
-OperationDepsNode *Depsgraph::add_operation(ID *id, const string &subdata,
-                                            eDepsNode_Type type, eDepsOperation_Type optype, 
-                                            DepsEvalOperationCb op, const string &name)
-{
-	OperationDepsNode *op_node = NULL;
-	
-	/* sanity check */
-	if (ELEM(NULL, id, op))
-		return NULL;
-	
-	/* create operation node (or find an existing but perhaps on partially completed one) */
-	op_node = (OperationDepsNode *)get_node(id, subdata, type, name);
-	BLI_assert(op_node != NULL);
-	
-	/* attach extra data... */
-	op_node->evaluate = op;
-	op_node->optype = optype;
-	
-	/* return newly created node */
-	return op_node;
-}
-
 IDDepsNode *Depsgraph::find_id_node(const ID *id) const
 {
 	IDNodeMap::const_iterator it = this->id_hash.find(id);
diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h
index 67ef285..e98e558 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -139,20 +139,6 @@ struct Depsgraph {
 	 */
 	DepsNode *add_new_node(const ID *id, const string &subdata,
 	                       eDepsNode_Type type, const string &name);
-	/* Create a new node for representing an operation and add this to graph
-	 * ! If an existing node is found, it will be modified. This helps when node may 
-	 *   have been partially created earlier (e.g. parent ref before parent item is added)
-	 *
-	 * < id: ID-Block that operation will be performed on
-	 * < (subdata): identifier for sub-ID data that this is for (e.g. bones)
-	 * < type: Operation node type (corresponding to context/component that it operates in)
-	 * < optype: Role that operation plays within component (i.e. where in eval process)
-	 * < op: The operation to perform
-	 * < name: Identifier for operation - used to find/locate it again
-	 */
-	OperationDepsNode *add_operation(ID *id, const string &subdata,
-	                                 eDepsNode_Type type, eDepsOperation_Type optype, 
-	                                 DepsEvalOperationCb op, const string &name);
 	
 	IDDepsNode *find_id_node(const ID *id) const;
 	IDDepsNode *get_id_node(const ID *id, const string &name = "");
diff --git a/source/blender/depsgraph/intern/depsnode_component.cpp b/source/blender/depsgraph/intern/depsnode_component.cpp
index b4474d6..953afd2 100644
--- a/source/blender/depsgraph/intern/depsnode_component.cpp
+++ b/source/blender/depsgraph/intern/depsnode_component.cpp
@@ -98,13 +98,16 @@ OperationDepsNode *ComponentDepsNode::add_operation(eDepsNode_Type type, eDepsOp
 	if (!op_node) {
 		DepsNodeFactory *factory = DEG_get_node_factory(type);
 		op_node = (OperationDepsNode *)factory->create_node(this->owner->id, "", name);
-		/* attach extra data */
-		op_node->evaluate = op;
-		op_node->optype = optype;
 		
 		/* register */
 		this->operations[name] = op_node;
 	}
+	
+	/* attach extra data */
+	op_node->evaluate = op;
+	op_node->optype = optype;
+	op_node->name = name;
+	
 	return op_node;
 }
 
@@ -232,19 +235,19 @@ void PoseComponentDepsNode::validate_links(Depsgraph *graph)
 		ob = (Object *)id;
 		
 		/* create standard pose evaluation start/end hooks */
-		rebuild_op = graph->add_operation(id, "", DEPSNODE_TYPE_OP_POSE,
-		                                  DEPSOP_TYPE_REBUILD, BKE_pose_rebuild_op,
-		                                  "Rebuild Pose");
+		rebuild_op = add_operation(DEPSNODE_TYPE_OP_POSE,
+		                           DEPSOP_TYPE_REBUILD, BKE_pose_rebuild_op,
+		                           "Rebuild Pose");
 		RNA_pointer_create(id, &RNA_Pose, ob->pose, &rebuild_op->ptr);
 		
-		init_op = graph->add_operation(id, "", DEPSNODE_TYPE_OP_POSE,
-		                               DEPSOP_TYPE_INIT, BKE_pose_eval_init,
-		                               "Init Pose Eval");
+		init_op = add_operation(DEPSNODE_TYPE_OP_POSE,
+		                        DEPSOP_TYPE_INIT, BKE_pose_eval_init,
+		                        "Init Pose Eval");
 		RNA_pointer_create(id, &RNA_Pose, ob->pose, &init_op->ptr);
 		
-		cleanup_op = graph->add_operation(id, "", DEPSNODE_TYPE_OP_POSE,
-		                                  DEPSOP_TYPE_POST, BKE_pose_eval_flush,
-		                                  "Flush Pose Eval");
+		cleanup_op = add_operation(DEPSNODE_TYPE_OP_POSE,
+		                           DEPSOP_TYPE_POST, BKE_pose_eval_flush,
+		                           "Flush Pose Eval");
 		RNA_pointer_create(id, &RNA_Pose, ob->pose, &cleanup_op->ptr);
 		
 		
diff --git a/source/blender/depsgraph/intern/depsnode_component.h b/source/blender/depsgraph/intern/depsnode_component.h
index aa6ed52..2245849 100644
--- a/source/blender/depsgraph/intern/depsnode_component.h
+++ b/source/blender/depsgraph/intern/depsnode_component.h
@@ -58,6 +58,15 @@ struct ComponentDepsNode : public DepsNode {
 	~ComponentDepsNode();
 	
 	OperationDepsNode *find_operation(const string &name) const;
+	/* Create a new node for representing an operation and add this to graph
+	 * ! If an existing node is found, it will be modified. This helps when node may 
+	 *   have been partially created earlier (e.g. parent ref before parent item is added)
+	 *
+	 * < type: Operation node type (corresponding to context/component that it operates in)
+	 * < optype: Role that operation plays within component (i.e. where in eval process)
+	 * < op: The operation to perform
+	 * < name: Identifier for operation - used to find/locate it again
+	 */
 	OperationDepsNode *add_operation(eDepsNode_Type type, eDepsOperation_Type optype, 
 	                                 DepsEvalOperationCb op, const string &name);
 	void remove_operation(const string &name);




More information about the Bf-blender-cvs mailing list