Blender  V3.3
Classes | Namespaces | Enumerations | Functions | Variables
FN_field.hh File Reference
#include "BLI_function_ref.hh"
#include "BLI_generic_virtual_array.hh"
#include "BLI_string_ref.hh"
#include "BLI_vector.hh"
#include "BLI_vector_set.hh"
#include "FN_multi_function.hh"

Go to the source code of this file.

Classes

class  blender::fn::FieldNode
 
class  blender::fn::GFieldBase< NodePtr >
 
class  blender::fn::GField
 
class  blender::fn::GFieldRef
 
struct  blender::fn::detail::TypedFieldBase
 
class  blender::fn::Field< T >
 
class  blender::fn::FieldOperation
 
class  blender::fn::FieldInput
 
class  blender::fn::FieldConstant
 
struct  blender::fn::FieldInputs
 
class  blender::fn::FieldContext
 
class  blender::fn::FieldEvaluator
 
class  blender::fn::IndexFieldInput
 
struct  blender::fn::ValueOrField< T >
 

Namespaces

 blender
 
 blender::fn
 
 blender::fn::detail
 

Enumerations

enum class  blender::fn::FieldNodeType { blender::fn::Input , blender::fn::Operation , blender::fn::Constant }
 

Functions

Vector< GVArray > blender::fn::evaluate_fields (ResourceScope &scope, Span< GFieldRef > fields_to_evaluate, IndexMask mask, const FieldContext &context, Span< GVMutableArray > dst_varrays={})
 
Utility functions for simple field creation and evaluation
void blender::fn::evaluate_constant_field (const GField &field, void *r_value)
 
template<typename T >
T blender::fn::evaluate_constant_field (const Field< T > &field)
 
Field< boolblender::fn::invert_boolean_field (const Field< bool > &field)
 
GField blender::fn::make_constant_field (const CPPType &type, const void *value)
 
template<typename T >
Field< Tblender::fn::make_constant_field (T value)
 
GField blender::fn::make_field_constant_if_possible (GField field)
 
#FieldNode Inline Methods
bool blender::fn::operator== (const FieldNode &a, const FieldNode &b)
 
bool blender::fn::operator!= (const FieldNode &a, const FieldNode &b)
 

Variables

template<typename T >
static constexpr bool blender::fn::is_field_v
 

Detailed Description

A #Field represents a function that outputs a value based on an arbitrary number of inputs. The inputs for a specific field evaluation are provided by a #FieldContext.

A typical example is a field that computes a displacement vector for every vertex on a mesh based on its position.

Fields can be build, composed and evaluated at run-time. They are stored in a directed tree graph data structure, whereby each node is a #FieldNode and edges are dependencies. A #FieldNode has an arbitrary number of inputs and at least one output and a #Field references a specific output of a #FieldNode. The inputs of a #FieldNode are other fields.

There are two different types of field nodes:

When fields are evaluated, they are converted into a multi-function procedure which allows efficient computation. In the future, we might support different field evaluation mechanisms for e.g. the following scenarios:

Whenever possible, multiple fields should be evaluated together to avoid duplicate work when they share common sub-fields and a common context.

Definition in file FN_field.hh.