[Bf-blender-cvs] [5c9c3a3234a] master: Nodes: add some utility methods to DerivedNodeTree

Jacques Lucke noreply at git.blender.org
Tue Jun 30 18:20:21 CEST 2020


Commit: 5c9c3a3234a3b0d6284910a7c4cf52e9422521cd
Author: Jacques Lucke
Date:   Tue Jun 30 17:54:43 2020 +0200
Branches: master
https://developer.blender.org/rB5c9c3a3234a3b0d6284910a7c4cf52e9422521cd

Nodes: add some utility methods to DerivedNodeTree

===================================================================

M	source/blender/blenkernel/BKE_derived_node_tree.hh

===================================================================

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



More information about the Bf-blender-cvs mailing list