27class NodeDeclarationBuilder;
63class OutputFieldDependency {
69 static OutputFieldDependency ForFieldSource();
70 static OutputFieldDependency ForDataSource();
71 static OutputFieldDependency ForDependentField();
72 static OutputFieldDependency ForPartiallyDependentField(
Vector<int> indices);
90namespace anonymous_attribute_lifetime {
150namespace aal = anonymous_attribute_lifetime;
202 int compositor_domain_priority_ = 0;
206 bool compositor_expects_single_value_ =
false;
209 std::function<void(
bNode &)> make_available_fn_;
399template<
typename SocketDecl>
402 using Self =
typename SocketDecl::Builder;
403 static_assert(std::is_base_of_v<SocketDeclaration, SocketDecl>);
458 template<
typename DeclType>
460 template<
typename DeclType>
522 MEM_CXX_CLASS_ALLOC_FUNCS(
"NodeDeclaration")
529 const bNode *node_ =
nullptr;
534 bool is_function_node_ =
false;
542 const bNode *node =
nullptr);
562 is_function_node_ =
true;
570 template<
typename DeclType>
572 template<
typename DeclType>
605 template<
typename DeclType>
606 typename DeclType::Builder &add_socket(
StringRef name,
615 void build_remaining_anonymous_attribute_relations();
618namespace implicit_field_inputs {
627 NodeDeclaration &r_declaration,
638template<
typename DeclType>
643 static typename DeclType::Builder dummy_builder = {};
645 return dummy_builder;
648 return node_decl_builder_->add_socket<DeclType>(name, identifier,
"",
SOCK_IN);
651template<
typename DeclType>
656 static typename DeclType::Builder dummy_builder = {};
658 return dummy_builder;
661 return node_decl_builder_->add_socket<DeclType>(name,
"", identifier,
SOCK_OUT);
691template<
typename DeclType>
695 set_active_panel_builder(
nullptr);
696 return this->add_socket<DeclType>(name, identifier,
"",
SOCK_IN);
699template<
typename DeclType>
703 set_active_panel_builder(
nullptr);
704 return this->add_socket<DeclType>(name,
"", identifier,
SOCK_OUT);
707template<
typename DeclType>
708inline typename DeclType::Builder &NodeDeclarationBuilder::add_socket(
StringRef name,
713 static_assert(std::is_base_of_v<SocketDeclaration, DeclType>);
714 using Builder =
typename DeclType::Builder;
718 std::unique_ptr<Builder> socket_decl_builder = std::make_unique<Builder>();
719 socket_decl_builder->node_decl_builder_ =
this;
722 std::unique_ptr<DeclType> socket_decl = std::make_unique<DeclType>();
723 socket_decl_builder->decl_ = &*socket_decl;
724 socket_decl_builder->decl_base_ = &*socket_decl;
725 socket_decl->name = name;
726 socket_decl->identifier = identifier_in.
is_empty() ? name : identifier_in;
728 socket_decl->socket_type = DeclType::static_socket_type;
729 socket_decl_builder->index_ = declaration_.
inputs.append_and_get_index(socket_decl.get());
731 input_socket_builders_.append(&*socket_decl_builder);
734 std::unique_ptr<DeclType> socket_decl = std::make_unique<DeclType>();
735 socket_decl_builder->decl_ = &*socket_decl;
736 socket_decl_builder->decl_base_ = &*socket_decl;
737 socket_decl->name = name;
738 socket_decl->identifier = identifier_out.
is_empty() ? name : identifier_out;
740 socket_decl->socket_type = DeclType::static_socket_type;
741 socket_decl_builder->index_ = declaration_.
outputs.append_and_get_index(socket_decl.get());
743 output_socket_builders_.append(&*socket_decl_builder);
746 if (is_function_node_) {
748 socket_decl_builder->supports_field();
751 socket_decl_builder->dependent_field();
755 Builder &socket_decl_builder_ref = *socket_decl_builder;
756 socket_builders_.append(std::move(socket_decl_builder));
758 return socket_decl_builder_ref;
#define BLI_assert_unreachable()
#define BLI_STRUCT_EQUALITY_OPERATORS_5(Type, m1, m2, m3, m4, m5)
#define BLI_STRUCT_EQUALITY_OPERATORS_2(Type, m1, m2)
#define ENUM_OPERATORS(_type, _max)
#define BLT_I18NCONTEXT_DEFAULT
constexpr PointerRNA PointerRNA_NULL
constexpr bool is_empty() const
void append(const T &value)
BaseSocketDeclarationBuilder & dependent_field()
BaseSocketDeclarationBuilder & align_with_previous(bool value=true)
BaseSocketDeclarationBuilder & implicit_field_on_all(ImplicitInputValueFn fn)
BaseSocketDeclarationBuilder & make_available(std::function< void(bNode &)> fn)
NodeDeclarationBuilder * node_decl_builder_
BaseSocketDeclarationBuilder & field_source()
BaseSocketDeclarationBuilder & implicit_field_on(ImplicitInputValueFn fn, Span< int > input_indices)
BaseSocketDeclarationBuilder & propagate_all()
BaseSocketDeclarationBuilder & available(bool value=true)
BaseSocketDeclarationBuilder & field_on_all()
BaseSocketDeclarationBuilder & is_attribute_name(bool value=true)
BaseSocketDeclarationBuilder & reference_pass(Span< int > input_indices)
BaseSocketDeclarationBuilder & compositor_realization_options(CompositorInputRealizationOptions value)
BaseSocketDeclarationBuilder & description(std::string value="")
BaseSocketDeclarationBuilder & socket_name_ptr(PointerRNA ptr, StringRef property_name)
BaseSocketDeclarationBuilder & compositor_expects_single_value(bool value=true)
BaseSocketDeclarationBuilder & short_label(std::string value="")
BaseSocketDeclarationBuilder & supports_field()
BaseSocketDeclarationBuilder & hide_label(bool value=true)
BaseSocketDeclarationBuilder & translation_context(std::string value=BLT_I18NCONTEXT_DEFAULT)
BaseSocketDeclarationBuilder & implicit_field(ImplicitInputValueFn fn)
BaseSocketDeclarationBuilder & multi_input(bool value=true)
BaseSocketDeclarationBuilder & is_default_link_socket(bool value=true)
BaseSocketDeclarationBuilder & compositor_domain_priority(int priority)
BaseSocketDeclarationBuilder & field_source_reference_all()
virtual ~BaseSocketDeclarationBuilder()=default
BaseSocketDeclarationBuilder & field_on(Span< int > indices)
BaseSocketDeclarationBuilder & hide_value(bool value=true)
SocketDeclaration * decl_base_
BaseSocketDeclarationBuilder & no_muted_links(bool value=true)
BaseSocketDeclarationBuilder & reference_pass_all()
virtual ~ItemDeclaration()=default
const bNodeTree * tree_or_null() const
void allow_any_socket_order(bool enable=true)
aal::RelationsInNode & get_anonymous_attribute_relations()
const bNode * node_or_null() const
NodeDeclaration & declaration()
void use_custom_socket_order(bool enable=true)
NodeDeclarationBuilder(NodeDeclaration &declaration, const bNodeTree *ntree=nullptr, const bNode *node=nullptr)
DeclType::Builder & add_input(StringRef name, StringRef identifier="")
PanelDeclarationBuilder & add_panel(StringRef name, int identifier=-1)
DeclType::Builder & add_output(StringRef name, StringRef identifier="")
std::unique_ptr< aal::RelationsInNode > anonymous_attribute_relations_
bool skip_updating_sockets
bool allow_any_socket_order
Vector< ItemDeclarationPtr > items
Vector< SocketDeclaration * > inputs
bool matches(const bNode &node) const
const aal::RelationsInNode * anonymous_attribute_relations() const
friend NodeDeclarationBuilder
bool is_context_dependent
Vector< SocketDeclaration * > outputs
bool use_custom_socket_order
Span< SocketDeclaration * > sockets(eNodeSocketInOut in_out) const
Self & default_closed(bool closed)
Self & description(std::string value="")
DeclType::Builder & add_input(StringRef name, StringRef identifier="")
Self & draw_buttons(PanelDrawButtonsFunction func)
DeclType::Builder & add_output(StringRef name, StringRef identifier="")
NodeDeclarationBuilder * node_decl_builder_
virtual ~PanelDeclaration()=default
std::string translation_context
void update_or_build(const bNodePanelState &old_panel, bNodePanelState &new_panel) const
bool matches(const bNodePanelState &panel) const
PanelDrawButtonsFunction draw_buttons
void build(bNodePanelState &panel) const
typename SocketDecl::Builder Self
virtual bool matches(const bNodeSocket &socket) const =0
std::unique_ptr< SocketNameRNA > socket_name_rna
bool align_with_previous_socket
bool matches_common_data(const bNodeSocket &socket) const
int compositor_domain_priority() const
eNodeSocketDatatype socket_type
OutputFieldDependency output_field_dependency
std::unique_ptr< ImplicitInputValueFn > implicit_input_fn
void make_available(bNode &node) const
friend NodeDeclarationBuilder
const CompositorInputRealizationOptions & compositor_realization_options() const
virtual ~SocketDeclaration()=default
bool is_default_link_socket
virtual bool can_connect(const bNodeSocket &socket) const =0
std::string translation_context
virtual bNodeSocket & update_or_build(bNodeTree &ntree, bNode &node, bNodeSocket &socket) const
bool compositor_expects_single_value() const
void set_common_flags(bNodeSocket &socket) const
virtual bNodeSocket & build(bNodeTree &ntree, bNode &node) const =0
InputSocketFieldType input_field_type
std::ostream & operator<<(std::ostream &stream, const RelationsInNode &relations)
void(*)(uiLayout *, bContext *, PointerRNA *) PanelDrawButtonsFunction
std::unique_ptr< SocketDeclaration > SocketDeclarationPtr
void build_node_declaration(const bke::bNodeType &typeinfo, NodeDeclaration &r_declaration, const bNodeTree *ntree, const bNode *node)
std::unique_ptr< ItemDeclaration > ItemDeclarationPtr
std::unique_ptr< SocketDeclaration > make_declaration_for_socket_type(const eNodeSocketDatatype socket_type)
CompositorInputRealizationOptions
@ RealizeOnOperationDomain
std::unique_ptr< PanelDeclaration > PanelDeclarationPtr
std::function< void(const bNode &node, void *r_value)> ImplicitInputValueFn
Vector< OutputFieldDependency > outputs
Vector< InputSocketFieldType > inputs
std::string property_name
Vector< AvailableRelation > available_relations
Vector< ReferenceRelation > reference_relations
Vector< int > available_on_none
Vector< EvalRelation > eval_relations
Vector< PropagateRelation > propagate_relations