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:
authorJacques Lucke <jacques@blender.org>2020-07-10 15:18:51 +0300
committerJacques Lucke <jacques@blender.org>2020-07-10 15:23:13 +0300
commit7bae599232ab5d00a0b7a9e310741df6fbea204f (patch)
treea66f2a6f0388286da2e824cf080aaf585d1e978e /source/blender
parent3121015dceb1d269d79690c8f15c8e1406c9b09f (diff)
Nodes: add redundant name check in debug builds to prevent errors
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_derived_node_tree.hh19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_derived_node_tree.hh b/source/blender/blenkernel/BKE_derived_node_tree.hh
index 3790d06a534..083057835a5 100644
--- a/source/blender/blenkernel/BKE_derived_node_tree.hh
+++ b/source/blender/blenkernel/BKE_derived_node_tree.hh
@@ -140,6 +140,9 @@ class DNode : NonCopyable, NonMovable {
const DInputSocket &input(uint index) const;
const DOutputSocket &output(uint index) const;
+ const DInputSocket &input(uint index, StringRef expected_name) const;
+ const DOutputSocket &output(uint index, StringRef expected_name) const;
+
uint id() const;
PointerRNA *rna() const;
@@ -408,6 +411,22 @@ inline const DOutputSocket &DNode::output(uint index) const
return *outputs_[index];
}
+inline const DInputSocket &DNode::input(uint index, StringRef expected_name) const
+{
+ const DInputSocket &socket = *inputs_[index];
+ BLI_assert(socket.name() == expected_name);
+ UNUSED_VARS_NDEBUG(expected_name);
+ return socket;
+}
+
+inline const DOutputSocket &DNode::output(uint index, StringRef expected_name) const
+{
+ const DOutputSocket &socket = *outputs_[index];
+ BLI_assert(socket.name() == expected_name);
+ UNUSED_VARS_NDEBUG(expected_name);
+ return socket;
+}
+
inline uint DNode::id() const
{
return id_;