Blender  V3.3
NOD_socket_search_link.hh
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
5 #include <functional>
6 
7 #include "BLI_string_ref.hh"
8 #include "BLI_vector.hh"
9 
10 #include "DNA_node_types.h" /* Necessary for eNodeSocketInOut. */
11 
12 #include "NOD_node_declaration.hh"
13 
14 struct bContext;
15 
16 namespace blender::nodes {
17 
22  private:
26  Vector<bNode *> &added_nodes_;
27 
28  public:
29  const bContext &C;
39 
42  bNode &node,
44  Vector<bNode *> &added_nodes)
45  : added_nodes_(added_nodes), C(C), node_tree(node_tree), node(node), socket(socket)
46  {
47  }
48 
49  bNode &add_node(StringRef idname);
50  bNode &add_node(const bNodeType &type);
55  void connect_available_socket(bNode &new_node, StringRef socket_name);
59  void update_and_connect_available_socket(bNode &new_node, StringRef socket_name);
60 };
61 
63  using LinkSocketFn = std::function<void(LinkSearchOpParams &link_params)>;
64 
65  std::string name;
67  int weight = 0;
68 };
69 
72  const bNodeType &node_type_;
73 
74  const bNodeTree &node_tree_;
75 
76  const bNodeSocket &other_socket_;
77 
78  /* The operations currently being built. Owned by the caller. */
80 
81  public:
83  const bNodeTree &node_tree,
86  : node_type_(node_type), node_tree_(node_tree), other_socket_(other_socket), items_(items)
87  {
88  }
89 
93  const bNodeSocket &other_socket() const;
94 
98  const bNodeTree &node_tree() const;
99 
103  const bNodeType &node_type() const;
104 
108  eNodeSocketInOut in_out() const;
109 
117  void add_item(std::string socket_name, SocketLinkOperation::LinkSocketFn fn, int weight = 0);
118 };
119 
132 void search_link_ops_for_basic_node(GatherLinkSearchOpParams &params);
133 
134 void search_link_ops_for_declarations(GatherLinkSearchOpParams &params,
135  Span<SocketDeclarationPtr> declarations);
136 
137 } // namespace blender::nodes
eNodeSocketInOut
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
void add_item(std::string socket_name, SocketLinkOperation::LinkSocketFn fn, int weight=0)
GatherLinkSearchOpParams(const bNodeType &node_type, const bNodeTree &node_tree, const bNodeSocket &other_socket, Vector< SocketLinkOperation > &items)
const bNodeSocket & other_socket() const
void connect_available_socket(bNode &new_node, StringRef socket_name)
bNode & add_node(StringRef idname)
LinkSearchOpParams(const bContext &C, bNodeTree &node_tree, bNode &node, bNodeSocket &socket, Vector< bNode * > &added_nodes)
void update_and_connect_available_socket(bNode &new_node, StringRef socket_name)
SyclQueue void void size_t num_bytes void
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void search_link_ops_for_basic_node(GatherLinkSearchOpParams &params)
void search_link_ops_for_declarations(GatherLinkSearchOpParams &params, Span< SocketDeclarationPtr > declarations)
Defines a node type.
Definition: BKE_node.h:226
std::function< void(LinkSearchOpParams &link_params)> LinkSocketFn