252 int compositor_domain_priority_ = -1;
255 std::function<void(
bNode &)> make_available_fn_;
337 std::optional<std::string> value = std::nullopt);
446 const int menu_value);
492template<
typename SocketDecl>
495 using Self =
typename SocketDecl::Builder;
496 static_assert(std::is_base_of_v<SocketDeclaration, SocketDecl>);
511 std::function<DrawNodeLayoutFn>
draw;
535 friend NodeDeclarationBuilder;
567 template<
typename DeclType>
572 template<
typename DeclType>
574 template<
typename DeclType>
608 this->parent_panel_decl = &
decl;
661 MEM_CXX_CLASS_ALLOC_FUNCS(
"NodeDeclaration")
669 const bNode *node_ =
nullptr;
674 bool is_function_node_ =
false;
676 friend DeclarationListBuilder;
682 const bNode *node =
nullptr);
686 declaration_.is_context_dependent =
true;
692 declaration_.is_context_dependent =
true;
702 is_function_node_ =
true;
712 if (!declaration_.anonymous_attribute_relations_) {
713 declaration_.anonymous_attribute_relations_ = std::make_unique<aal::RelationsInNode>();
715 return *declaration_.anonymous_attribute_relations_;
724 void build_remaining_anonymous_attribute_relations();
744template<
typename DeclType>
751template<
typename DeclType>
758template<
typename DeclType>
763 static_assert(std::is_base_of_v<SocketDeclaration, DeclType>);
764 using SocketBuilder =
typename DeclType::Builder;
768 std::unique_ptr<SocketBuilder> socket_decl_builder_ptr = std::make_unique<SocketBuilder>();
769 SocketBuilder &socket_decl_builder = *socket_decl_builder_ptr;
770 this->node_decl_builder.socket_builders_.append(std::move(socket_decl_builder_ptr));
772 std::unique_ptr<DeclType> socket_decl_ptr = std::make_unique<DeclType>();
773 DeclType &socket_decl = *socket_decl_ptr;
774 this->node_decl_builder.declaration_.
all_items.
append(std::move(socket_decl_ptr));
775 this->items.
append(&socket_decl);
777 socket_decl.parent = this->parent_panel_decl;
778 socket_decl_builder.node_decl_builder_ = &this->node_decl_builder;
780 socket_decl_builder.decl_ = &socket_decl;
781 socket_decl_builder.decl_base_ = &socket_decl;
782 socket_decl.name =
name;
783 socket_decl.identifier = identifier.
is_empty() ?
name : identifier;
784 socket_decl.in_out = in_out;
785 socket_decl.socket_type = DeclType::static_socket_type;
787 if (this->node_decl_builder.is_function_node_) {
789 socket_decl_builder.supports_field();
792 socket_decl_builder.dependent_field();
797 this->node_decl_builder.input_socket_builders_.append(&socket_decl_builder);
798 socket_decl.index = this->node_decl_builder.declaration_.
inputs.append_and_get_index(
802 this->node_decl_builder.output_socket_builders_.append(&socket_decl_builder);
803 socket_decl.index = this->node_decl_builder.declaration_.
outputs.append_and_get_index(
806 return socket_decl_builder;
#define BLI_STRUCT_EQUALITY_OPERATORS_5(Type, m1, m2, m3, m4, m5)
#define BLI_STRUCT_EQUALITY_OPERATORS_2(Type, m1, m2)
BMesh const char void * data
void append(const T &value)
constexpr bool is_empty() const
void append(const T &value)
BaseSocketDeclarationBuilder & is_layer_name(bool value=true)
BaseSocketDeclarationBuilder & dependent_field()
BaseSocketDeclarationBuilder & align_with_previous(bool value=true)
BaseSocketDeclarationBuilder & make_available(std::function< void(bNode &)> fn)
NodeDeclarationBuilder * node_decl_builder_
BaseSocketDeclarationBuilder & field_source()
BaseSocketDeclarationBuilder & optional_label(bool value=true)
BaseSocketDeclarationBuilder & usage_by_menu(const StringRef menu_input_identifier, const int menu_value)
BaseSocketDeclarationBuilder & usage_by_single_menu(const int menu_value)
BaseSocketDeclarationBuilder & compositor_realization_mode(CompositorInputRealizationMode value)
friend class DeclarationListBuilder
BaseSocketDeclarationBuilder & propagate_all()
BaseSocketDeclarationBuilder & available(bool value=true)
BaseSocketDeclarationBuilder & implicit_field(NodeDefaultInputType default_input)
BaseSocketDeclarationBuilder & usage_inference(InputSocketUsageInferenceFn fn)
BaseSocketDeclarationBuilder & field_on_all()
BaseSocketDeclarationBuilder & is_attribute_name(bool value=true)
BaseSocketDeclarationBuilder & reference_pass(Span< int > input_indices)
BaseSocketDeclarationBuilder & compact(bool value=true)
BaseSocketDeclarationBuilder & structure_type(StructureType structure_type)
BaseSocketDeclarationBuilder & description(std::string value="")
BaseSocketDeclarationBuilder & socket_name_ptr(PointerRNA ptr, StringRef property_name)
BaseSocketDeclarationBuilder & short_label(std::string value="")
BaseSocketDeclarationBuilder & supports_field()
BaseSocketDeclarationBuilder & implicit_field_on_all(NodeDefaultInputType default_input)
BaseSocketDeclarationBuilder & translation_context(std::optional< std::string > value=std::nullopt)
BaseSocketDeclarationBuilder & multi_input(bool value=true)
BaseSocketDeclarationBuilder & custom_draw(CustomSocketDrawFn fn)
BaseSocketDeclarationBuilder & panel_toggle(bool value=true)
BaseSocketDeclarationBuilder & is_default_link_socket(bool value=true)
BaseSocketDeclarationBuilder & compositor_domain_priority(int priority)
friend class NodeDeclarationBuilder
BaseSocketDeclarationBuilder & is_volume_grid_name(bool value=true)
BaseSocketDeclarationBuilder & field_source_reference_all()
virtual ~BaseSocketDeclarationBuilder()=default
BaseSocketDeclarationBuilder & field_on(Span< int > indices)
BaseSocketDeclarationBuilder & hide_value(bool value=true)
BaseSocketDeclarationBuilder & propagate_all_instance_attributes()
SocketDeclaration * decl_base_
BaseSocketDeclarationBuilder & implicit_field_on(NodeDefaultInputType default_input, Span< int > input_indices)
BaseSocketDeclarationBuilder & no_muted_links(bool value=true)
BaseSocketDeclarationBuilder & reference_pass_all()
BaseSocketDeclarationBuilder & default_input_type(NodeDefaultInputType value)
DeclType::Builder & add_output(StringRef name, StringRef identifier="")
DeclType::Builder & add_socket(StringRef name, StringRef identifier, eNodeSocketInOut in_out)
void add_default_layout()
void add_layout(std::function< void(uiLayout *, bContext *, PointerRNA *)> draw)
NodeDeclarationBuilder & node_decl_builder
PanelDeclaration * parent_panel_decl
Vector< ItemDeclaration * > & items
PanelDeclarationBuilder & add_panel(StringRef name, int identifier=-1)
DeclType::Builder & add_input(StringRef name, StringRef identifier="")
DeclarationListBuilder(NodeDeclarationBuilder &node_decl_builder, Vector< ItemDeclaration * > &items)
const PanelDeclaration * parent
virtual ~ItemDeclaration()=default
std::function< DrawNodeLayoutFn > draw
NodeDeclarationBuilder(const bke::bNodeType &typeinfo, NodeDeclaration &declaration, const bNodeTree *ntree=nullptr, const bNode *node=nullptr)
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)
std::unique_ptr< aal::RelationsInNode > anonymous_attribute_relations_
Vector< ItemDeclaration * > root_items
bool skip_updating_sockets
bool allow_any_socket_order
Vector< SocketDeclaration * > inputs
void assert_valid() const
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
Vector< PanelDeclaration * > panels
Vector< ItemDeclarationPtr > all_items
Span< SocketDeclaration * > sockets(eNodeSocketInOut in_out) const
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 & default_closed(bool closed)
Self & description(std::string value="")
Self & translation_context(std::optional< std::string > value=std::nullopt)
PanelDeclarationBuilder(NodeDeclarationBuilder &node_builder, PanelDeclaration &decl)
friend class NodeDeclarationBuilder
PanelDeclarationBuilder Self
std::optional< std::string > translation_context
friend class PanelDeclarationBuilder
Vector< ItemDeclaration * > items
~PanelDeclaration() override=default
void update_or_build(const bNodePanelState &old_panel, bNodePanelState &new_panel) const
bool matches(const bNodePanelState &panel) const
PanelDeclaration * parent_panel
const SocketDeclaration * panel_input_decl() const
void build(bNodePanelState &panel) const
friend class DeclarationListBuilder
friend class NodeDeclarationBuilder
typename SocketDecl::Builder Self
virtual bool matches(const bNodeSocket &socket) const =0
std::unique_ptr< SocketNameRNA > socket_name_rna
std::unique_ptr< CustomSocketDrawFn > custom_draw_fn
friend class BaseSocketDeclarationBuilder
bool align_with_previous_socket
bool matches_common_data(const bNodeSocket &socket) const
int compositor_domain_priority() const
StructureType structure_type
eNodeSocketDatatype socket_type
OutputFieldDependency output_field_dependency
std::unique_ptr< InputSocketUsageInferenceFn > usage_inference_fn
const CompositorInputRealizationMode & compositor_realization_mode() const
void make_available(bNode &node) const
NodeDefaultInputType default_input_type
friend NodeDeclarationBuilder
~SocketDeclaration() override=default
bool is_default_link_socket
virtual bool can_connect(const bNodeSocket &socket) const =0
std::optional< std::string > translation_context
friend class SocketDeclarationBuilder
virtual bNodeSocket & update_or_build(bNodeTree &ntree, bNode &node, bNodeSocket &socket) 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)
CompositorInputRealizationMode
std::function< std::optional< bool >( const socket_usage_inference::InputSocketUsageParams ¶ms)> InputSocketUsageInferenceFn
std::unique_ptr< SocketDeclaration > SocketDeclarationPtr
std::optional< ImplicitInputValueFn > get_implicit_input_value_fn(const NodeDefaultInputType type)
void(uiLayout *, bContext *, PointerRNA *) DrawNodeLayoutFn
void build_node_declaration(const bke::bNodeType &typeinfo, NodeDeclaration &r_declaration, const bNodeTree *ntree, const bNode *node)
std::unique_ptr< ItemDeclaration > ItemDeclarationPtr
bool socket_type_supports_default_input_type(const bke::bNodeSocketType &socket_type, const NodeDefaultInputType input_type)
std::function< void(CustomSocketDrawParams ¶ms)> CustomSocketDrawFn
std::unique_ptr< SocketDeclaration > make_declaration_for_socket_type(const eNodeSocketDatatype socket_type)
std::unique_ptr< PanelDeclaration > PanelDeclarationPtr
std::function< void(const bNode &node, void *r_value)> ImplicitInputValueFn
const PointerRNA PointerRNA_NULL
void draw_standard(uiLayout &layout, std::optional< StringRefNull > label_override=std::nullopt)
const Map< const bNode *, const bNode * > * menu_switch_source_by_index_switch
Array< InputSocketFieldType > inputs
Array< OutputFieldDependency > outputs
std::string property_name
Array< int > linked_inputs
Array< StructureType > inputs
Array< OutputDependency > outputs
Vector< AvailableRelation > available_relations
Vector< ReferenceRelation > reference_relations
Vector< int > available_on_none
Vector< EvalRelation > eval_relations
Vector< PropagateRelation > propagate_relations