Blender V5.0
blender::nodes::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< Input > inputs () const
Span< Output > outputs () const
void execute (Params &params, const Context &context) const

Protected Attributes

const char * debug_name_ = "unknown"
Vector< Input > inputs_
Vector< Output > outputs_
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()

Member Function Documentation

◆ allow_missing_requested_inputs()

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.

◆ always_used_inputs_available()

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

Definition at line 50 of file lazy_function.cc.

◆ destruct_storage()

void blender::fn::lazy_function::LazyFunction::destruct_storage ( void * storage) const
virtual

Destruct the storage created in init_storage.

Definition at line 33 of file lazy_function.cc.

◆ 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.

◆ init_storage()

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.

Definition at line 28 of file lazy_function.cc.

◆ input_name()

std::string blender::fn::lazy_function::LazyFunction::input_name ( int index) const
virtual

Definition at line 18 of file lazy_function.cc.

◆ inputs()

Inputs of the function.

Definition at line 328 of file FN_lazy_function.hh.

◆ 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.

Definition at line 13 of file lazy_function.cc.

◆ output_name()

std::string blender::fn::lazy_function::LazyFunction::output_name ( int index) const
virtual

Definition at line 23 of file lazy_function.cc.

◆ outputs()

Outputs of the function.

Definition at line 333 of file FN_lazy_function.hh.

◆ 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.

Definition at line 39 of file lazy_function.cc.

Member Data Documentation

◆ allow_missing_requested_inputs_

Allow executing the function even if previously requested values are not yet available.

Definition at line 252 of file FN_lazy_function.hh.

◆ debug_name_

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

Definition at line 246 of file FN_lazy_function.hh.

◆ inputs_

◆ outputs_


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