diff options
Diffstat (limited to 'source/blender/blenkernel/BKE_derived_node_tree.hh')
-rw-r--r-- | source/blender/blenkernel/BKE_derived_node_tree.hh | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/source/blender/blenkernel/BKE_derived_node_tree.hh b/source/blender/blenkernel/BKE_derived_node_tree.hh index 2ed96f0c60d..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; @@ -313,12 +316,12 @@ inline const InputSocketRef &DInputSocket::socket_ref() const inline Span<const DOutputSocket *> DInputSocket::linked_sockets() const { - return linked_sockets_.as_span(); + return linked_sockets_; } inline Span<const DGroupInput *> DInputSocket::linked_group_inputs() const { - return linked_group_inputs_.as_span(); + return linked_group_inputs_; } inline bool DInputSocket::is_linked() const @@ -337,7 +340,7 @@ inline const OutputSocketRef &DOutputSocket::socket_ref() const inline Span<const DInputSocket *> DOutputSocket::linked_sockets() const { - return linked_sockets_.as_span(); + return linked_sockets_; } /* -------------------------------------------------------------------- @@ -361,7 +364,7 @@ inline const DParentNode *DGroupInput::parent() const inline Span<const DInputSocket *> DGroupInput::linked_sockets() const { - return linked_sockets_.as_span(); + return linked_sockets_; } inline uint DGroupInput::id() 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_; @@ -453,7 +472,7 @@ inline uint DParentNode::id() const inline Span<const DNode *> DerivedNodeTree::nodes() const { - return nodes_by_id_.as_span(); + return nodes_by_id_; } inline Span<const DNode *> DerivedNodeTree::nodes_by_type(StringRefNull idname) const @@ -469,28 +488,28 @@ inline Span<const DNode *> DerivedNodeTree::nodes_by_type(const bNodeType *nodet return {}; } else { - return nodes->as_span(); + return *nodes; } } inline Span<const DSocket *> DerivedNodeTree::sockets() const { - return sockets_by_id_.as_span(); + return sockets_by_id_; } inline Span<const DInputSocket *> DerivedNodeTree::input_sockets() const { - return input_sockets_.as_span(); + return input_sockets_; } inline Span<const DOutputSocket *> DerivedNodeTree::output_sockets() const { - return output_sockets_.as_span(); + return output_sockets_; } inline Span<const DGroupInput *> DerivedNodeTree::group_inputs() const { - return group_inputs_.as_span(); + return group_inputs_; } } // namespace blender::bke |