|
Blender V5.0
|
Namespaces | |
| namespace | multi_function |
| namespace | detail |
| namespace | lazy_function |
| namespace | tests |
Classes | |
| class | FieldNode |
| class | GFieldBase |
| class | GField |
| class | GFieldRef |
| class | Field |
| class | FieldOperation |
| class | FieldInput |
| class | FieldConstant |
| struct | FieldInputs |
| class | FieldContext |
| class | FieldEvaluator |
| class | IndexFieldInput |
| class | LocalUserData |
| class | UserData |
| struct | FieldTreeInfo |
Enumerations | |
| enum class | FieldNodeType { Input , Operation , Constant } |
Functions | |
Field Evaluation | |
| Vector< GVArray > | evaluate_fields (ResourceScope &scope, Span< GFieldRef > fields_to_evaluate, const IndexMask &mask, const FieldContext &context, Span< GVMutableArray > dst_varrays={}) |
| static FieldTreeInfo | preprocess_field_tree (Span< GFieldRef > entry_fields) |
| static Vector< GVArray > | get_field_context_inputs (ResourceScope &scope, const IndexMask &mask, const FieldContext &context, const Span< std::reference_wrapper< const FieldInput > > field_inputs) |
| static Set< GFieldRef > | find_varying_fields (const FieldTreeInfo &field_tree_info, Span< GVArray > field_context_inputs) |
| static void | build_multi_function_procedure_for_fields (mf::Procedure &procedure, ResourceScope &scope, const FieldTreeInfo &field_tree_info, Span< GFieldRef > output_fields) |
Utility functions for simple field creation and evaluation | |
| void | evaluate_constant_field (const GField &field, void *r_value) |
| template<typename T> | |
| T | evaluate_constant_field (const Field< T > &field) |
| Field< bool > | invert_boolean_field (const Field< bool > &field) |
| GField | make_constant_field (const CPPType &type, const void *value) |
| template<typename T> | |
| Field< T > | make_constant_field (T value) |
| GField | make_field_constant_if_possible (GField field) |
#FieldNode Inline Methods | |
| bool | operator== (const FieldNode &a, const FieldNode &b) |
| bool | operator!= (const FieldNode &a, const FieldNode &b) |
#FieldOperation | |
| static std::shared_ptr< const FieldInputs > | combine_field_inputs (Span< GField > fields) |
#FieldEvaluator | |
| static IndexMask | index_mask_from_selection (const IndexMask full_mask, const VArray< bool > &selection, ResourceScope &scope) |
| static IndexMask | evaluate_selection (const Field< bool > &selection_field, const FieldContext &context, const IndexMask &full_mask, ResourceScope &scope) |
Variables | |
| template<typename T> | |
| static constexpr bool | is_field_v |
|
strong |
Have a fixed set of base node types, because all code that works with field nodes has to understand those.
| Enumerator | |
|---|---|
| Input | |
| Operation | |
| Constant | |
Definition at line 54 of file FN_field.hh.
|
static |
Builds the #procedure so that it computes the fields.
Definition at line 146 of file field.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_new(), BLI_assert_unreachable, Constant, blender::ResourceScope::construct(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), blender::Span< T >::contains(), blender::fn::FieldInput::cpp_type(), blender::fn::FieldInput::debug_name(), blender::fn::FieldTreeInfo::deduplicated_field_inputs, blender::fn::FieldTreeInfo::field_users, blender::GPointer::get(), Input, blender::fn::FieldOperation::inputs(), blender::Stack< T, InlineBufferCapacity, Allocator >::is_empty(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup(), blender::fn::FieldOperation::multi_function(), blender::fn::GFieldBase< NodePtr >::node(), blender::fn::FieldNode::node_type(), Operation, blender::Stack< T, InlineBufferCapacity, Allocator >::peek(), blender::Stack< T, InlineBufferCapacity, Allocator >::pop(), blender::Stack< T, InlineBufferCapacity, Allocator >::push(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::remove(), blender::Span< T >::size(), blender::fn::FieldConstant::type(), blender::fn::FieldConstant::value(), and blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::values().
Referenced by evaluate_fields().
|
static |
Returns the field inputs used by all the provided fields. This tries to reuse an existing FieldInputs whenever possible to avoid copying it.
Definition at line 614 of file field.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), and blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty().
Referenced by blender::fn::FieldOperation::FieldOperation().
Definition at line 499 of file FN_field.hh.
References evaluate_constant_field(), and T.
| void blender::fn::evaluate_constant_field | ( | const GField & | field, |
| void * | r_value ) |
Definition at line 493 of file field.cc.
References blender::fn::GFieldBase< NodePtr >::cpp_type(), blender::fn::FieldNode::depends_on_input(), evaluate_constant_field(), evaluate_fields(), blender::fn::GFieldBase< NodePtr >::node(), and blender::CPPType::value_initialize().
Referenced by blender::bke::SocketValueVariant::convert_to_single(), evaluate_constant_field(), evaluate_constant_field(), blender::bke::SocketValueVariant::extract(), blender::nodes::node_geo_tool_set_face_set_cc::is_constant_zero(), make_field_constant_if_possible(), blender::bke::try_capture_fields_on_geometry(), blender::nodes::node_geo_set_shade_smooth_cc::try_removing_sharp_attribute(), and blender::nodes::node_geo_curve_topology_points_of_curve_cc::use_start_point_special_case().
| Vector< GVArray > blender::fn::evaluate_fields | ( | ResourceScope & | scope, |
| Span< GFieldRef > | fields_to_evaluate, | ||
| const IndexMask & | mask, | ||
| const FieldContext & | context, | ||
| Span< GVMutableArray > | dst_varrays = {} ) |
Evaluate fields in the given context. If possible, multiple fields should be evaluated together, because that can be more efficient when they share common sub-fields.
| scope | The resource scope that owns data that makes up the output virtual arrays. Make sure the scope is not destructed when the output virtual arrays are still used. |
| fields_to_evaluate | The fields that should be evaluated together. |
| mask | Determines which indices are computed. The mask may be referenced by the returned virtual arrays. So the underlying indices (if applicable) should live longer then #scope. |
| context | The context that the field is evaluated in. Used to retrieve data from each FieldInput in the field network. |
| dst_varrays | If provided, the computed data will be written into those virtual arrays instead of into newly created ones. That allows making the computed data live longer than #scope and is more efficient when the data will be written into those virtual arrays later anyway. |
Definition at line 281 of file field.cc.
References blender::ResourceScope::add_destruct_call(), blender::LinearAllocator< Allocator >::allocate_array(), blender::ResourceScope::allocate_owned(), blender::ResourceScope::allocator(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BLI_assert, build_multi_function_procedure_for_fields(), Constant, blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), blender::array_utils::copy(), blender::fn::GFieldBase< NodePtr >::cpp_type(), blender::GMutableSpan::data(), blender::fn::FieldTreeInfo::deduplicated_field_inputs, blender::CPPType::destruct_indices(), find_varying_fields(), blender::GVArray::from_empty(), blender::GVArray::from_single_ref(), blender::GVArray::from_span(), blender::GPointer::get(), get_field_context_inputs(), blender::GVMutableArray::get_internal_span(), i, blender::Span< T >::index_range(), blender::Vector< T, InlineBufferCapacity, Allocator >::index_range(), Input, blender::Span< T >::is_empty(), blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), blender::GVArrayCommon::is_span(), blender::CPPType::is_trivially_destructible, mask(), blender::fn::GFieldBase< NodePtr >::node(), blender::fn::FieldNode::node_type(), Operation, blender::threading::parallel_for(), preprocess_field_tree(), blender::GVArrayCommon::size(), blender::Span< T >::size(), blender::GMutableSpan::take_front(), blender::fn::FieldConstant::type(), blender::GVArrayCommon::type(), and blender::fn::FieldConstant::value().
Referenced by blender::fn::FieldEvaluator::evaluate(), evaluate_constant_field(), evaluate_selection(), and blender::fn::tests::TEST().
|
static |
Definition at line 770 of file field.cc.
References evaluate_fields(), and index_mask_from_selection().
Referenced by blender::fn::FieldEvaluator::evaluate().
|
static |
Definition at line 108 of file field.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), blender::fn::FieldTreeInfo::deduplicated_field_inputs, blender::fn::FieldTreeInfo::field_users, i, blender::Span< T >::index_range(), blender::Stack< T, InlineBufferCapacity, Allocator >::is_empty(), blender::GVArrayCommon::is_single(), blender::Stack< T, InlineBufferCapacity, Allocator >::pop(), blender::Stack< T, InlineBufferCapacity, Allocator >::push(), and users.
Referenced by evaluate_fields().
|
static |
Retrieves the data from the context that is passed as input into the field.
Definition at line 86 of file field.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::GVArray::from_single_default(), and mask().
Referenced by evaluate_fields().
|
static |
Definition at line 731 of file field.cc.
References blender::ResourceScope::construct(), and blender::IndexMask::from_bools().
Referenced by evaluate_selection(), and blender::fn::FieldEvaluator::get_evaluated_as_mask().
Definition at line 520 of file field.cc.
References blender::fn::FieldOperation::from(), and invert_boolean_field().
Referenced by blender::nodes::node_geo_edges_to_face_groups_cc::geo_node_exec(), invert_boolean_field(), blender::nodes::node_geo_delete_geometry_cc::node_geo_exec(), blender::nodes::node_geo_input_edge_smooth_cc::node_geo_exec(), blender::nodes::node_geo_input_face_smooth_cc::node_geo_exec(), blender::nodes::node_geo_separate_geometry_cc::node_geo_exec(), and blender::nodes::node_geo_set_shade_smooth_cc::node_geo_exec().
Definition at line 528 of file field.cc.
References make_constant_field().
Referenced by blender::bke::SocketValueVariant::extract(), blender::geometry::get_count_input_from_length(), blender::nodes::node_geo_tool_selection_cc::get_selection_field(), make_constant_field(), make_constant_field(), make_field_constant_if_possible(), blender::nodes::node_geo_curve_sample_cc::node_geo_exec(), blender::nodes::node_geo_curve_to_points_cc::node_geo_exec(), blender::nodes::node_geo_sample_index_cc::node_geo_exec(), blender::nodes::node_geo_set_mesh_normal_cc::node_geo_exec(), and blender::bke::try_capture_fields_on_geometry().
Definition at line 511 of file FN_field.hh.
References blender::CPPType::get(), make_constant_field(), and T.
If the field depends on some input, the same field is returned. Otherwise the field is evaluated and a new field is created that just computes this constant.
Making the field constant has two benefits:
Definition at line 507 of file field.cc.
References BUFFER_FOR_CPP_TYPE_VALUE, blender::fn::GFieldBase< NodePtr >::cpp_type(), blender::fn::FieldNode::depends_on_input(), blender::CPPType::destruct(), evaluate_constant_field(), make_constant_field(), make_field_constant_if_possible(), and blender::fn::GFieldBase< NodePtr >::node().
Referenced by make_field_constant_if_possible().
Definition at line 579 of file FN_field.hh.
References b.
Definition at line 574 of file FN_field.hh.
References b, and blender::fn::FieldNode::is_equal_to().
|
static |
Collects some information from the field tree that is required by later steps.
Definition at line 42 of file field.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), Constant, blender::fn::FieldTreeInfo::deduplicated_field_inputs, blender::fn::FieldTreeInfo::field_users, Input, blender::fn::FieldOperation::inputs(), blender::Stack< T, InlineBufferCapacity, Allocator >::is_empty(), blender::fn::GFieldBase< NodePtr >::node(), blender::fn::FieldNode::node_type(), Operation, blender::Stack< T, InlineBufferCapacity, Allocator >::pop(), and blender::Stack< T, InlineBufferCapacity, Allocator >::push().
Referenced by evaluate_fields().
|
staticconstexpr |
True when T is any Field<...> type.
Definition at line 215 of file FN_field.hh.
Referenced by blender::bke::SocketValueVariant::extract(), and blender::nodes::socket_type_info_by_static_type().