|
Blender V4.3
|
Namespaces | |
| namespace | detail |
| namespace | lazy_function |
| namespace | multi_function |
| namespace | tests |
Classes | |
| class | Field |
| class | FieldConstant |
| class | FieldContext |
| class | FieldEvaluator |
| class | FieldInput |
| struct | FieldInputs |
| class | FieldNode |
| class | FieldOperation |
| struct | FieldTreeInfo |
| class | GField |
| class | GFieldBase |
| class | GFieldRef |
| class | IndexFieldInput |
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, 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 56 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, BLI_assert_unreachable, Constant, blender::ResourceScope::construct(), blender::fn::multi_function::Procedure::construct_function(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), blender::Span< T >::contains(), blender::fn::multi_function::ParamType::data_type(), blender::fn::FieldTreeInfo::deduplicated_field_inputs, blender::fn::FieldTreeInfo::field_users, blender::GPointer::get(), Input, blender::fn::FieldOperation::inputs(), blender::fn::multi_function::ParamType::interface_type(), 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::multi_function::Procedure::new_variable(), blender::fn::FieldNode::node_type(), Operation, blender::fn::multi_function::MultiFunction::param_amount(), blender::fn::multi_function::MultiFunction::param_indices(), blender::fn::multi_function::MultiFunction::param_type(), 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::multi_function::Procedure::validate(), 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 619 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 501 of file FN_field.hh.
References evaluate_constant_field().
| void blender::fn::evaluate_constant_field | ( | const GField & | field, |
| void * | r_value ) |
Definition at line 498 of file field.cc.
References evaluate_constant_field(), evaluate_fields(), 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(), 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::GMutableSpan::data(), blender::fn::FieldTreeInfo::deduplicated_field_inputs, find_varying_fields(), blender::GVArray::ForEmpty(), blender::GVArray::ForSingleRef(), blender::GVArray::ForSpan(), blender::GPointer::get(), get_field_context_inputs(), blender::GVMutableArray::get_internal_span(), 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::ResourceScope::linear_allocator(), mask(), 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 775 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, 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(), and blender::GVArray::ForSingleDefault().
Referenced by evaluate_fields().
|
static |
Definition at line 736 of file field.cc.
References blender::ResourceScope::construct(), and blender::index_mask::IndexMask::from_bools().
Referenced by evaluate_selection(), and blender::fn::FieldEvaluator::get_evaluated_as_mask().
Definition at line 525 of file field.cc.
References 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 533 of file field.cc.
References make_constant_field().
Referenced by blender::bke::SocketValueVariant::extract(), 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_sample_index_cc::node_geo_exec(), blender::nodes::node_geo_set_curve_normal_cc::set_curve_normal(), and blender::bke::try_capture_fields_on_geometry().
Definition at line 513 of file FN_field.hh.
References blender::CPPType::get(), and make_constant_field().
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 512 of file field.cc.
References BUFFER_FOR_CPP_TYPE_VALUE, evaluate_constant_field(), make_constant_field(), and make_field_constant_if_possible().
Referenced by make_field_constant_if_possible().
Definition at line 581 of file FN_field.hh.
References b.
Definition at line 576 of file FN_field.hh.
References b.
|
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::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 217 of file FN_field.hh.
Referenced by blender::bke::SocketValueVariant::extract().