Blender V4.3
blender::fn::FieldEvaluator Class Reference

#include <FN_field.hh>

Inherits blender::NonMovable, and blender::NonCopyable.

Public Member Functions

 FieldEvaluator (const FieldContext &context, const IndexMask *mask)
 
 FieldEvaluator (const FieldContext &context, const int64_t size)
 
 ~FieldEvaluator ()
 
void set_selection (Field< bool > selection)
 
template<typename T >
int add_with_destination (Field< T > field, VMutableArray< T > dst)
 
template<typename T >
int add_with_destination (Field< T > field, MutableSpan< T > dst)
 
template<typename T >
int add (Field< T > field, VArray< T > *varray_ptr)
 
const GVArrayget_evaluated (const int field_index) const
 
template<typename T >
VArray< Tget_evaluated (const int field_index)
 
#FieldEvaluator
int add_with_destination (GField field, GVMutableArray dst)
 
int add_with_destination (GField field, GMutableSpan dst)
 
int add (GField field, GVArray *varray_ptr)
 
int add (GField field)
 
void evaluate ()
 
IndexMask get_evaluated_selection_as_mask () const
 
IndexMask get_evaluated_as_mask (int field_index)
 

Detailed Description

Utility class that makes it easier to evaluate fields.

Definition at line 338 of file FN_field.hh.

Constructor & Destructor Documentation

◆ FieldEvaluator() [1/2]

blender::fn::FieldEvaluator::FieldEvaluator ( const FieldContext & context,
const IndexMask * mask )
inline

Takes #mask by pointer because the mask has to live longer than the evaluator.

Definition at line 360 of file FN_field.hh.

◆ FieldEvaluator() [2/2]

blender::fn::FieldEvaluator::FieldEvaluator ( const FieldContext & context,
const int64_t size )
inline

Construct a field evaluator for all indices less than #size.

Definition at line 366 of file FN_field.hh.

◆ ~FieldEvaluator()

blender::fn::FieldEvaluator::~FieldEvaluator ( )
inline

Definition at line 371 of file FN_field.hh.

References BLI_assert.

Member Function Documentation

◆ add() [1/3]

template<typename T >
int blender::fn::FieldEvaluator::add ( Field< T > field,
VArray< T > * varray_ptr )
inline
Parameters
fieldField to add to the evaluator.
varray_ptrOnce evaluate is called, the resulting virtual array will be will be assigned to the given position.
Returns
Index of the field in the evaluator which can be used in the get_evaluated methods.

Definition at line 429 of file FN_field.hh.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), and blender::Vector< T, InlineBufferCapacity, Allocator >::append_and_get_index().

◆ add() [2/3]

int blender::fn::FieldEvaluator::add ( GField field)
Returns
Index of the field in the evaluator which can be used in the get_evaluated methods.

Definition at line 767 of file field.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append().

◆ add() [3/3]

int blender::fn::FieldEvaluator::add ( GField field,
GVArray * varray_ptr )

Definition at line 756 of file field.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append().

