Blender V5.0
blender::nodes::BaseSocketDeclarationBuilder Class Reference

#include <NOD_node_declaration.hh>

Inherited by blender::nodes::SocketDeclarationBuilder< Bool >, blender::nodes::SocketDeclarationBuilder< Bundle >, blender::nodes::SocketDeclarationBuilder< Closure >, blender::nodes::SocketDeclarationBuilder< Color >, blender::nodes::SocketDeclarationBuilder< Custom >, blender::nodes::SocketDeclarationBuilder< Extend >, blender::nodes::SocketDeclarationBuilder< Float >, blender::nodes::SocketDeclarationBuilder< Geometry >, blender::nodes::SocketDeclarationBuilder< T >, blender::nodes::SocketDeclarationBuilder< Int >, blender::nodes::SocketDeclarationBuilder< Matrix >, blender::nodes::SocketDeclarationBuilder< Menu >, blender::nodes::SocketDeclarationBuilder< Rotation >, blender::nodes::SocketDeclarationBuilder< Shader >, blender::nodes::SocketDeclarationBuilder< String >, blender::nodes::SocketDeclarationBuilder< Vector >, and blender::nodes::SocketDeclarationBuilder< SocketDecl >.

Public Member Functions

virtual ~BaseSocketDeclarationBuilder ()=default
BaseSocketDeclarationBuilderoptional_label (bool value=true)
BaseSocketDeclarationBuilderhide_value (bool value=true)
BaseSocketDeclarationBuildermulti_input (bool value=true)
BaseSocketDeclarationBuildercompact (bool value=true)
BaseSocketDeclarationBuildershort_label (std::string value="")
BaseSocketDeclarationBuilderdescription (std::string value="")
BaseSocketDeclarationBuildertranslation_context (std::optional< std::string > value=std::nullopt)
BaseSocketDeclarationBuilderno_muted_links (bool value=true)
BaseSocketDeclarationBuilderavailable (bool value=true)
BaseSocketDeclarationBuilderis_attribute_name (bool value=true)
BaseSocketDeclarationBuilderis_default_link_socket (bool value=true)
BaseSocketDeclarationBuilderdefault_input_type (NodeDefaultInputType value)
BaseSocketDeclarationBuildersupports_field ()
BaseSocketDeclarationBuilderfield_on_all ()
BaseSocketDeclarationBuilderfield_source ()
BaseSocketDeclarationBuilderimplicit_field (NodeDefaultInputType default_input)
BaseSocketDeclarationBuilderimplicit_field_on_all (NodeDefaultInputType default_input)
BaseSocketDeclarationBuilderimplicit_field_on (NodeDefaultInputType default_input, Span< int > input_indices)
BaseSocketDeclarationBuilderfield_on (Span< int > indices)
BaseSocketDeclarationBuilderdependent_field ()
BaseSocketDeclarationBuilderdependent_field (Vector< int > input_dependencies)
BaseSocketDeclarationBuilderfield_source_reference_all ()
BaseSocketDeclarationBuilderreference_pass (Span< int > input_indices)
BaseSocketDeclarationBuilderreference_pass_all ()
BaseSocketDeclarationBuilderpropagate_all ()
BaseSocketDeclarationBuilderpropagate_all_instance_attributes ()
BaseSocketDeclarationBuildercompositor_realization_mode (CompositorInputRealizationMode value)
BaseSocketDeclarationBuildercompositor_domain_priority (int priority)
BaseSocketDeclarationBuildermake_available (std::function< void(bNode &)> fn)
BaseSocketDeclarationBuildercustom_draw (CustomSocketDrawFn fn)
BaseSocketDeclarationBuilderusage_inference (InputSocketUsageInferenceFn fn)
BaseSocketDeclarationBuilderusage_by_single_menu (const int menu_value)
BaseSocketDeclarationBuilderusage_by_menu (const StringRef menu_input_identifier, const int menu_value)
BaseSocketDeclarationBuilderusage_by_menu (const StringRef menu_input_identifier, const Array< int > menu_values)
BaseSocketDeclarationBuilderalign_with_previous (bool value=true)
BaseSocketDeclarationBuildersocket_name_ptr (PointerRNA ptr, StringRef property_name)
BaseSocketDeclarationBuildersocket_name_ptr (const ID *id, const StructRNA *srna, const void *data, StringRef property_name)
BaseSocketDeclarationBuilderpanel_toggle (bool value=true)
BaseSocketDeclarationBuilderstructure_type (StructureType structure_type)
BaseSocketDeclarationBuilderis_layer_name (bool value=true)
BaseSocketDeclarationBuilderis_volume_grid_name (bool value=true)
#BaseSocketDeclarationBuilder Inline Methods
int index () const
bool is_input () const
bool is_output () const

