|
Blender V5.3
|
#include <FN_field.hh>
Classes | |
| struct | Input |
| struct | MultiFn |
| struct | FieldRef |
| struct | ConstantRef |
| struct | TrivialInlineConstant |
| struct | OwnedConstant |
Public Types | |
| using | Variant |
Public Member Functions | |
| GField ()=delete | |
| GField (const GField &other) | |
| GField (GField &&other) noexcept | |
| GField & | operator= (const GField &other) |
| GField & | operator= (GField &&other) noexcept |
| ~GField () | |
| const FieldInputsPtr & | field_inputs () const |
| uint64_t | hash () const |
| FieldOperationPtr | try_extract_operation () |
Static Public Member Functions | |
| static GField | from_constant (const CPPType &type, const void *value) |
Static Public Attributes | |
| template<typename T> | |
| static constexpr bool | is_constant_value_v |
Friends | |
| bool | operator== (const GField &a, const GField &b) |
Inline Methods | |
| GField (const CPPType &type) noexcept | |
| GField (FieldInputPtr node) noexcept | |
| GField (FieldOperationPtr node, int output_i=0) noexcept | |
| GField (Variant variant) noexcept | |
| const CPPType & | cpp_type () const |
| const GField & | deref_field_ref () const |
| const Variant & | variant () const |
| bool | depends_on_input () const |
| template<typename InputT> | |
| const InputT * | get_input_if () const |
| const void * | get_if_constant () const |
| template<typename T> | |
| const Field< T > & | typed () const |
| template<typename T> | |
| Field< T > & | typed () |
| static GField | from_non_owning_ref (const GField &field) |
| static GField | from_non_owning_constant (const CPPType &type, const void *value) |
| template<typename InputT, typename... Args> | |
| static GField | from_input (Args &&...args) |
A field with a type that is only known at runtime which can be accessed through the cpp_type method. If the type is known at compile time, it is recommended to use Field<T> instead.
It is designed to support various internal storage representations to avoid unnecessary allocations or reference counting in many common cases.
Definition at line 55 of file FN_field.hh.
Definition at line 110 of file FN_field.hh.
|
delete |
GField is expected to always have a valid CPPType. Therefore, it can't be default constructed.
References b, cpp_type(), depends_on_input(), deref_field_ref(), field_inputs(), from_constant(), from_input(), from_non_owning_constant(), from_non_owning_ref(), get_if_constant(), get_input_if(), GField(), hash(), node, T, try_extract_operation(), typed(), and variant().
Referenced by blender::fn::FieldEvaluator::add_with_destination(), deref_field_ref(), blender::fn::Field< T >::Field(), blender::bke::GeometryFieldInput::FieldInput(), from_constant(), from_input(), from_non_owning_constant(), from_non_owning_ref(), get_input_if(), GField(), GField(), GField(), hash(), blender::fn::invert_boolean_field(), operator=(), operator=(), operator==, typed(), and typed().
|
inlineexplicitnoexcept |
Construct a field that just outputs the default value of the given type.
Definition at line 450 of file FN_field.hh.
|
inlineexplicitnoexcept |
Construct a field owning a field input.
Definition at line 454 of file FN_field.hh.
References node.
|
inlineexplicitnoexcept |
Construct a field that owns a field operation and outputs one of its outputs.
Definition at line 456 of file FN_field.hh.
References node.
|
inlineexplicitnoexcept |
Construct directly from a Variant, mostly for internal use.
Definition at line 455 of file FN_field.hh.
References variant().
| blender::fn::GField::GField | ( | const GField & | other | ) |
GField requires manual memory management due to inlined values and to support move semantics without making GField nullable.
Definition at line 321 of file field.cc.
References GField(), blender::MEM_new_uninitialized_aligned(), T, and blender::v.
|
noexcept |
Definition at line 335 of file field.cc.
References cpp_type(), blender::CPPType::default_value(), and GField().
| blender::fn::GField::~GField | ( | ) |
Definition at line 361 of file field.cc.
References blender::MEM_delete_void(), T, and blender::v.
|
inline |
The value type the field outputs for each element, e.g. float.
Definition at line 518 of file FN_field.hh.
References BLI_assert_unreachable_static_t, blender::is_same_any_v, T, and blender::v.
Referenced by blender::nodes::node_geo_tool_set_selection_cc::clamp_selection(), blender::fn::evaluate_constant_field(), blender::nodes::evaluate_field_to_list(), GField(), GField(), blender::nodes::node_geo_tool_set_selection_cc::invert_selection(), blender::bke::detail::SocketValueVariantTypeInfo::is_interpretable_as_fn(), blender::fn::make_field_constant_if_possible(), blender::nodes::node_geo_field_to_list_cc::node_geo_exec(), blender::nodes::node_geo_sample_index_cc::node_geo_exec(), blender::bke::bake::serialize_field(), blender::bke::try_add_shared_field_attribute(), blender::bke::try_capture_fields_on_geometry(), blender::bke::DataTypeConversions::try_convert(), blender::bke::detail::SocketValueVariantTypeInfo::try_convert_fn(), typed(), and typed().
|
inline |
Returns true when the field depends on some input.
Definition at line 614 of file FN_field.hh.
References field_inputs().
Referenced by blender::fn::evaluate_constant_field(), GField(), blender::bke::SocketValueVariant::is_context_dependent_field(), blender::fn::make_field_constant_if_possible(), and blender::bke::try_capture_fields_on_geometry().
|
inline |
This "normalizes" the field. Specifically, if this field is just a non-owning reference to some other field, the referenced field is returned.
Definition at line 541 of file FN_field.hh.
References GField().
Referenced by get_input_if(), GField(), hash(), and operator==.
| const FieldInputsPtr & blender::fn::GField::field_inputs | ( | ) | const |
Root FieldInput nodes that this field depends on.
Definition at line 504 of file field.cc.
References BLI_assert_unreachable_static_t, blender::is_same_any_v, T, and blender::v.
Referenced by depends_on_input(), blender::nodes::eval_log::FieldInfoLog::FieldInfoLog(), GField(), blender::bke::try_detect_field_domain(), and blender::bke::try_detect_native_field_domain().
Construct a field that just outputs the given constant value.
Definition at line 24 of file field.cc.
References blender::CPPType::alignment, blender::CPPType::copy_construct(), blender::fn::GField::TrivialInlineConstant::cpp_type_supported(), GField(), blender::MEM_new_uninitialized_aligned(), blender::CPPType::size, blender::fn::GField::TrivialInlineConstant::type, and blender::fn::GField::TrivialInlineConstant::value.
Referenced by GField(), and blender::fn::make_field_constant_if_possible().
|
inlinestatic |
Build a new FieldInput with the given arguments.
Definition at line 482 of file FN_field.hh.
References GField().
Referenced by blender::bke::bake::deserialize_bake_item(), blender::bke::AttributeExistsFieldInput::from(), blender::bke::AttributeFieldInput::from(), blender::fn::Field< int >::from_input(), GField(), blender::nodes::init_socket_cpp_value(), blender::nodes::node_geo_input_voxel_index_cc::node_geo_exec(), blender::fn::tests::TEST_F(), blender::fn::tests::TEST_F(), blender::fn::tests::TEST_F(), blender::fn::tests::TEST_F(), and blender::fn::tests::TEST_F().
|
inlinestatic |
Construct a field that just outputs the given constant value without owning it.
Definition at line 472 of file FN_field.hh.
References GField().
Referenced by blender::nodes::node_geo_tool_selection_cc::get_selection_field(), and GField().
Wraps the given field in a new field. This is used to avoid reference counting for some field fields which have static lifetime.
Definition at line 461 of file FN_field.hh.
References GField().
Referenced by blender::fn::Field< T >::from_non_owning_ref(), and GField().
|
inline |
Definition at line 632 of file FN_field.hh.
References blender::is_same_any_v, T, and blender::v.
Referenced by GField(), and blender::bke::detail::SocketValueVariantTypeInfo::try_convert_fn().
|
inline |
Utility to access a specific input type if this field is just an input.
Definition at line 623 of file FN_field.hh.
References deref_field_ref(), GField(), and variant().
Referenced by GField(), blender::bke::bake::serialize_field(), and blender::bke::try_get_field_direct_attribute_id().
| uint64_t blender::fn::GField::hash | ( | ) | const |
Definition at line 87 of file field.cc.
References BLI_assert_unreachable, BLI_assert_unreachable_static_t, deref_field_ref(), blender::get_default_hash(), GField(), is_constant_value_v, T, and blender::v.
Referenced by GField().
| FieldOperationPtr blender::fn::GField::try_extract_operation | ( | ) |
Attempts to take ownership of a FieldOperation stored in this field, leaving the field input. It's expected to be deleted shortly after. This is necessary to avoid deep recursion when destructing a field tree.
Definition at line 202 of file field.cc.
References blender::fn::GField::MultiFn::node.
Referenced by GField().
Definition at line 591 of file FN_field.hh.
References blender::BLI_assert(), cpp_type(), and GField().
Get a typed reference to this field. Note that Field<T> happens to be identical to GField on a bit-level. So this is just a cast.
Definition at line 584 of file FN_field.hh.
References blender::BLI_assert(), cpp_type(), and GField().
Referenced by blender::bke::AttributeExistsFieldInput::from(), blender::fn::Field< int >::from_input(), blender::fn::Field< T >::from_non_owning_ref(), and GField().
|
inline |
Get the underlying Variant.
Definition at line 598 of file FN_field.hh.
Referenced by get_input_if(), GField(), and GField().
This only implements shallow comparison. A more deep comparison could reveal that two fields are semantically the same even if this comparison is false. Deep comparison is much more expensive though.
Definition at line 37 of file field.cc.
References b, BLI_assert_unreachable, BLI_assert_unreachable_static_t, deref_field_ref(), GField(), is_constant_value_v, blender::CPPType::is_equal_or_false(), operator==, T, and blender::U.
Referenced by operator==.
|
staticconstexpr |