Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-11-24 17:40:53 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-11-24 17:40:53 +0300
commitc546fb9e85d8cd056378fdc90b6858e3b0a68bf2 (patch)
tree21add688324519309eaf3a202afdbe627702c78f /source/blender/depsgraph/intern/nodes
parentdc2ae8fdf2a28821b337acbc1a592506ad2674c6 (diff)
parent5f7981243e70772cb4ef3b14c55c95d4a3e67b4e (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/depsgraph/intern/nodes')
-rw-r--r--source/blender/depsgraph/intern/nodes/deg_node_component.cc39
-rw-r--r--source/blender/depsgraph/intern/nodes/deg_node_component.h20
2 files changed, 39 insertions, 20 deletions
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.cc b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
index bba16316288..c22e74f4577 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
@@ -176,34 +176,45 @@ OperationDepsNode *ComponentDepsNode::find_operation(OperationIDKey key) const
}
}
}
+ return node;
+}
- if (node != NULL) {
- return node;
- }
- else {
+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 = 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::find_operation(eDepsOperation_Code opcode,
- const char *name,
- int name_tag) const
+OperationDepsNode *ComponentDepsNode::get_operation(eDepsOperation_Code opcode,
+ const char *name,
+ int name_tag) const
{
OperationIDKey key(opcode, name, name_tag);
- return find_operation(key);
+ return get_operation(key);
}
-OperationDepsNode *ComponentDepsNode::has_operation(OperationIDKey key) const
+bool ComponentDepsNode::has_operation(OperationIDKey key) const
{
- return reinterpret_cast<OperationDepsNode *>(BLI_ghash_lookup(operations_map, &key));
+ return find_operation(key) != NULL;
}
-OperationDepsNode *ComponentDepsNode::has_operation(eDepsOperation_Code opcode,
- const char *name,
- int name_tag) const
+bool ComponentDepsNode::has_operation(eDepsOperation_Code opcode,
+ const char *name,
+ int name_tag) const
{
OperationIDKey key(opcode, name, name_tag);
return has_operation(key);
@@ -214,7 +225,7 @@ OperationDepsNode *ComponentDepsNode::add_operation(const DepsEvalOperationCb& o
const char *name,
int name_tag)
{
- OperationDepsNode *op_node = has_operation(opcode, name, name_tag);
+ OperationDepsNode *op_node = find_operation(opcode, name, name_tag);
if (!op_node) {
DepsNodeFactory *factory = deg_get_node_factory(DEG_NODE_TYPE_OPERATION);
op_node = (OperationDepsNode *)factory->create_node(this->owner->id_orig, "", name);
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.h b/source/blender/depsgraph/intern/nodes/deg_node_component.h
index 9be5388e69f..ba4f8551fea 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.h
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.h
@@ -74,18 +74,26 @@ struct ComponentDepsNode : public DepsNode {
string identifier() const;
- /* Find an existing operation, will throw an assert() if it does not exist. */
+ /* 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;
+ const char *name,
+ int name_tag) const;
- /* Check operation exists and return it. */
- OperationDepsNode *has_operation(OperationIDKey key) const;
- OperationDepsNode *has_operation(eDepsOperation_Code opcode,
+ /* 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,
const char *name,
int name_tag) const;
+ /* Check operation exists and return it. */
+ bool has_operation(OperationIDKey key) const;
+ bool has_operation(eDepsOperation_Code opcode,
+ const char *name,
+ int name_tag) const;
+
/**
* Create a new node for representing an operation and add this to graph
* \warning If an existing node is found, it will be modified. This helps