Protected Attributes

bool reference_pass_all_ = false
bool field_on_all_ = false
bool propagate_from_all_ = false
NodeDeclarationBuildernode_decl_builder_ = nullptr
SocketDeclarationdecl_base_ = nullptr

Friends

class NodeDeclarationBuilder
class DeclarationListBuilder

Detailed Description

Definition at line 310 of file NOD_node_declaration.hh.

Constructor & Destructor Documentation

◆ ~BaseSocketDeclarationBuilder()

virtual blender::nodes::BaseSocketDeclarationBuilder::~BaseSocketDeclarationBuilder ( )
virtualdefault

References data, indices, ptr, and structure_type().

Member Function Documentation

◆ align_with_previous()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::align_with_previous ( bool value = true)

Puts this socket on the same row as the previous socket. This only works when one of them is an input and the other is an output.

Definition at line 896 of file node_declaration.cc.

References decl_base_.

◆ available()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::available ( bool value = true)

Can be used to make a socket unavailable. It's still stored in DNA, but it's not shown in the UI and also can't be unhidden.

Definition at line 632 of file node_declaration.cc.

References decl_base_.

◆ compact()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::compact ( bool value = true)

Definition at line 562 of file node_declaration.cc.

References decl_base_.

◆ compositor_domain_priority()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::compositor_domain_priority ( int priority)

The priority of the input for determining the domain of the node. Needs to be positive. See compositor::InputDescriptor for more information.

Definition at line 750 of file node_declaration.cc.

References BLI_assert, and decl_base_.

◆ compositor_realization_mode()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::compositor_realization_mode ( CompositorInputRealizationMode value)

◆ custom_draw()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::custom_draw ( CustomSocketDrawFn fn)

Provide a fully custom draw function for the socket that overrides any default behavior.

Definition at line 765 of file node_declaration.cc.

References decl_base_.

◆ default_input_type()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::default_input_type ( NodeDefaultInputType value)

Definition at line 650 of file node_declaration.cc.

References decl_base_.

Referenced by implicit_field(), implicit_field_on(), and implicit_field_on_all().

◆ dependent_field() [1/2]

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::dependent_field ( )

The output is a field if any of the inputs are a field.

Definition at line 707 of file node_declaration.cc.

References BLI_assert, decl_base_, blender::nodes::OutputFieldDependency::ForDependentField(), is_output(), reference_pass_all(), and structure_type().

◆ dependent_field() [2/2]

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::dependent_field ( Vector< int > input_dependencies)

The output is a field if any of the inputs with indices in the given list is a field.

Definition at line 532 of file node_declaration.cc.

References BLI_assert, decl_base_, blender::nodes::OutputFieldDependency::ForPartiallyDependentField(), is_output(), reference_pass(), and structure_type().

◆ description()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::description ( std::string value = "")

◆ field_on()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::field_on ( Span< int > indices)

For inputs that are evaluated or available on a subset of the geometry sockets.

Definition at line 582 of file node_declaration.cc.

References decl_base_, field_source(), indices, is_input(), node_decl_builder_, structure_type(), and supports_field().

Referenced by implicit_field_on().

◆ field_on_all()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::field_on_all ( )

For inputs this means that the input field is evaluated on all geometry inputs. For outputs it means that this contains an anonymous attribute reference that is available on all geometry outputs. This sockets value does not have to be output manually in the node. It's done automatically by LazyFunctionForGeometryNode. This allows outputting this field even if the geometry output does not have to be computed.

Definition at line 657 of file node_declaration.cc.

References field_on_all_, field_source(), is_input(), is_output(), structure_type(), and supports_field().

◆ field_source()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::field_source ( )

The output is always a field, regardless of any inputs.

Definition at line 670 of file node_declaration.cc.

References BLI_assert, decl_base_, blender::nodes::OutputFieldDependency::ForFieldSource(), is_output(), and structure_type().

Referenced by field_on(), field_on_all(), and field_source_reference_all().

◆ field_source_reference_all()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::field_source_reference_all ( )

For outputs that combine all input fields into a new field. The output is a field even if none of the inputs is a field.

Definition at line 716 of file node_declaration.cc.

References field_source(), and reference_pass_all().

