|
Blender V5.3
|
Namespaces | |
| namespace | lazy_function |
| namespace | multi_function |
| namespace | tests |
Classes | |
| class | Field |
| class | FieldContext |
| class | FieldEvaluator |
| struct | FieldHashDeep |
| class | FieldInput |
| class | FieldInputs |
| class | FieldOperation |
| struct | FieldTreeInfo |
| class | GField |
| class | GFieldRef |
| class | IndexFieldInput |
| class | LocalUserData |
| class | UserData |
Typedefs | |
| using | FieldInputPtr = ImplicitSharingPtr<FieldInput> |
| using | FieldOperationPtr = ImplicitSharingPtr<FieldOperation> |
| using | FieldInputsPtr = ImplicitSharingPtr<FieldInputs> |
Functions | |
| bool | operator== (const GField &a, const GField &b) |
| bool | operator== (const GFieldRef &a, const GFieldRef &b) |
| Field< bool > | invert_boolean_field (const Field< bool > &field) |
| static FieldInputsPtr | combine_field_inputs (const Span< GField > &fields) |
Inline Methods | |
| template<typename T> | |
| bool | operator== (const Field< T > &a, const Field< T > &b) |
| bool | operator== (const FieldInput &a, const FieldInput &b) |
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< GFieldRef > field_inputs) |
| static Set< UniqueHash > | find_varying_fields (const FieldTreeInfo &field_tree_info, const 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) |
| GField | make_field_constant_if_possible (GField field) |
#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> | |
| constexpr bool | is_field_v = false |
| template<typename T> | |
| constexpr bool | is_field_v< Field< T > > = true |
Definition at line 43 of file FN_field.hh.
Definition at line 45 of file FN_field.hh.
Definition at line 44 of file FN_field.hh.
|
static |
Builds the #procedure so that it computes the fields.
Definition at line 155 of file field_evaluation.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_new(), blender::BLI_assert(), BLI_assert_unreachable, BLI_assert_unreachable_static_t, build_multi_function_procedure_for_fields(), blender::ResourceScope::construct(), blender::fn::FieldHashDeep::contains(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), blender::fn::FieldInput::cpp_type(), blender::fn::FieldInput::debug_name(), blender::fn::FieldTreeInfo::deduplicated_inputs, blender::fn::FieldTreeInfo::deep_hashes, blender::Default, blender::fn::FieldOperation::inputs(), blender::Stack< T, InlineBufferCapacity, Allocator >::is_empty(), blender::fn::FieldHashDeep::lookup(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup(), blender::fn::FieldOperation::multi_function(), blender::Stack< T, InlineBufferCapacity, Allocator >::peek(), blender::Stack< T, InlineBufferCapacity, Allocator >::pop(), PRF_scope, blender::Stack< T, InlineBufferCapacity, Allocator >::push(), blender::Span< T >::size(), T, blender::v, and blender::fn::GFieldRef::variant().
Referenced by build_multi_function_procedure_for_fields(), and evaluate_fields().
|
static |
Combine the field inputs from multiple fields. If possible, nothing new is allocated.
Definition at line 266 of file field.cc.
References combine_field_inputs(), and blender::fn::FieldInputs::inputs.
Referenced by combine_field_inputs(), and blender::fn::FieldOperation::FieldOperation().
Definition at line 200 of file FN_field_evaluation.hh.
References evaluate_constant_field(), and T.
| void blender::fn::evaluate_constant_field | ( | const GField & | field, |
| void * | r_value ) |
Definition at line 507 of file field_evaluation.cc.
References blender::fn::GField::cpp_type(), blender::fn::GField::depends_on_input(), evaluate_constant_field(), evaluate_fields(), and blender::CPPType::value_initialize().
Referenced by blender::nodes::node_geo_distribute_points_on_faces_cc::create_points_random(), evaluate_constant_field(), evaluate_constant_field(), blender::nodes::node_geo_tool_set_face_set_cc::is_constant_zero(), make_field_constant_if_possible(), blender::nodes::node_geo_grid_deactivate_voxels::node_geo_exec(), blender::nodes::node_geo_grid_solve_poisson_cc::node_geo_exec(), blender::nodes::node_geo_points_cc::node_geo_exec(), blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), blender::bke::try_capture_fields_on_geometry(), blender::bke::detail::SocketValueVariantTypeInfo::try_convert_fn(), 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 300 of file field_evaluation.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(), blender::BLI_assert(), BLI_assert_unreachable_static_t, build_multi_function_procedure_for_fields(), blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), blender::array_utils::copy(), blender::fn::GFieldRef::cpp_type(), blender::GMutableSpan::data(), blender::fn::FieldTreeInfo::deduplicated_input_hashes, blender::fn::FieldTreeInfo::deduplicated_inputs, blender::fn::FieldTreeInfo::deep_hashes, blender::Default, blender::CPPType::default_construct_indices(), blender::CPPType::destruct_indices(), evaluate_fields(), find_varying_fields(), blender::GVArray::from_empty(), blender::GVArray::from_single_ref(), blender::GVArray::from_span(), get_field_context_inputs(), blender::GVMutableArray::get_internal_span(), hash, blender::Span< T >::index_range(), blender::Vector< T, InlineBufferCapacity, Allocator >::index_range(), blender::Span< T >::is_empty(), blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), blender::GVArrayCommon::is_span(), blender::CPPType::is_trivially_destructible, blender::fn::FieldHashDeep::lookup(), blender::threading::parallel_for(), preprocess_field_tree(), PRF_scope, blender::GVArrayCommon::size(), blender::Span< T >::size(), T, blender::GMutableSpan::take_front(), blender::GVArrayCommon::type(), blender::v, and blender::fn::GFieldRef::variant().
Referenced by blender::fn::FieldEvaluator::evaluate(), evaluate_constant_field(), evaluate_fields(), evaluate_selection(), and blender::fn::tests::TEST_F().
|
static |
Definition at line 580 of file field_evaluation.cc.
References evaluate_fields(), evaluate_selection(), and index_mask_from_selection().
Referenced by blender::fn::FieldEvaluator::evaluate(), and evaluate_selection().
|
static |
Definition at line 120 of file field_evaluation.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), blender::fn::FieldTreeInfo::deduplicated_input_hashes, blender::fn::FieldTreeInfo::deduplicated_inputs, blender::fn::FieldTreeInfo::field_users, find_varying_fields(), blender::Stack< T, InlineBufferCapacity, Allocator >::is_empty(), blender::GVArrayCommon::is_single(), blender::Stack< T, InlineBufferCapacity, Allocator >::pop(), and blender::Stack< T, InlineBufferCapacity, Allocator >::push().
Referenced by evaluate_fields(), and find_varying_fields().
|
static |
Retrieves the data from the context that is passed as input into the field.
Definition at line 98 of file field_evaluation.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::fn::FieldInput::cpp_type(), blender::GVArray::from_single_default(), and get_field_context_inputs().
Referenced by evaluate_fields(), and get_field_context_inputs().
|
static |
Definition at line 541 of file field_evaluation.cc.
References blender::ResourceScope::allocator(), blender::IndexMask::from_bools(), and index_mask_from_selection().
Referenced by evaluate_selection(), blender::fn::FieldEvaluator::get_evaluated_as_mask(), and index_mask_from_selection().
Definition at line 564 of file field.cc.
References blender::fn::FieldOperation::from(), blender::fn::GField::GField(), invert_boolean_field(), and blender::fn::multi_function::registry::lookup().
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().
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 522 of file field_evaluation.cc.
References BUFFER_FOR_CPP_TYPE_VALUE, blender::fn::GField::cpp_type(), blender::fn::GField::depends_on_input(), blender::CPPType::destruct(), evaluate_constant_field(), blender::fn::GField::from_constant(), and make_field_constant_if_possible().
Referenced by make_field_constant_if_possible().
|
inline |
Definition at line 549 of file FN_field.hh.
References b, and operator==().
|
inline |
Definition at line 703 of file FN_field.hh.
References b, and operator==().
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.
Referenced by operator==(), operator==(), and operator==().
Definition at line 419 of file field.cc.
References b, BLI_assert_unreachable_static_t, operator==(), T, and blender::fn::GFieldRef::variant().
|
static |
Collects some information from the field tree that is required by later steps.
Definition at line 49 of file field_evaluation.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), BLI_assert_unreachable_static_t, blender::fn::FieldTreeInfo::deduplicated_input_hashes, blender::fn::FieldTreeInfo::deduplicated_inputs, blender::fn::FieldTreeInfo::deep_hashes, blender::Default, blender::fn::FieldHashDeep::ensure(), blender::fn::FieldTreeInfo::field_users, hash, blender::Stack< T, InlineBufferCapacity, Allocator >::is_empty(), blender::fn::FieldHashDeep::lookup(), blender::Stack< T, InlineBufferCapacity, Allocator >::pop(), preprocess_field_tree(), PRF_scope, blender::Stack< T, InlineBufferCapacity, Allocator >::push(), T, blender::v, and blender::fn::GFieldRef::variant().
Referenced by evaluate_fields(), and preprocess_field_tree().
Type trait to detect field types.
Definition at line 425 of file FN_field.hh.
Referenced by blender::nodes::socket_type_info_by_static_type().
|
constexpr |
Definition at line 426 of file FN_field.hh.