17 class NodeDeclarationBuilder;
142 template<
typename SocketDecl>
145 using Self =
typename SocketDecl::Builder;
146 static_assert(std::is_base_of_v<SocketDeclaration, SocketDecl>);
154 decl_->hide_label_ = value;
155 return *(
Self *)
this;
160 decl_->hide_value_ = value;
161 return *(
Self *)
this;
166 decl_->is_multi_input_ = value;
167 return *(
Self *)
this;
172 decl_->description_ = std::move(value);
173 return *(
Self *)
this;
178 decl_->no_mute_links_ = value;
179 return *(
Self *)
this;
188 decl_->is_unavailable_ = value;
189 return *(
Self *)
this;
194 decl_->is_attribute_name_ = value;
195 return *(
Self *)
this;
200 decl_->is_default_link_socket_ = value;
201 return *(
Self *)
this;
208 return *(
Self *)
this;
216 return *(
Self *)
this;
223 return *(
Self *)
this;
230 return *(
Self *)
this;
237 std::move(input_dependencies));
238 return *(
Self *)
this;
249 decl_->make_available_fn_ = std::move(fn);
250 return *(
Self *)
this;
260 bool is_function_node_ =
false;
273 return is_function_node_;
276 MEM_CXX_CLASS_ALLOC_FUNCS(
"NodeDeclaration")
295 "is_function_node() must be called before any socket is created");
296 declaration_.is_function_node_ = value;
299 template<
typename DeclType>
301 template<
typename DeclType>
305 template<
typename DeclType>
306 typename DeclType::Builder &add_socket(
StringRef name,
319 return field_dependency;
326 return field_dependency;
333 return field_dependency;
344 field_dependency.linked_input_indices_ = std::move(
indices);
346 return field_dependency;
356 return linked_input_indices_;
361 return a.type_ ==
b.type_ &&
a.linked_input_indices_ ==
b.linked_input_indices_;
377 return a.inputs ==
b.inputs &&
a.outputs ==
b.outputs;
445 : declaration_(declaration)
449 template<
typename DeclType>
453 return this->add_socket<DeclType>(name, identifier,
SOCK_IN);
456 template<
typename DeclType>
460 return this->add_socket<DeclType>(name, identifier,
SOCK_OUT);
463 template<
typename DeclType>
464 inline typename DeclType::Builder &NodeDeclarationBuilder::add_socket(
StringRef name,
468 static_assert(std::is_base_of_v<SocketDeclaration, DeclType>);
469 using Builder =
typename DeclType::Builder;
472 declaration_.outputs_;
474 std::unique_ptr<DeclType> socket_decl = std::make_unique<DeclType>();
475 std::unique_ptr<Builder> socket_decl_builder = std::make_unique<Builder>();
476 socket_decl_builder->decl_ = &*socket_decl;
477 socket_decl->name_ = name;
478 socket_decl->identifier_ = identifier.
is_empty() ? name : identifier;
479 socket_decl->in_out_ = in_out;
484 declarations.
append(std::move(socket_decl));
485 Builder &socket_decl_builder_ref = *socket_decl_builder;
486 builders_.append(std::move(socket_decl_builder));
487 return socket_decl_builder_ref;
#define BLI_assert_msg(a, msg)
constexpr bool is_empty() const
void append(const T &value)
virtual ~BaseSocketDeclarationBuilder()=default
void is_function_node(bool value=true)
NodeDeclarationBuilder(NodeDeclaration &declaration)
DeclType::Builder & add_input(StringRef name, StringRef identifier="")
DeclType::Builder & add_output(StringRef name, StringRef identifier="")
bool matches(const bNode &node) const
Span< SocketDeclarationPtr > outputs() const
Span< SocketDeclarationPtr > inputs() const
Span< SocketDeclarationPtr > sockets(eNodeSocketInOut in_out) const
bool is_function_node() const
friend bool operator==(const OutputFieldDependency &a, const OutputFieldDependency &b)
static OutputFieldDependency ForPartiallyDependentField(Vector< int > indices)
static OutputFieldDependency ForDataSource()
static OutputFieldDependency ForDependentField()
Span< int > linked_input_indices() const
static OutputFieldDependency ForFieldSource()
OutputSocketFieldType field_type() const
Self & make_available(std::function< void(bNode &)> fn)
Self & is_attribute_name(bool value=true)
Self & description(std::string value="")
Self & hide_value(bool value=true)
Self & dependent_field(Vector< int > input_dependencies)
Self & unavailable(bool value=true)
Self & multi_input(bool value=true)
Self & no_muted_links(bool value=true)
typename SocketDecl::Builder Self
Self & is_default_link_socket(bool value=true)
Self & hide_label(bool value=true)
virtual bool matches(const bNodeSocket &socket) const =0
StringRefNull identifier() const
InputSocketFieldType input_field_type_
bool matches_common_data(const bNodeSocket &socket) const
const OutputFieldDependency & output_field_dependency() const
bool is_default_link_socket_
StringRefNull name() const
void make_available(bNode &node) const
friend NodeDeclarationBuilder
StringRefNull description() const
virtual ~SocketDeclaration()=default
virtual bool can_connect(const bNodeSocket &socket) const =0
bool is_attribute_name() const
OutputFieldDependency output_field_dependency_
std::function< void(bNode &)> make_available_fn_
eNodeSocketInOut in_out() const
virtual bNodeSocket & build(bNodeTree &ntree, bNode &node) const =0
virtual bNodeSocket & update_or_build(bNodeTree &ntree, bNode &node, bNodeSocket &socket) const
InputSocketFieldType input_field_type() const
void set_common_flags(bNodeSocket &socket) const
bool is_default_link_socket() const
SyclQueue void void size_t num_bytes void
ccl_gpu_kernel_postfix int ccl_global int * indices
bool operator!=(const DNode &a, const DNode &b)
std::unique_ptr< SocketDeclaration > SocketDeclarationPtr
bool operator==(const DNode &a, const DNode &b)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
Vector< OutputFieldDependency > outputs
Vector< InputSocketFieldType > inputs