◆ hide_value()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::hide_value ( bool value = true)

Definition at line 549 of file node_declaration.cc.

References decl_base_.

Referenced by implicit_field().

◆ implicit_field()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::implicit_field ( NodeDefaultInputType default_input)

The input supports a field and is a field by default when nothing is connected.

Definition at line 678 of file node_declaration.cc.

References BLI_assert, decl_base_, default_input_type(), hide_value(), blender::nodes::Implicit, is_input(), and structure_type().

Referenced by implicit_field_on(), and implicit_field_on_all().

◆ implicit_field_on()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::implicit_field_on ( NodeDefaultInputType default_input,
Span< int > input_indices )

The input is evaluated on a subset of the geometry inputs.

Definition at line 698 of file node_declaration.cc.

References default_input_type(), field_on(), implicit_field(), and structure_type().

◆ implicit_field_on_all()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::implicit_field_on_all ( NodeDefaultInputType default_input)

The input is an implicit field that is evaluated on all geometry inputs.

Definition at line 689 of file node_declaration.cc.

References default_input_type(), field_on_all_, implicit_field(), and structure_type().

◆ index()

int blender::nodes::BaseSocketDeclarationBuilder::index ( ) const
inline

Index in the list of inputs or outputs.

Definition at line 815 of file NOD_node_declaration.hh.

References decl_base_.

Referenced by blender::nodes::decl::BundleBuilder::pass_through_input_index().

◆ is_attribute_name()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::is_attribute_name ( bool value = true)

Definition at line 638 of file node_declaration.cc.

References decl_base_.

◆ is_default_link_socket()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::is_default_link_socket ( bool value = true)

Definition at line 644 of file node_declaration.cc.

References decl_base_.

◆ is_input()

bool blender::nodes::BaseSocketDeclarationBuilder::is_input ( ) const
inline

Definition at line 820 of file NOD_node_declaration.hh.

References decl_base_, and SOCK_IN.

Referenced by field_on(), field_on_all(), implicit_field(), multi_input(), and supports_field().

◆ is_layer_name()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::is_layer_name ( bool value = true)

Definition at line 937 of file node_declaration.cc.

References decl_base_.

◆ is_output()

bool blender::nodes::BaseSocketDeclarationBuilder::is_output ( ) const
inline

◆ is_volume_grid_name()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::is_volume_grid_name ( bool value = true)

Definition at line 943 of file node_declaration.cc.

References decl_base_.

◆ make_available()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::make_available ( std::function< void(bNode &)> fn)

Pass a function that sets properties on the node required to make the corresponding socket available, if it is not available on the default state of the node. The function is allowed to make other sockets unavailable, since it is meant to be called when the node is first added. The node type's update function is called afterwards.

Definition at line 758 of file node_declaration.cc.

References decl_base_.

Referenced by usage_by_menu(), and usage_by_single_menu().

◆ multi_input()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::multi_input ( bool value = true)

Definition at line 555 of file node_declaration.cc.

References BLI_assert, decl_base_, and is_input().

◆ no_muted_links()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::no_muted_links ( bool value = true)

Definition at line 626 of file node_declaration.cc.

References decl_base_.

◆ optional_label()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::optional_label ( bool value = true)

Definition at line 543 of file node_declaration.cc.

References decl_base_.

◆ panel_toggle()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::panel_toggle ( bool value = true)

Use the socket as a toggle in its panel.

Definition at line 931 of file node_declaration.cc.

References decl_base_.

◆ propagate_all()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::propagate_all ( )

Attributes from the all geometry inputs can be propagated.

Definition at line 729 of file node_declaration.cc.

References propagate_from_all_.

Referenced by propagate_all_instance_attributes().

◆ propagate_all_instance_attributes()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::propagate_all_instance_attributes ( )

Instance attributes from all geometry inputs can be propagated.

Definition at line 735 of file node_declaration.cc.

References propagate_all().

◆ reference_pass()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::reference_pass ( Span< int > input_indices)

For outputs that combine a subset of input fields into a new field.

Definition at line 568 of file node_declaration.cc.

References BLI_assert, decl_base_, is_output(), and node_decl_builder_.

Referenced by dependent_field().

◆ reference_pass_all()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::reference_pass_all ( )

For outputs that combine all input fields into a new field.

Definition at line 723 of file node_declaration.cc.

References reference_pass_all_.

Referenced by dependent_field(), and field_source_reference_all().

◆ short_label()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::short_label ( std::string value = "")

