diff options
author | Jacques Lucke <jacques@blender.org> | 2020-06-30 18:54:43 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-06-30 19:18:47 +0300 |
commit | 5c9c3a3234a3b0d6284910a7c4cf52e9422521cd (patch) | |
tree | 8fd458250d9fe0eecaf7a632ed70979abf81ec7a | |
parent | e60b6f586b38927aa7dc1037c56e51843bfbbe5d (diff) |
Nodes: add some utility methods to DerivedNodeTree
-rw-r--r-- | source/blender/blenkernel/BKE_derived_node_tree.hh | 26 |
1 files changed, 26 insertions, 0 deletions
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<const DInputSocket *> input_sockets() const; Span<const DOutputSocket *> output_sockets() const; + Span<const DGroupInput *> 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<const DNode *> DerivedNodeTree::nodes_by_type(const bNodeType *nodet } } +inline Span<const DSocket *> DerivedNodeTree::sockets() const +{ + return m_sockets_by_id.as_span(); +} + inline Span<const DInputSocket *> DerivedNodeTree::input_sockets() const { return m_input_sockets.as_span(); @@ -456,6 +477,11 @@ inline Span<const DOutputSocket *> DerivedNodeTree::output_sockets() const return m_output_sockets.as_span(); } +inline Span<const DGroupInput *> DerivedNodeTree::group_inputs() const +{ + return m_group_inputs.as_span(); +} + } // namespace bke } // namespace blender |