Commit: f0381975f4a635e480e23f95ba41811014347dea
Author: Sergey Sharybin
Date: Fri Jan 9 16:15:31 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rBf0381975f4a635e480e23f95ba41811014347dea
Depsgraph: Don't add operations to graph if they already existed
We would need to avoid creating such an operations, but current solution
makes graph robust for such accidents. It's a bit slower but good enough
at this state.
===================================================================
M source/blender/depsgraph/intern/depsgraph_build.cpp
===================================================================
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cpp
b/source/blender/depsgraph/intern/depsgraph_build.cpp
index 7580f0c..5944f18 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -229,24 +229,36 @@ ComponentDepsNode
*DepsgraphNodeBuilder::add_component_node(ID *id, eDepsNode_Ty
}
OperationDepsNode *DepsgraphNodeBuilder::add_operation_node(ComponentDepsNode
*comp_node,
-
eDepsOperation_Type optype, DepsEvalOperationCb op,
-
eDepsOperation_Code opcode, const string &description)
-{
- OperationDepsNode *op_node = comp_node->add_operation(optype, op,
opcode, description);
- m_graph->operations.push_back(op_node);
+
eDepsOperation_Type optype,
+
DepsEvalOperationCb op,
+
eDepsOperation_Code opcode,
+ const string
&description)
+{
+ OperationDepsNode *op_node = comp_node->has_operation(opcode,
description);
+ if (op_node == NULL) {
+ op_node = comp_node->add_operation(optype, op, opcode,
description);
+ m_graph->operations.push_back(op_node);
+ }
+ else {
+ /* TODO(sergey): Ideally graph builder shouldn't create
duplicate nodes. */
+ fprintf(stderr, "add_operation: Operation already exists - %s
has %s at %p\n",
+ comp_node->identifier().c_str(),
+ op_node->identifier().c_str(),
+ op_node);
+ }
return op_node;
}
-OperationDepsNode *DepsgraphNodeBuilder::add_operation_node(ID *id,
eDepsNode_Type comp_type, const string &comp_name,
-
eDepsOperation_Type optype, DepsEvalOperationCb op,
-
eDepsOperation_Code opcode, const string &description)
+OperationDepsNode *DepsgraphNodeBuilder::add_operation_node(ID *id,
+ eDepsNode_Type
comp_type,
+ const string
&comp_name,
+
eDepsOperation_Type optype,
+
DepsEvalOperationCb op,
+
eDepsOperation_Code opcode,
+ const string
&description)
{
ComponentDepsNode *comp_node = add_component_node(id, comp_type,
comp_name);
-
- OperationDepsNode *op_node = comp_node->add_operation(optype, op,
opcode, description);
- m_graph->operations.push_back(op_node);
-
- return op_node;
+ return add_operation_node(comp_node, optype, op, opcode, description);
}
/* ************************************************* */
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs