Blender V5.0
blender::fn::lazy_function::LazyFunction Class Referenceabstract

#include <FN_lazy_function.hh>

Inherited by blender::fn::lazy_function::GraphExecutor, blender::fn::lazy_function::tests::AddLazyFunction, blender::fn::lazy_function::tests::PartialEvaluationTestFunction, blender::fn::lazy_function::tests::StoreValueFunction, blender::nodes::LazyFunctionForBakeInputsUsage, blender::nodes::LazyFunctionForClosureZone, blender::nodes::LazyFunctionForEnableOutputSocketUsage, blender::nodes::LazyFunctionForEvaluateClosureNode, blender::nodes::LazyFunctionForExtractingReferenceSet, blender::nodes::LazyFunctionForForeachGeometryElementZone, blender::nodes::LazyFunctionForGeometryNode, blender::nodes::LazyFunctionForGizmoInputsUsage, blender::nodes::LazyFunctionForGizmoNode, blender::nodes::LazyFunctionForGroupNode, blender::nodes::LazyFunctionForImplicitConversion, blender::nodes::LazyFunctionForImplicitInput, blender::nodes::LazyFunctionForIndexSwitchSocketUsage, blender::nodes::LazyFunctionForJoinReferenceSets, blender::nodes::LazyFunctionForLogicalOr, blender::nodes::LazyFunctionForMultiFunctionNode, blender::nodes::LazyFunctionForMultiInput, blender::nodes::LazyFunctionForMutedNode, blender::nodes::LazyFunctionForReduceForeachGeometryElement, blender::nodes::LazyFunctionForRepeatZone, blender::nodes::LazyFunctionForRerouteNode, blender::nodes::LazyFunctionForSimulationInputsUsage, blender::nodes::LazyFunctionForSimulationZone, blender::nodes::LazyFunctionForSwitchSocketUsage, blender::nodes::LazyFunctionForUndefinedNode, blender::nodes::LazyFunctionForViewerInputUsage, blender::nodes::LazyFunctionForViewerNode, blender::nodes::node_geo_bake_cc::LazyFunctionForBakeNode, blender::nodes::node_geo_enable_output_cc::LazyFunctionForEnableOutputNode, blender::nodes::node_geo_index_switch_cc::LazyFunctionForIndexSwitchNode, blender::nodes::node_geo_menu_switch_cc::LazyFunctionForMenuSwitchNode, blender::nodes::node_geo_menu_switch_cc::LazyFunctionForMenuSwitchSocketUsage, blender::nodes::node_geo_simulation_cc::sim_input_node::LazyFunctionForSimulationInputNode, blender::nodes::node_geo_simulation_cc::sim_output_node::LazyFunctionForSimulationOutputNode, blender::nodes::node_geo_switch_cc::LazyFunctionForSwitchNode, and blender::nodes::node_geo_warning_cc::LazyFunctionForWarningNode.

Public Member Functions

virtual ~LazyFunction ()=default
virtual std::string name () const
virtual std::string input_name (int index) const
virtual std::string output_name (int index) const
virtual void * init_storage (LinearAllocator<> &allocator) const
virtual void destruct_storage (void *storage) const
virtual void possible_output_dependencies (int output_index, FunctionRef< void(Span< int >)> fn) const
bool always_used_inputs_available (const Params &params) const
bool allow_missing_requested_inputs () const
#LazyFunction Inline Methods
Span< Inputinputs () const
Span< Outputoutputs () const
void execute (Params &params, const Context &context) const

Protected Attributes

const char * debug_name_ = "unknown"
Vector< Inputinputs_
Vector< Outputoutputs_
bool allow_missing_requested_inputs_ = false

Detailed Description

A function that can compute outputs and request inputs lazily. For more details see the comment at the top of the file.

Definition at line 244 of file FN_lazy_function.hh.

Constructor & Destructor Documentation

◆ ~LazyFunction()

virtual blender::fn::lazy_function::LazyFunction::~LazyFunction ( )
virtualdefault

References params.

Member Function Documentation

◆ allow_missing_requested_inputs()

bool blender::fn::lazy_function::LazyFunction::allow_missing_requested_inputs ( ) const
inline

If true, the function can be executed even when some requested inputs are not available yet. This allows the function to make some progress and maybe to compute some outputs that are passed into this function again (lazy-function graphs may contain cycles as long as there aren't actually data dependencies).

Definition at line 311 of file FN_lazy_function.hh.

References allow_missing_requested_inputs_.

◆ always_used_inputs_available()

bool blender::fn::lazy_function::LazyFunction::always_used_inputs_available ( const Params & params) const

Utility to check that the guarantee by #Input::usage is followed.

Definition at line 50 of file lazy_function.cc.

References allow_missing_requested_inputs_, i, inputs_, params, blender::fn::lazy_function::Input::usage, and blender::fn::lazy_function::Used.

Referenced by execute().

◆ destruct_storage()

◆ execute()

void blender::fn::lazy_function::LazyFunction::execute ( Params & params,
const Context & context ) const
inline

During execution the function retrieves inputs and sets outputs in params. For some functions, this method is called more than once. After execution, the function either has computed all required outputs or is waiting for more inputs.

Definition at line 338 of file FN_lazy_function.hh.

References always_used_inputs_available(), BLI_assert, and params.

Referenced by blender::nodes::execute_geometry_nodes_on_geometry().

◆ init_storage()

void * blender::fn::lazy_function::LazyFunction::init_storage ( LinearAllocator<> & allocator) const
virtual

Allocates storage for this function. The storage will be passed to every call to execute. If the function does not keep track of any state, this does not have to be implemented.

Reimplemented in blender::fn::lazy_function::GraphExecutor, blender::nodes::LazyFunctionForEvaluateClosureNode, blender::nodes::LazyFunctionForForeachGeometryElementZone, blender::nodes::LazyFunctionForGroupNode, blender::nodes::LazyFunctionForRepeatZone, and blender::nodes::LazyFunctionForSimulationZone.

Definition at line 28 of file lazy_function.cc.

Referenced by blender::nodes::execute_geometry_nodes_on_geometry().

◆ input_name()

◆ inputs()

Span< Input > blender::fn::lazy_function::LazyFunction::inputs ( ) const
inline

◆ name()

std::string blender::fn::lazy_function::LazyFunction::name ( ) const
virtual

Get a name of the function or an input or output. This is mainly used for debugging. These are virtual functions because the names are often not used outside of debugging workflows. This way the names are only generated when they are actually needed.

Reimplemented in blender::nodes::LazyFunctionForGroupNode.

Definition at line 13 of file lazy_function.cc.

References debug_name_.

Referenced by blender::nodes::LazyFunctionForExtractingReferenceSet::execute_impl(), blender::nodes::LazyFunctionForJoinReferenceSets::execute_impl(), and blender::nodes::LazyFunctionForReduceForeachGeometryElement::handle_generation_items_group().

◆ output_name()

◆ outputs()

Span< Output > blender::fn::lazy_function::LazyFunction::outputs ( ) const
inline

◆ possible_output_dependencies()

void blender::fn::lazy_function::LazyFunction::possible_output_dependencies ( int output_index,
FunctionRef< void(Span< int >)> fn ) const
virtual

Calls fn with the input indices that the given output_index may depend on. By default every output depends on every input.

Reimplemented in blender::fn::lazy_function::tests::PartialEvaluationTestFunction.

Definition at line 39 of file lazy_function.cc.

References i, indices, and inputs_.

Member Data Documentation

◆ allow_missing_requested_inputs_

bool blender::fn::lazy_function::LazyFunction::allow_missing_requested_inputs_ = false
protected

◆ debug_name_

const char* blender::fn::lazy_function::LazyFunction::debug_name_ = "unknown"
protected

Definition at line 246 of file FN_lazy_function.hh.

Referenced by blender::fn::lazy_function::tests::AddLazyFunction::AddLazyFunction(), blender::fn::lazy_function::GraphExecutor::GraphExecutor(), blender::nodes::LazyFunctionForBakeInputsUsage::LazyFunctionForBakeInputsUsage(), blender::nodes::node_geo_bake_cc::LazyFunctionForBakeNode::LazyFunctionForBakeNode(), blender::nodes::LazyFunctionForClosureZone::LazyFunctionForClosureZone(), blender::nodes::LazyFunctionForEnableOutputSocketUsage::LazyFunctionForEnableOutputSocketUsage(), blender::nodes::LazyFunctionForEvaluateClosureNode::LazyFunctionForEvaluateClosureNode(), blender::nodes::LazyFunctionForExtractingReferenceSet::LazyFunctionForExtractingReferenceSet(), blender::nodes::LazyFunctionForForeachGeometryElementZone::LazyFunctionForForeachGeometryElementZone(), blender::nodes::LazyFunctionForGeometryNode::LazyFunctionForGeometryNode(), blender::nodes::LazyFunctionForGizmoInputsUsage::LazyFunctionForGizmoInputsUsage(), blender::nodes::LazyFunctionForGizmoNode::LazyFunctionForGizmoNode(), blender::nodes::LazyFunctionForGroupNode::LazyFunctionForGroupNode(), blender::nodes::LazyFunctionForImplicitConversion::LazyFunctionForImplicitConversion(), blender::nodes::LazyFunctionForImplicitInput::LazyFunctionForImplicitInput(), blender::nodes::node_geo_index_switch_cc::LazyFunctionForIndexSwitchNode::LazyFunctionForIndexSwitchNode(), blender::nodes::LazyFunctionForIndexSwitchSocketUsage::LazyFunctionForIndexSwitchSocketUsage(), blender::nodes::LazyFunctionForJoinReferenceSets::LazyFunctionForJoinReferenceSets(), blender::nodes::LazyFunctionForLogicalOr::LazyFunctionForLogicalOr(), blender::nodes::node_geo_menu_switch_cc::LazyFunctionForMenuSwitchNode::LazyFunctionForMenuSwitchNode(), blender::nodes::node_geo_menu_switch_cc::LazyFunctionForMenuSwitchSocketUsage::LazyFunctionForMenuSwitchSocketUsage(), blender::nodes::LazyFunctionForMultiFunctionNode::LazyFunctionForMultiFunctionNode(), blender::nodes::LazyFunctionForMultiInput::LazyFunctionForMultiInput(), blender::nodes::LazyFunctionForMutedNode::LazyFunctionForMutedNode(), blender::nodes::LazyFunctionForReduceForeachGeometryElement::LazyFunctionForReduceForeachGeometryElement(), blender::nodes::LazyFunctionForRepeatZone::LazyFunctionForRepeatZone(), blender::nodes::LazyFunctionForRerouteNode::LazyFunctionForRerouteNode(), blender::nodes::node_geo_simulation_cc::sim_input_node::LazyFunctionForSimulationInputNode::LazyFunctionForSimulationInputNode(), blender::nodes::LazyFunctionForSimulationInputsUsage::LazyFunctionForSimulationInputsUsage(), blender::nodes::node_geo_simulation_cc::sim_output_node::LazyFunctionForSimulationOutputNode::LazyFunctionForSimulationOutputNode(), blender::nodes::LazyFunctionForSimulationZone::LazyFunctionForSimulationZone(), blender::nodes::node_geo_switch_cc::LazyFunctionForSwitchNode::LazyFunctionForSwitchNode(), blender::nodes::LazyFunctionForSwitchSocketUsage::LazyFunctionForSwitchSocketUsage(), blender::nodes::LazyFunctionForUndefinedNode::LazyFunctionForUndefinedNode(), blender::nodes::LazyFunctionForViewerInputUsage::LazyFunctionForViewerInputUsage(), blender::nodes::LazyFunctionForViewerNode::LazyFunctionForViewerNode(), blender::nodes::node_geo_warning_cc::LazyFunctionForWarningNode::LazyFunctionForWarningNode(), name(), blender::fn::lazy_function::tests::PartialEvaluationTestFunction::PartialEvaluationTestFunction(), and blender::fn::lazy_function::tests::StoreValueFunction::StoreValueFunction().

◆ inputs_

Vector<Input> blender::fn::lazy_function::LazyFunction::inputs_
protected

Definition at line 247 of file FN_lazy_function.hh.

Referenced by blender::fn::lazy_function::tests::AddLazyFunction::AddLazyFunction(), always_used_inputs_available(), blender::nodes::LazyFunctionForGeometryNode::execute_impl(), blender::nodes::LazyFunctionForGizmoNode::execute_impl(), blender::nodes::LazyFunctionForLogicalOr::execute_impl(), blender::nodes::LazyFunctionForMultiFunctionNode::execute_impl(), blender::nodes::LazyFunctionForMultiInput::execute_impl(), blender::nodes::LazyFunctionForRerouteNode::execute_impl(), blender::nodes::LazyFunctionForEvaluateClosureNode::initialize_execution_graph(), blender::nodes::LazyFunctionForForeachGeometryElementZone::initialize_execution_graph(), blender::nodes::LazyFunctionForEvaluateClosureNode::initialize_pass_through_graph(), input_name(), blender::nodes::LazyFunctionForForeachGeometryElementZone::input_name(), blender::nodes::LazyFunctionForGeometryNode::input_name(), blender::nodes::LazyFunctionForRepeatZone::input_name(), inputs(), blender::nodes::node_geo_bake_cc::LazyFunctionForBakeNode::LazyFunctionForBakeNode(), blender::nodes::LazyFunctionForClosureZone::LazyFunctionForClosureZone(), blender::nodes::node_geo_enable_output_cc::LazyFunctionForEnableOutputNode::LazyFunctionForEnableOutputNode(), blender::nodes::LazyFunctionForEnableOutputSocketUsage::LazyFunctionForEnableOutputSocketUsage(), blender::nodes::LazyFunctionForEvaluateClosureNode::LazyFunctionForEvaluateClosureNode(), blender::nodes::LazyFunctionForExtractingReferenceSet::LazyFunctionForExtractingReferenceSet(), blender::nodes::LazyFunctionForForeachGeometryElementZone::LazyFunctionForForeachGeometryElementZone(), blender::nodes::LazyFunctionForGeometryNode::LazyFunctionForGeometryNode(), blender::nodes::LazyFunctionForGizmoNode::LazyFunctionForGizmoNode(), blender::nodes::LazyFunctionForGroupNode::LazyFunctionForGroupNode(), blender::nodes::LazyFunctionForImplicitConversion::LazyFunctionForImplicitConversion(), blender::nodes::node_geo_index_switch_cc::LazyFunctionForIndexSwitchNode::LazyFunctionForIndexSwitchNode(), blender::nodes::LazyFunctionForIndexSwitchSocketUsage::LazyFunctionForIndexSwitchSocketUsage(), blender::nodes::LazyFunctionForJoinReferenceSets::LazyFunctionForJoinReferenceSets(), blender::nodes::LazyFunctionForLogicalOr::LazyFunctionForLogicalOr(), blender::nodes::node_geo_menu_switch_cc::LazyFunctionForMenuSwitchNode::LazyFunctionForMenuSwitchNode(), blender::nodes::node_geo_menu_switch_cc::LazyFunctionForMenuSwitchSocketUsage::LazyFunctionForMenuSwitchSocketUsage(), blender::nodes::LazyFunctionForMultiFunctionNode::LazyFunctionForMultiFunctionNode(), blender::nodes::LazyFunctionForMultiInput::LazyFunctionForMultiInput(), blender::nodes::LazyFunctionForMutedNode::LazyFunctionForMutedNode(), blender::nodes::LazyFunctionForReduceForeachGeometryElement::LazyFunctionForReduceForeachGeometryElement(), blender::nodes::LazyFunctionForRepeatZone::LazyFunctionForRepeatZone(), blender::nodes::LazyFunctionForRerouteNode::LazyFunctionForRerouteNode(), blender::nodes::node_geo_simulation_cc::sim_input_node::LazyFunctionForSimulationInputNode::LazyFunctionForSimulationInputNode(), blender::nodes::node_geo_simulation_cc::sim_output_node::LazyFunctionForSimulationOutputNode::LazyFunctionForSimulationOutputNode(), blender::nodes::LazyFunctionForSimulationZone::LazyFunctionForSimulationZone(), blender::nodes::node_geo_switch_cc::LazyFunctionForSwitchNode::LazyFunctionForSwitchNode(), blender::nodes::LazyFunctionForSwitchSocketUsage::LazyFunctionForSwitchSocketUsage(), blender::nodes::LazyFunctionForViewerNode::LazyFunctionForViewerNode(), blender::nodes::node_geo_warning_cc::LazyFunctionForWarningNode::LazyFunctionForWarningNode(), blender::fn::lazy_function::tests::PartialEvaluationTestFunction::PartialEvaluationTestFunction(), blender::nodes::node_geo_simulation_cc::sim_input_node::LazyFunctionForSimulationInputNode::pass_through(), possible_output_dependencies(), blender::fn::lazy_function::tests::StoreValueFunction::StoreValueFunction(), and blender::nodes::node_geo_index_switch_cc::LazyFunctionForIndexSwitchNode::values_num().

◆ outputs_

Vector<Output> blender::fn::lazy_function::LazyFunction::outputs_
protected

Definition at line 248 of file FN_lazy_function.hh.

Referenced by blender::fn::lazy_function::tests::AddLazyFunction::AddLazyFunction(), blender::nodes::LazyFunctionForIndexSwitchSocketUsage::execute_impl(), blender::nodes::LazyFunctionForMultiFunctionNode::execute_impl(), blender::nodes::node_geo_index_switch_cc::LazyFunctionForIndexSwitchNode::execute_single(), blender::nodes::node_geo_switch_cc::LazyFunctionForSwitchNode::execute_single(), blender::nodes::LazyFunctionForEvaluateClosureNode::initialize_execution_graph(), blender::nodes::LazyFunctionForForeachGeometryElementZone::initialize_execution_graph(), blender::nodes::LazyFunctionForEvaluateClosureNode::initialize_pass_through_graph(), blender::nodes::LazyFunctionForBakeInputsUsage::LazyFunctionForBakeInputsUsage(), blender::nodes::node_geo_bake_cc::LazyFunctionForBakeNode::LazyFunctionForBakeNode(), blender::nodes::LazyFunctionForClosureZone::LazyFunctionForClosureZone(), blender::nodes::node_geo_enable_output_cc::LazyFunctionForEnableOutputNode::LazyFunctionForEnableOutputNode(), blender::nodes::LazyFunctionForEnableOutputSocketUsage::LazyFunctionForEnableOutputSocketUsage(), blender::nodes::LazyFunctionForExtractingReferenceSet::LazyFunctionForExtractingReferenceSet(), blender::nodes::LazyFunctionForForeachGeometryElementZone::LazyFunctionForForeachGeometryElementZone(), blender::nodes::LazyFunctionForGeometryNode::LazyFunctionForGeometryNode(), blender::nodes::LazyFunctionForGizmoInputsUsage::LazyFunctionForGizmoInputsUsage(), blender::nodes::LazyFunctionForGroupNode::LazyFunctionForGroupNode(), blender::nodes::LazyFunctionForImplicitConversion::LazyFunctionForImplicitConversion(), blender::nodes::LazyFunctionForImplicitInput::LazyFunctionForImplicitInput(), blender::nodes::node_geo_index_switch_cc::LazyFunctionForIndexSwitchNode::LazyFunctionForIndexSwitchNode(), blender::nodes::LazyFunctionForIndexSwitchSocketUsage::LazyFunctionForIndexSwitchSocketUsage(), blender::nodes::LazyFunctionForJoinReferenceSets::LazyFunctionForJoinReferenceSets(), blender::nodes::LazyFunctionForLogicalOr::LazyFunctionForLogicalOr(), blender::nodes::node_geo_menu_switch_cc::LazyFunctionForMenuSwitchNode::LazyFunctionForMenuSwitchNode(), blender::nodes::LazyFunctionForMultiFunctionNode::LazyFunctionForMultiFunctionNode(), blender::nodes::LazyFunctionForMultiInput::LazyFunctionForMultiInput(), blender::nodes::LazyFunctionForMutedNode::LazyFunctionForMutedNode(), blender::nodes::LazyFunctionForRepeatZone::LazyFunctionForRepeatZone(), blender::nodes::LazyFunctionForRerouteNode::LazyFunctionForRerouteNode(), blender::nodes::node_geo_simulation_cc::sim_input_node::LazyFunctionForSimulationInputNode::LazyFunctionForSimulationInputNode(), blender::nodes::LazyFunctionForSimulationInputsUsage::LazyFunctionForSimulationInputsUsage(), blender::nodes::node_geo_simulation_cc::sim_output_node::LazyFunctionForSimulationOutputNode::LazyFunctionForSimulationOutputNode(), blender::nodes::LazyFunctionForSimulationZone::LazyFunctionForSimulationZone(), blender::nodes::node_geo_switch_cc::LazyFunctionForSwitchNode::LazyFunctionForSwitchNode(), blender::nodes::LazyFunctionForSwitchSocketUsage::LazyFunctionForSwitchSocketUsage(), blender::nodes::LazyFunctionForUndefinedNode::LazyFunctionForUndefinedNode(), blender::nodes::LazyFunctionForViewerInputUsage::LazyFunctionForViewerInputUsage(), blender::nodes::LazyFunctionForViewerNode::LazyFunctionForViewerNode(), blender::nodes::node_geo_warning_cc::LazyFunctionForWarningNode::LazyFunctionForWarningNode(), output_name(), blender::nodes::LazyFunctionForForeachGeometryElementZone::output_name(), blender::nodes::LazyFunctionForGeometryNode::output_name(), blender::nodes::LazyFunctionForRepeatZone::output_name(), outputs(), and blender::fn::lazy_function::tests::PartialEvaluationTestFunction::PartialEvaluationTestFunction().


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