Blender
V3.3
|
#include <FN_field.hh>
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) |
int | add_with_destination (GField field, GVMutableArray dst) |
template<typename T > | |
int | add_with_destination (Field< T > field, VMutableArray< T > dst) |
int | add_with_destination (GField field, GMutableSpan dst) |
template<typename T > | |
int | add_with_destination (Field< T > field, MutableSpan< T > dst) |
int | add (GField field, GVArray *varray_ptr) |
template<typename T > | |
int | add (Field< T > field, VArray< T > *varray_ptr) |
int | add (GField field) |
void | evaluate () |
const GVArray & | get_evaluated (const int field_index) const |
template<typename T > | |
VArray< T > | get_evaluated (const int field_index) |
IndexMask | get_evaluated_selection_as_mask () |
IndexMask | get_evaluated_as_mask (int field_index) |
Utility class that makes it easier to evaluate fields.
Definition at line 319 of file FN_field.hh.
|
inline |
Takes mask by pointer because the mask has to live longer than the evaluator.
Definition at line 342 of file FN_field.hh.
|
inline |
Construct a field evaluator for all indices less than size.
Definition at line 348 of file FN_field.hh.
|
inline |
Definition at line 352 of file FN_field.hh.
References BLI_assert.
|
inline |
field | Field to add to the evaluator. |
varray_ptr | Once evaluate is called, the resulting virtual array will be will be assigned to the given position. |
Definition at line 410 of file FN_field.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::Vector< T, InlineBufferCapacity, Allocator >::append_and_get_index(), T, and UNUSED.
int blender::fn::FieldEvaluator::add | ( | GField | field | ) |
Definition at line 742 of file field.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append().
Definition at line 731 of file field.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), and UNUSED.
Referenced by blender::nodes::node_geo_uv_unwrap_cc::construct_uv_gvarray(), blender::nodes::node_geo_uv_pack_islands_cc::construct_uv_gvarray(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_faces(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_points_pointcloud(), blender::nodes::node_geo_scale_elements_cc::evaluate_axis_scale_fields(), blender::nodes::node_geo_scale_elements_cc::evaluate_uniform_scale_fields(), blender::nodes::node_geo_curve_trim_cc::geometry_set_curve_trim(), blender::nodes::node_geo_input_curve_handles_cc::HandlePositionFieldInput::get_varray_for_context(), blender::nodes::node_geo_accumulate_field_cc::AccumulateFieldInput< T >::get_varray_for_context(), blender::nodes::node_geo_accumulate_field_cc::TotalFieldInput< T >::get_varray_for_context(), blender::nodes::node_geo_flip_faces_cc::mesh_flip_faces(), blender::nodes::node_geo_curve_reverse_cc::node_geo_exec(), blender::nodes::node_geo_curve_subdivide_cc::node_geo_exec(), blender::nodes::node_geo_edge_split_cc::node_geo_exec(), and blender::nodes::node_geo_subdivision_surface_cc::node_geo_exec().
|
inline |
field | Field to add to the evaluator. |
dst | Mutable span that the evaluated result for this field is be written into. |
Definition at line 397 of file FN_field.hh.
References add_with_destination().
|
inline |
Same as add_with_destination but typed.
Definition at line 378 of file FN_field.hh.
References add_with_destination().
int blender::fn::FieldEvaluator::add_with_destination | ( | GField | field, |
GMutableSpan | dst | ||
) |
field | Field to add to the evaluator. |
dst | Mutable span that the evaluated result for this field is be written into. |
Definition at line 726 of file field.cc.
References add_with_destination(), and blender::GVMutableArray::ForSpan().
int blender::fn::FieldEvaluator::add_with_destination | ( | GField | field, |
GVMutableArray | dst | ||
) |
field | Field to add to the evaluator. |
dst | Mutable virtual array that the evaluated result for this field is be written into. |
Definition at line 718 of file field.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append().
Referenced by add_with_destination().
void blender::fn::FieldEvaluator::evaluate | ( | ) |
Evaluate all fields on the evaluator. This can only be called once.
Definition at line 763 of file field.cc.
References BLI_assert, BLI_assert_msg, blender::fn::evaluate_fields(), and blender::fn::evaluate_selection().
Referenced by blender::nodes::node_geo_duplicate_elements_cc::duplicate_faces(), blender::nodes::node_geo_scale_elements_cc::evaluate_axis_scale_fields(), blender::nodes::node_geo_scale_elements_cc::evaluate_uniform_scale_fields(), blender::nodes::node_geo_input_curve_handles_cc::HandlePositionFieldInput::get_varray_for_context(), and blender::nodes::node_geo_subdivision_surface_cc::node_geo_exec().
|
inline |
Definition at line 437 of file FN_field.hh.
References get_evaluated(), T, and blender::GVArray::typed().
|
inline |
Definition at line 431 of file FN_field.hh.
References BLI_assert.
Referenced by blender::nodes::node_geo_duplicate_elements_cc::duplicate_faces(), get_evaluated(), get_evaluated_as_mask(), blender::nodes::node_geo_input_curve_handles_cc::HandlePositionFieldInput::get_varray_for_context(), and blender::nodes::node_geo_subdivision_surface_cc::node_geo_exec().
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 784 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().
IndexMask blender::fn::FieldEvaluator::get_evaluated_selection_as_mask | ( | ) |
Definition at line 797 of file field.cc.
References BLI_assert.
Referenced by blender::nodes::node_geo_duplicate_elements_cc::duplicate_faces(), blender::nodes::node_geo_scale_elements_cc::evaluate_axis_scale_fields(), and blender::nodes::node_geo_scale_elements_cc::evaluate_uniform_scale_fields().
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 366 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_duplicate_elements_cc::duplicate_faces(), blender::nodes::node_geo_scale_elements_cc::evaluate_axis_scale_fields(), blender::nodes::node_geo_scale_elements_cc::evaluate_uniform_scale_fields(), blender::nodes::node_geo_set_spline_cyclic_cc::set_cyclic_in_component(), blender::nodes::node_geo_set_id_cc::set_id_in_component(), blender::nodes::node_geo_set_material_index_cc::set_material_index_in_component(), blender::nodes::node_geo_set_curve_handles_cc::set_position_in_component(), blender::nodes::node_geo_set_position_cc::set_position_in_component(), blender::nodes::node_geo_set_curve_radius_cc::set_radius_in_component(), blender::nodes::node_geo_set_point_radius_cc::set_radius_in_component(), blender::nodes::node_geo_set_spline_resolution_cc::set_resolution_in_component(), blender::nodes::node_geo_set_shade_smooth_cc::set_smooth_in_component(), and blender::nodes::node_geo_set_curve_tilt_cc::set_tilt_in_component().