Blender V4.3
blender::nodes::FieldEvaluator Class Reference

#include <FN_field.hh>

Inherits blender::NonMovable, and blender::NonCopyable.

Public Member Functions

 FieldEvaluator (const FieldContext &context, const IndexMask *mask)
 FieldEvaluator (const FieldContext &context, const int64_t size)
 ~FieldEvaluator ()
void set_selection (Field< bool > selection)
template<typename T>
int add_with_destination (Field< T > field, VMutableArray< T > dst)
template<typename T>
int add_with_destination (Field< T > field, MutableSpan< T > dst)
template<typename T>
int add (Field< T > field, VArray< T > *varray_ptr)
const GVArrayget_evaluated (const int field_index) const
template<typename T>
VArray< Tget_evaluated (const int field_index)
#FieldEvaluator
int add_with_destination (GField field, GVMutableArray dst)
int add_with_destination (GField field, GMutableSpan dst)
int add (GField field, GVArray *varray_ptr)
int add (GField field)
void evaluate ()
IndexMask get_evaluated_selection_as_mask () const
IndexMask get_evaluated_as_mask (int field_index)

Detailed Description

Utility class that makes it easier to evaluate fields.

Definition at line 338 of file FN_field.hh.

Constructor & Destructor Documentation

◆ FieldEvaluator() [1/2]

blender::fn::FieldEvaluator::FieldEvaluator ( const FieldContext & context,
const IndexMask * mask )
inline

Takes mask by pointer because the mask has to live longer than the evaluator.

Definition at line 360 of file FN_field.hh.

◆ FieldEvaluator() [2/2]

blender::fn::FieldEvaluator::FieldEvaluator ( const FieldContext & context,
const int64_t size )
inline

Construct a field evaluator for all indices less than size.

Definition at line 366 of file FN_field.hh.

◆ ~FieldEvaluator()

blender::fn::FieldEvaluator::~FieldEvaluator ( )
inline

Definition at line 371 of file FN_field.hh.

Member Function Documentation

◆ add() [1/3]

template<typename T>
int blender::fn::FieldEvaluator::add ( Field< T > field,
VArray< T > * varray_ptr )
inline
Parameters
fieldField to add to the evaluator.
varray_ptrOnce evaluate is called, the resulting virtual array will be will be assigned to the given position.
Returns
Index of the field in the evaluator which can be used in the get_evaluated methods.

Definition at line 429 of file FN_field.hh.

◆ add() [2/3]

int blender::fn::FieldEvaluator::add ( GField field)
Returns
Index of the field in the evaluator which can be used in the get_evaluated methods.

Definition at line 767 of file field.cc.

◆ add() [3/3]

int blender::fn::FieldEvaluator::add ( GField field,
GVArray * varray_ptr )

Definition at line 756 of file field.cc.

◆ add_with_destination() [1/4]

template<typename T>
int blender::fn::FieldEvaluator::add_with_destination ( Field< T > field,
MutableSpan< T > dst )
inline
Parameters
fieldField to add to the evaluator.
dstMutable span that the evaluated result for this field is be written into.
Note
When the output may only be used as a single value, the version of this function with a virtual array result array should be used.

Definition at line 416 of file FN_field.hh.

◆ add_with_destination() [2/4]

template<typename T>
int blender::fn::FieldEvaluator::add_with_destination ( Field< T > field,
VMutableArray< T > dst )
inline

Same as add_with_destination but typed.

Definition at line 397 of file FN_field.hh.

◆ add_with_destination() [3/4]

int blender::fn::FieldEvaluator::add_with_destination ( GField field,
GMutableSpan dst )
Parameters
fieldField to add to the evaluator.
dstMutable span that the evaluated result for this field is be written into.
Note
When the output may only be used as a single value, the version of this function with a virtual array result array should be used.

Definition at line 751 of file field.cc.

◆ add_with_destination() [4/4]

int blender::fn::FieldEvaluator::add_with_destination ( GField field,
GVMutableArray dst )
Parameters
fieldField to add to the evaluator.
dstMutable virtual array that the evaluated result for this field is be written into.

Definition at line 743 of file field.cc.

◆ evaluate()

void blender::fn::FieldEvaluator::evaluate ( )

Evaluate all fields on the evaluator. This can only be called once.

Definition at line 788 of file field.cc.

◆ get_evaluated() [1/2]

template<typename T>
VArray< T > blender::fn::FieldEvaluator::get_evaluated ( const int field_index)
inline

Definition at line 456 of file FN_field.hh.

◆ get_evaluated() [2/2]

const GVArray & blender::fn::FieldEvaluator::get_evaluated ( const int field_index) const
inline

Definition at line 450 of file FN_field.hh.

◆ get_evaluated_as_mask()

IndexMask blender::fn::FieldEvaluator::get_evaluated_as_mask ( int field_index)

Retrieve the output of an evaluated boolean field and convert it to a mask, which can be used to avoid calculations for unnecessary elements later on. The evaluator will own the indices in some cases, so it must live at least as long as the returned mask.

Definition at line 809 of file field.cc.

◆ get_evaluated_selection_as_mask()

IndexMask blender::fn::FieldEvaluator::get_evaluated_selection_as_mask ( ) const

Definition at line 822 of file field.cc.

◆ set_selection()

void blender::fn::FieldEvaluator::set_selection ( Field< bool > selection)
inline

The selection field is evaluated first to determine which indices of the other fields should be evaluated. Calling this method multiple times will just replace the previously set selection field. Only the elements selected by both this selection and the selection provided in the constructor are calculated. If no selection field is set, it is assumed that all indices passed to the constructor are selected.

Definition at line 385 of file FN_field.hh.


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