[Bf-blender-cvs] [93e8a045df4] master: Depsgraph: Introduce explicit method which finds operation or returns NULL
Sergey Sharybin
noreply at git.blender.org
Fri Nov 24 15:36:16 CET 2017
Commit: 93e8a045df4cecdd0572dfd583e697552d8a9b10
Author: Sergey Sharybin
Date: Fri Nov 24 15:24:33 2017 +0100
Branches: master
https://developer.blender.org/rB93e8a045df4cecdd0572dfd583e697552d8a9b10
Depsgraph: Introduce explicit method which finds operation or returns NULL
===================================================================
M source/blender/depsgraph/intern/nodes/deg_node_component.cc
M source/blender/depsgraph/intern/nodes/deg_node_component.h
===================================================================
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.cc b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
index f520fc7ef52..bbf4a46fa78 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
@@ -163,18 +163,31 @@ string ComponentDepsNode::identifier() const
return string(typebuf) + name + " : " + idname + " (Layers: " + layers + ")";
}
+OperationDepsNode *ComponentDepsNode::find_operation(OperationIDKey key) const
+{
+ OperationDepsNode *node =
+ (OperationDepsNode *)BLI_ghash_lookup(operations_map, &key);
+ return node;
+}
+
+OperationDepsNode *ComponentDepsNode::find_operation(eDepsOperation_Code opcode,
+ const char *name,
+ int name_tag) const
+{
+ OperationIDKey key(opcode, name, name_tag);
+ return find_operation(key);
+}
+
OperationDepsNode *ComponentDepsNode::get_operation(OperationIDKey key) const
{
- OperationDepsNode *node = reinterpret_cast<OperationDepsNode *>(BLI_ghash_lookup(operations_map, &key));
- if (node != NULL) {
- return node;
- }
- else {
+ OperationDepsNode *node = find_operation(key);
+ if (node == NULL) {
fprintf(stderr, "%s: find_operation(%s) failed\n",
this->identifier().c_str(), key.identifier().c_str());
BLI_assert(!"Request for non-existing operation, should not happen");
return NULL;
}
+ return node;
}
OperationDepsNode *ComponentDepsNode::get_operation(eDepsOperation_Code opcode,
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.h b/source/blender/depsgraph/intern/nodes/deg_node_component.h
index 39365ad31af..a9a5904b4ec 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.h
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.h
@@ -74,6 +74,14 @@ struct ComponentDepsNode : public DepsNode {
string identifier() const;
+ /* Find an existing operation, if requested operation does not exist
+ * NULL will be returned.
+ */
+ OperationDepsNode *find_operation(OperationIDKey key) const;
+ OperationDepsNode *find_operation(eDepsOperation_Code opcode,
+ const char *name,
+ int name_tag) const;
+
/* Find an existing operation, will throw an assert() if it does not exist. */
OperationDepsNode *get_operation(OperationIDKey key) const;
OperationDepsNode *get_operation(eDepsOperation_Code opcode,
More information about the Bf-blender-cvs
mailing list