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
path: root/source
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-05-13 14:42:38 +0300
committerJacques Lucke <jacques@blender.org>2021-05-13 14:42:38 +0300
commit64f1d5e7c17a46ba2faa5fe62baa539613a439a2 (patch)
treeffdbe8fcf681dd796761bf1232dc6fa29bf7d2c5 /source
parentd288eeb79abc08d09f535bfd5d64b623d26bd129 (diff)
Nodes: add utility method to get input/output of a DNode
This is a fairly common operation, so there should be a method that does it to avoid unnecessary complexity at the caller site.
Diffstat (limited to 'source')
-rw-r--r--source/blender/nodes/NOD_derived_node_tree.hh13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/nodes/NOD_derived_node_tree.hh b/source/blender/nodes/NOD_derived_node_tree.hh
index e294bef2ea8..7ff05449c0b 100644
--- a/source/blender/nodes/NOD_derived_node_tree.hh
+++ b/source/blender/nodes/NOD_derived_node_tree.hh
@@ -92,6 +92,9 @@ class DNode {
operator bool() const;
uint64_t hash() const;
+
+ DInputSocket input(int index) const;
+ DOutputSocket output(int index) const;
};
/* A (nullable) reference to a socket and the context it is in. It is unique within an entire
@@ -274,6 +277,16 @@ inline uint64_t DNode::hash() const
return get_default_hash_2(context_, node_ref_);
}
+inline DInputSocket DNode::input(int index) const
+{
+ return {context_, &node_ref_->input(index)};
+}
+
+inline DOutputSocket DNode::output(int index) const
+{
+ return {context_, &node_ref_->output(index)};
+}
+
/* --------------------------------------------------------------------
* DSocket inline methods.
*/