Referenced by blender::nodes::node_geo_uv_pack_islands_cc::construct_uv_gvarray(), blender::nodes::node_geo_uv_unwrap_cc::construct_uv_gvarray(), blender::nodes::node_geo_points_to_curves_cc::curves_from_points(), blender::nodes::node_geo_split_to_instances_cc::do_common_split(), blender::nodes::node_geo_curve_fill_cc::do_group_aware_cdt(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_edges(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_faces(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_points_mesh(), blender::nodes::node_geo_points_to_vertices_cc::geometry_set_points_to_vertices(), blender::nodes::node_geo_merge_layers_cc::get_layers_map_by_id(), blender::nodes::node_geo_merge_layers_cc::get_layers_map_by_name(), blender::bke::EvaluateAtIndexInput::get_varray_for_context(), blender::nodes::node_geo_accumulate_field_cc::AccumulateFieldInput::get_varray_for_context(), blender::nodes::node_geo_accumulate_field_cc::TotalFieldInput::get_varray_for_context(), blender::nodes::node_geo_blur_attribute_cc::BlurAttributeFieldInput::get_varray_for_context(), blender::nodes::node_geo_curve_endpoint_selection_cc::EndpointFieldInput::get_varray_for_context(), blender::nodes::node_geo_curve_topology_points_of_curve_cc::PointsOfCurveInput::get_varray_for_context(), blender::nodes::node_geo_edge_paths_to_selection_cc::PathToEdgeSelectionFieldInput::get_varray_for_context(), blender::nodes::node_geo_edges_to_face_groups_cc::FaceSetFromBoundariesInput::get_varray_for_context(), blender::nodes::node_geo_index_of_nearest_cc::HasNeighborFieldInput::get_varray_for_context(), blender::nodes::node_geo_index_of_nearest_cc::IndexOfNearestFieldInput::get_varray_for_context(), blender::nodes::node_geo_input_curve_handles_cc::HandlePositionFieldInput::get_varray_for_context(), blender::nodes::node_geo_input_mesh_face_is_planar_cc::PlanarFieldInput::get_varray_for_context(), blender::nodes::node_geo_input_shortest_edge_paths_cc::ShortestEdgePathsCostFieldInput::get_varray_for_context(), blender::nodes::node_geo_input_shortest_edge_paths_cc::ShortestEdgePathsNextVertFieldInput::get_varray_for_context(), blender::nodes::node_geo_mesh_face_group_boundaries_cc::BoundaryFieldInput::get_varray_for_context(), blender::nodes::node_geo_mesh_topology_corners_of_edge_cc::CornersOfEdgeInput::get_varray_for_context(), blender::nodes::node_geo_mesh_topology_corners_of_face_cc::CornersOfFaceInput::get_varray_for_context(), blender::nodes::node_geo_mesh_topology_corners_of_vertex_cc::CornersOfVertInput::get_varray_for_context(), blender::nodes::node_geo_mesh_topology_edges_of_vertex_cc::EdgesOfVertInput::get_varray_for_context(), blender::nodes::node_geo_mesh_topology_offset_corner_in_face_cc::OffsetCornerInFaceFieldInput::get_varray_for_context(), blender::nodes::node_geo_offset_point_in_curve_cc::ControlPointNeighborFieldInput::get_varray_for_context(), blender::nodes::node_geo_offset_point_in_curve_cc::OffsetValidFieldInput::get_varray_for_context(), blender::nodes::node_geo_proximity_cc::ProximityFunction::init_for_mesh(), blender::nodes::node_geo_merge_by_distance_cc::mesh_merge_by_distance_all(), blender::nodes::node_geo_attribute_statistic_cc::node_geo_exec(), blender::nodes::node_geo_edge_paths_to_curves_cc::node_geo_exec(), blender::nodes::node_geo_flip_faces_cc::node_geo_exec(), blender::nodes::node_geo_mesh_to_curve_cc::node_geo_exec(), blender::nodes::node_geo_realize_instances_cc::node_geo_exec(), blender::nodes::node_geo_sample_index_cc::node_geo_exec(), blender::nodes::node_geo_triangulate_cc::node_geo_exec(), blender::nodes::node_geo_sample_nearest_surface_cc::SampleNearestSurfaceFunction::SampleNearestSurfaceFunction(), blender::geometry::separate_mesh_selection(), and blender::nodes::node_geo_sort_elements_cc::sorted_indices().

◆ add_with_destination() [1/4]

template<typename T >
int blender::fn::FieldEvaluator::add_with_destination ( Field< T > field,
MutableSpan< T > dst )
inline
Parameters
fieldField to add to the evaluator.
dstMutable span that the evaluated result for this field is be written into.
Note
When the output may only be used as a single value, the version of this function with a virtual array result array should be used.

Definition at line 416 of file FN_field.hh.

References add_with_destination().

◆ add_with_destination() [2/4]

template<typename T >
int blender::fn::FieldEvaluator::add_with_destination ( Field< T > field,
VMutableArray< T > dst )
inline

Same as add_with_destination but typed.

Definition at line 397 of file FN_field.hh.

References add_with_destination().

◆ add_with_destination() [3/4]

int blender::fn::FieldEvaluator::add_with_destination ( GField field,
GMutableSpan dst )
Parameters
fieldField to add to the evaluator.
dstMutable span that the evaluated result for this field is be written into.
Note
When the output may only be used as a single value, the version of this function with a virtual array result array should be used.

Definition at line 751 of file field.cc.

References add_with_destination(), and blender::GVMutableArray::ForSpan().

◆ add_with_destination() [4/4]

◆ evaluate()

◆ get_evaluated() [1/2]

template<typename T >
VArray< T > blender::fn::FieldEvaluator::get_evaluated ( const int field_index)
inline

Definition at line 456 of file FN_field.hh.

References get_evaluated(), and blender::GVArray::typed().

◆ get_evaluated() [2/2]

◆ get_evaluated_as_mask()

IndexMask blender::fn::FieldEvaluator::get_evaluated_as_mask ( int field_index)

Retrieve the output of an evaluated boolean field and convert it to a mask, which can be used to avoid calculations for unnecessary elements later on. The evaluator will own the indices in some cases, so it must live at least as long as the returned mask.

Definition at line 809 of file field.cc.

References get_evaluated(), blender::VArrayCommon< T >::get_internal_single(), blender::fn::index_mask_from_selection(), blender::VArrayCommon< T >::is_single(), blender::VArrayCommon< T >::size(), and blender::GVArray::typed().

Referenced by blender::nodes::node_geo_flip_faces_cc::node_geo_exec().

◆ get_evaluated_selection_as_mask()

◆ set_selection()

void blender::fn::FieldEvaluator::set_selection ( Field< bool > selection)
inline

The selection field is evaluated first to determine which indices of the other fields should be evaluated. Calling this method multiple times will just replace the previously set selection field. Only the elements selected by both this selection and the selection provided in the constructor are calculated. If no selection field is set, it is assumed that all indices passed to the constructor are selected.

Definition at line 385 of file FN_field.hh.

Referenced by blender::nodes::node_geo_distribute_points_on_faces_cc::calc_full_density_factors_with_selection(), blender::nodes::node_geo_instances_to_points_cc::convert_instances_to_points(), blender::nodes::node_geo_curves_to_grease_pencil_cc::curve_instances_to_grease_pencil_layers(), blender::nodes::node_geo_curves_to_grease_pencil_cc::curves_to_grease_pencil_with_one_layer(), blender::geometry::delete_selected_instances(), blender::nodes::node_geo_split_to_instances_cc::do_common_split(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_faces(), blender::nodes::node_geo_extrude_mesh_cc::extrude_individual_mesh_faces(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_edges(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_face_regions(), blender::nodes::node_geo_mesh_to_points_cc::geometry_set_mesh_to_points(), blender::nodes::node_geo_edge_split_cc::node_geo_exec(), blender::nodes::node_geo_grease_pencil_to_curves_cc::node_geo_exec(), blender::nodes::node_geo_realize_instances_cc::node_geo_exec(), blender::nodes::node_geo_scale_elements_cc::node_geo_exec(), blender::nodes::node_geo_store_named_attribute_cc::node_geo_exec(), blender::nodes::node_geo_rotate_instances_cc::rotate_instances(), blender::nodes::node_geo_scale_instances_cc::scale_instances(), blender::geometry::separate_grease_pencil_layer_selection(), blender::nodes::node_geo_curve_set_handle_type_cc::set_handle_type(), blender::nodes::node_geo_set_id_cc::set_id_in_component(), blender::nodes::node_geo_set_position_cc::set_instances_position(), blender::nodes::node_geo_set_curve_handles_cc::set_position_in_component(), blender::nodes::node_geo_sort_elements_cc::sorted_indices(), and blender::nodes::node_geo_translate_instances_cc::translate_instances().


The documentation for this class was generated from the following files: