From 5c9c3a3234a3b0d6284910a7c4cf52e9422521cd Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 30 Jun 2020 17:54:43 +0200 Subject: Nodes: add some utility methods to DerivedNodeTree --- source/blender/blenkernel/BKE_derived_node_tree.hh | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_derived_node_tree.hh b/source/blender/blenkernel/BKE_derived_node_tree.hh index 1c586f9b4c6..b5ced6ab772 100644 --- a/source/blender/blenkernel/BKE_derived_node_tree.hh +++ b/source/blender/blenkernel/BKE_derived_node_tree.hh @@ -67,6 +67,10 @@ class DSocket : NonCopyable, NonMovable { PointerRNA *rna() const; StringRefNull idname() const; StringRefNull name() const; + + const SocketRef &socket_ref() const; + + bool is_available() const; }; class DInputSocket : public DSocket { @@ -187,6 +191,8 @@ class DerivedNodeTree : NonCopyable, NonMovable { Span input_sockets() const; Span output_sockets() const; + Span group_inputs() const; + std::string to_dot() const; private: @@ -280,6 +286,16 @@ inline StringRefNull DSocket::name() const return m_socket_ref->name(); } +inline const SocketRef &DSocket::socket_ref() const +{ + return *m_socket_ref; +} + +inline bool DSocket::is_available() const +{ + return (m_socket_ref->bsocket()->flag & SOCK_UNAVAIL) == 0; +} + /* -------------------------------------------------------------------- * DInputSocket inline methods. */ @@ -446,6 +462,11 @@ inline Span DerivedNodeTree::nodes_by_type(const bNodeType *nodet } } +inline Span DerivedNodeTree::sockets() const +{ + return m_sockets_by_id.as_span(); +} + inline Span DerivedNodeTree::input_sockets() const { return m_input_sockets.as_span(); @@ -456,6 +477,11 @@ inline Span DerivedNodeTree::output_sockets() const return m_output_sockets.as_span(); } +inline Span DerivedNodeTree::group_inputs() const +{ + return m_group_inputs.as_span(); +} + } // namespace bke } // namespace blender -- cgit v1.2.3