Definition at line 607 of file node_declaration.cc.

References decl_base_.

◆ socket_name_ptr() [1/2]

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::socket_name_ptr ( const ID * id,
const StructRNA * srna,
const void * data,
StringRef property_name )

Definition at line 920 of file node_declaration.cc.

References data, RNA_pointer_create_discrete(), and socket_name_ptr().

◆ socket_name_ptr() [2/2]

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::socket_name_ptr ( PointerRNA ptr,
StringRef property_name )

Set a function that retrieves an RNA pointer to the name of the socket. This can be used to be able to rename the socket within the node.

Definition at line 911 of file node_declaration.cc.

References decl_base_, and ptr.

Referenced by blender::nodes::node_composite_file_output_cc::node_declare(), and socket_name_ptr().

◆ structure_type()

◆ supports_field()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::supports_field ( )

The input socket allows passing in a field.

Definition at line 524 of file node_declaration.cc.

References BLI_assert, decl_base_, is_input(), blender::nodes::IsSupported, and structure_type().

Referenced by field_on(), field_on_all(), and blender::nodes::node_geo_accumulate_field_cc::node_declare().

◆ translation_context()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::translation_context ( std::optional< std::string > value = std::nullopt)

Definition at line 619 of file node_declaration.cc.

References decl_base_.

◆ usage_by_menu() [1/2]

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::usage_by_menu ( const StringRef menu_input_identifier,
const Array< int > menu_values )

Utility method for the case when this socket is only used when the menu input of the given identifier has one of the specifies values.

Definition at line 840 of file node_declaration.cc.

References make_available(), blender::nodes::SocketDeclaration::make_available(), blender::bke::node_find_socket(), params, bNodeSocket::runtime, SOCK_IN, usage_inference(), blender::nodes::SocketDeclaration::usage_inference_fn, and bNodeSocketValueMenu::value.

◆ usage_by_menu() [2/2]

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::usage_by_menu ( const StringRef menu_input_identifier,
const int menu_value )

Utility method for the case when this socket is only used when the menu input of the given identifier has a specific value.

Definition at line 832 of file node_declaration.cc.

References usage_by_menu().

Referenced by usage_by_menu().

◆ usage_by_single_menu()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::usage_by_single_menu ( const int menu_value)

Utility method for the case when the node has a single menu input and this socket is only used when the menu input has a specific value.

Definition at line 805 of file node_declaration.cc.

References blender::nodes::find_single_menu_input(), bNodeSocket::identifier, make_available(), params, usage_inference(), and bNodeSocketValueMenu::value.

◆ usage_inference()

BaseSocketDeclarationBuilder & blender::nodes::BaseSocketDeclarationBuilder::usage_inference ( InputSocketUsageInferenceFn fn)

Provide a function that determines whether this input socket is used based on other input values and based on which outputs are used.

Definition at line 771 of file node_declaration.cc.

References decl_base_.

Referenced by usage_by_menu(), and usage_by_single_menu().

◆ DeclarationListBuilder

friend class DeclarationListBuilder
friend

Definition at line 319 of file NOD_node_declaration.hh.

References DeclarationListBuilder.

Referenced by DeclarationListBuilder.

◆ NodeDeclarationBuilder

friend class NodeDeclarationBuilder
friend

Definition at line 318 of file NOD_node_declaration.hh.

References NodeDeclarationBuilder.

Referenced by NodeDeclarationBuilder.

Member Data Documentation

◆ decl_base_

◆ field_on_all_

bool blender::nodes::BaseSocketDeclarationBuilder::field_on_all_ = false
protected

Definition at line 313 of file NOD_node_declaration.hh.

Referenced by field_on_all(), and implicit_field_on_all().

◆ node_decl_builder_

NodeDeclarationBuilder* blender::nodes::BaseSocketDeclarationBuilder::node_decl_builder_ = nullptr
protected

Definition at line 315 of file NOD_node_declaration.hh.

Referenced by field_on(), and reference_pass().

◆ propagate_from_all_

bool blender::nodes::BaseSocketDeclarationBuilder::propagate_from_all_ = false
protected

Definition at line 314 of file NOD_node_declaration.hh.

Referenced by propagate_all().

◆ reference_pass_all_

bool blender::nodes::BaseSocketDeclarationBuilder::reference_pass_all_ = false
protected

Definition at line 312 of file NOD_node_declaration.hh.

Referenced by reference_pass_all().


The documentation for this class was generated from the following files: