|
Blender V4.3
|
#include <BLI_virtual_array.hh>
Inherited by blender::VArray< T >, and blender::VMutableArray< T >.
Public Member Functions | |
| operator bool () const | |
| T | operator[] (const int64_t index) const |
| T | get (const int64_t index) const |
| int64_t | size () const |
| T | first () const |
| T | last (const int64_t n=0) const |
| bool | is_empty () const |
| IndexRange | index_range () const |
| CommonVArrayInfo | common_info () const |
| bool | is_span () const |
| Span< T > | get_internal_span () const |
| bool | is_single () const |
| T | get_internal_single () const |
| std::optional< T > | get_if_single () const |
| void | materialize (MutableSpan< T > r_span) const |
| void | materialize (const IndexMask &mask, MutableSpan< T > r_span) const |
| void | materialize_to_uninitialized (MutableSpan< T > r_span) const |
| void | materialize_to_uninitialized (const IndexMask &mask, MutableSpan< T > r_span) const |
| void | materialize_compressed (const IndexMask &mask, MutableSpan< T > r_span) const |
| void | materialize_compressed_to_uninitialized (const IndexMask &mask, MutableSpan< T > r_span) const |
| bool | try_assign_GVArray (GVArray &varray) const |
| const VArrayImpl< T > * | get_implementation () const |
Protected Types | |
| using | Storage = Any<blender::detail::VArrayAnyExtraInfo<T>, 24, 8> |
Protected Member Functions | |
| VArrayCommon ()=default | |
| VArrayCommon (const VArrayCommon &other) | |
| VArrayCommon (VArrayCommon &&other) noexcept | |
| VArrayCommon (const VArrayImpl< T > *impl) | |
| VArrayCommon (std::shared_ptr< const VArrayImpl< T > > impl) | |
| template<typename ImplT , typename... Args> | |
| void | emplace (Args &&...args) |
| void | copy_from (const VArrayCommon &other) |
| void | move_from (VArrayCommon &&other) noexcept |
| const VArrayImpl< T > * | impl_from_storage () const |
Protected Attributes | |
| const VArrayImpl< T > * | impl_ = nullptr |
| Storage | storage_ |
Utility class to reduce code duplication for methods available on #VArray and #VMutableArray. Deriving #VMutableArray from #VArray would have some issues:
Definition at line 496 of file BLI_virtual_array.hh.
|
protected |
Store the virtual array implementation in an #Any. This makes it easy to avoid a memory allocation if the implementation is small enough and is copyable. This is the case for the most common virtual arrays. Other virtual array implementations are typically stored as #std::shared_ptr. That works even when the implementation itself is not copyable and makes copying VArrayCommon cheaper.
Definition at line 505 of file BLI_virtual_array.hh.
|
protecteddefault |
|
inlineprotected |
Copy constructor.
Definition at line 524 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::impl_, and blender::VArrayCommon< T >::impl_from_storage().
|
inlineprotectednoexcept |
Move constructor.
Definition at line 530 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::impl_, and blender::VArrayCommon< T >::impl_from_storage().
|
inlineprotected |
Wrap an existing #VArrayImpl and don't take ownership of it. This should rarely be used in practice.
Definition at line 541 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::impl_, and blender::VArrayCommon< T >::storage_.
|
inlineprotected |
Wrap an existing #VArrayImpl that is contained in a #std::shared_ptr. This takes ownership.
Definition at line 549 of file BLI_virtual_array.hh.
References impl, and blender::VArrayCommon< T >::storage_.
|
inline |
Definition at line 676 of file BLI_virtual_array.hh.
References BLI_assert, and blender::VArrayCommon< T >::impl_.
Referenced by blender::array_utils::booleans_mix_calc(), blender::GVArrayImpl_For_VArray< T >::common_info(), blender::GVMutableArrayImpl_For_VMutableArray< T >::common_info(), blender::ed::curves::contains(), blender::array_utils::count_booleans(), blender::VArrayDevirtualizer< T, UseSingle, UseSpan >::devirtualize(), blender::index_mask::IndexMask::from_bools(), blender::GVMutableArray::GVMutableArray(), blender::VArraySpan< T >::VArraySpan(), and blender::VArraySpan< T >::VArraySpan().
|
inlineprotected |
Utility to implement a copy assignment operator in a subclass.
Definition at line 579 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::impl_, blender::VArrayCommon< T >::impl_from_storage(), and blender::VArrayCommon< T >::storage_.
Referenced by blender::VMutableArray< float >::operator VArray< float >(), blender::VArray< T >::operator=(), and blender::VMutableArray< T >::operator=().
|
inlineprotected |
Replace the contained #VArrayImpl.
Definition at line 559 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::emplace(), blender::VArrayCommon< T >::impl_, ptr, and blender::VArrayCommon< T >::storage_.
Referenced by blender::VArrayCommon< T >::emplace(), blender::VArray< T >::For(), blender::VMutableArray< T >::For(), blender::VArray< T >::VArray(), and blender::VArray< T >::VArray().
|
inline |
Get the first element.
Definition at line 653 of file BLI_virtual_array.hh.
|
inline |
Same as the operator[] but is sometimes easier to use when one has a pointer to a virtual array.
Definition at line 634 of file BLI_virtual_array.hh.
Referenced by blender::modifier::greasepencil::get_filtered_layer_mask(), blender::modifier::greasepencil::get_filtered_stroke_mask(), blender::fn::tests::TEST(), blender::fn::tests::TEST(), blender::tests::TEST(), and blender::tests::TEST().
|
inline |
Return the value that is returned for every index, if the array is stored as a single value.
Definition at line 723 of file BLI_virtual_array.hh.
References blender::CommonVArrayInfo::data, blender::VArrayCommon< T >::impl_, blender::CommonVArrayInfo::Single, and blender::CommonVArrayInfo::type.
Referenced by blender::nodes::node_geo_duplicate_elements_cc::accumulate_counts_to_offsets(), blender::ed::greasepencil::attributes_elements_are_equal(), blender::nodes::node_fn_combine_transform_cc::CombineTransformFunction::call(), blender::nodes::node_fn_separate_matrix_cc::SeparateMatrixFunction::call(), blender::io::usd::copy_blender_buffer_to_primvar(), blender::ed::greasepencil::extrude_grease_pencil_curves(), blender::index_mask::IndexMask::from_group_ids(), blender::geometry::gather_attributes_to_propagate(), blender::ed::greasepencil::grease_pencil_material_lock_unselected_exec(), and blender::nodes::node_geo_material_selection_cc::select_by_material().
|
inline |
Definition at line 773 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::impl_.
|
inline |
Return the value that is returned for every index. This invokes undefined behavior if the virtual array would not return the same value for every index.
Definition at line 713 of file BLI_virtual_array.hh.
References BLI_assert, blender::CommonVArrayInfo::data, blender::VArrayCommon< T >::impl_, and blender::VArrayCommon< T >::is_single().
Referenced by blender::nodes::node_geo_instance_on_points_cc::add_instances_from_component(), BKE_mesh_material_index_used(), BKE_sculpt_sync_face_visibility_to_grids(), blender::io::obj::OBJMesh::calc_face_order(), blender::geometry::convert_curves_to_nurbs(), corner_tris_no_hidden_map_get(), blender::ed::curves::duplicate_points(), blender::fn::FieldEvaluator::get_evaluated_as_mask(), blender::nodes::node_geo_input_curve_handles_cc::HandlePositionFieldInput::get_varray_for_context(), blender::bke::mesh_hide_face_flush(), blender::bke::mesh_hide_vert_flush(), blender::bke::mesh_select_edge_flush(), blender::bke::mesh_select_face_flush(), blender::bke::mesh_select_vert_flush(), blender::ed::curves::retrieve_selected_curves(), blender::nodes::node_geo_curve_subdivide_cc::subdivide_curves(), blender::nodes::node_geo_curve_subdivide_cc::subdivide_grease_pencil_curves(), and blender::tests::TEST().
|
inline |
Returns the internally used span of the virtual array. This invokes undefined behavior if the virtual array is not stored as a span internally.
Definition at line 694 of file BLI_virtual_array.hh.
References BLI_assert, blender::CommonVArrayInfo::data, blender::VArrayCommon< T >::impl_, and blender::VArrayCommon< T >::is_span().
Referenced by blender::nodes::node_geo_mesh_to_points_cc::geometry_set_mesh_to_points(), blender::geometry::preprocess_pointclouds(), blender::ed::sculpt_paint::greasepencil::simplify_stroke(), blender::tests::TEST(), and blender::ed::sculpt_paint::greasepencil::trim_stroke_ends().
|
inlineprotected |
Get a pointer to the virtual array implementation that is currently stored in storage_, or null.
Definition at line 602 of file BLI_virtual_array.hh.
References blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::extra_info(), blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::get(), blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::has_value(), and blender::VArrayCommon< T >::storage_.
Referenced by blender::VArrayCommon< T >::copy_from(), blender::VArrayCommon< T >::move_from(), blender::VArrayCommon< T >::VArrayCommon(), and blender::VArrayCommon< T >::VArrayCommon().
|
inline |
Definition at line 671 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::size().
Referenced by blender::array_utils::booleans_mix_calc(), blender::array_utils::copy(), blender::bke::copy_with_checked_indices(), blender::nodes::node_geo_sample_index_cc::copy_with_clamped_indices(), blender::array_utils::count_booleans(), blender::index_mask::IndexMask::from_bools(), blender::ed::greasepencil::grease_pencil_weight_invert_exec(), blender::bke::mesh_select_edge_flush(), blender::bke::mesh_select_vert_flush(), paintface_reveal(), and blender::nodes::node_geo_interpolate_curves_cc::separate_guides_by_group().
|
inline |
True when the size is zero or when there is no virtual array.
Definition at line 666 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::size().
Referenced by blender::array_utils::booleans_mix_calc(), blender::nodes::node_shader_tex_gabor_cc::GaborNoiseFunction::call(), blender::array_utils::count_booleans(), blender::io::ply::load_plydata(), blender::ed::sculpt_paint::greasepencil::EraseOperation::on_stroke_done(), and blender::tests::TEST().
|
inline |
Return true when the virtual array returns the same value for every index.
Definition at line 702 of file BLI_virtual_array.hh.
References BLI_assert, blender::VArrayCommon< T >::impl_, blender::CommonVArrayInfo::Single, and blender::CommonVArrayInfo::type.
Referenced by blender::nodes::node_geo_instance_on_points_cc::add_instances_from_component(), BKE_mesh_material_index_used(), BKE_sculpt_sync_face_visibility_to_grids(), blender::io::obj::OBJMesh::calc_face_order(), blender::geometry::convert_curves_to_nurbs(), corner_tris_no_hidden_map_get(), blender::nodes::node_geo_points_to_curves_cc::curve_from_points(), blender::nodes::node_geo_points_to_curves_cc::curves_from_points(), blender::nodes::node_geo_curve_fill_cc::do_group_aware_cdt(), blender::ed::curves::duplicate_points(), everything_selected(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_edges(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_face_regions(), blender::fn::FieldEvaluator::get_evaluated_as_mask(), blender::VArrayCommon< T >::get_internal_single(), blender::io::usd::get_loops_polys(), blender::nodes::node_geo_curve_topology_points_of_curve_cc::PointsOfCurveInput::get_varray_for_context(), blender::nodes::node_geo_input_curve_handles_cc::HandlePositionFieldInput::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::bke::mesh_hide_face_flush(), blender::bke::mesh_hide_vert_flush(), blender::bke::mesh_select_edge_flush(), blender::bke::mesh_select_face_flush(), blender::bke::mesh_select_vert_flush(), blender::nodes::node_geo_sort_elements_cc::sorted_indices(), blender::nodes::node_geo_curve_subdivide_cc::subdivide_curves(), blender::nodes::node_geo_curve_subdivide_cc::subdivide_grease_pencil_curves(), blender::tests::TEST(), and blender::tests::TEST().
|
inline |
Return true when the virtual array is stored as a span internally.
Definition at line 683 of file BLI_virtual_array.hh.
References BLI_assert, blender::VArrayCommon< T >::impl_, blender::CommonVArrayInfo::Span, and blender::CommonVArrayInfo::type.
Referenced by blender::deform_drawing(), blender::nodes::node_geo_mesh_to_points_cc::geometry_set_mesh_to_points(), blender::VArrayCommon< T >::get_internal_span(), blender::VMutableArray< T >::get_internal_span(), blender::ed::greasepencil::grease_pencil_stroke_smooth_exec(), blender::ed::sculpt_paint::greasepencil::simplify_stroke(), blender::ed::sculpt_paint::greasepencil::smooth_stroke(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), and blender::ed::sculpt_paint::greasepencil::trim_stroke_ends().
|
inline |
Get the nth last element.
Definition at line 660 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::size().
|
inline |
Copy some indices of the virtual array into a span.
Definition at line 739 of file BLI_virtual_array.hh.
References BLI_assert, blender::MutableSpan< T >::data(), and blender::VArrayCommon< T >::impl_.
|
inline |
Copy the entire virtual array into a span.
Definition at line 733 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::materialize(), and blender::VArrayCommon< T >::size().
Referenced by blender::draw::create_edit_points_selection(), blender::nodes::node_geo_points_to_curves_cc::curves_from_points(), ED_mesh_split_faces(), blender::geometry::execute_realize_curve_task(), blender::geometry::execute_realize_pointcloud_task(), blender::ed::sculpt_paint::float_selection_ensure(), blender::ed::geometry::geometry_attribute_convert_exec(), blender::draw::grease_pencil_weight_batch_ensure(), blender::GVArrayImpl_For_VArray< T >::materialize(), blender::GVMutableArrayImpl_For_VMutableArray< T >::materialize(), blender::VArrayCommon< T >::materialize(), paintface_flush_flags(), paintvert_flush_flags(), and blender::nodes::node_geo_set_id_cc::set_id_in_component().
|
inline |
Copy some elements of the virtual array into a span.
Definition at line 757 of file BLI_virtual_array.hh.
References blender::MutableSpan< T >::data(), and blender::VArrayCommon< T >::impl_.
Referenced by blender::geometry::calculate_result_offsets(), blender::geometry::calculate_result_offsets(), blender::geometry::fillet_curves(), blender::array_utils::gather_group_to_group(), blender::nodes::node_geo_curve_topology_points_of_curve_cc::PointsOfCurveInput::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::GVArrayImpl_For_VArray< T >::materialize_compressed(), blender::GVMutableArrayImpl_For_VMutableArray< T >::materialize_compressed(), and blender::tests::TEST().
|
inline |
Definition at line 762 of file BLI_virtual_array.hh.
References blender::MutableSpan< T >::data(), and blender::VArrayCommon< T >::impl_.
Referenced by blender::GVArrayImpl_For_VArray< T >::materialize_compressed_to_uninitialized(), blender::GVMutableArrayImpl_For_VMutableArray< T >::materialize_compressed_to_uninitialized(), and blender::tests::TEST().
|
inline |
Definition at line 750 of file BLI_virtual_array.hh.
References BLI_assert, blender::MutableSpan< T >::data(), and blender::VArrayCommon< T >::impl_.
|
inline |
Definition at line 745 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::materialize_to_uninitialized(), and blender::VArrayCommon< T >::size().
Referenced by blender::GVArrayImpl_For_VArray< T >::materialize_to_uninitialized(), blender::GVMutableArrayImpl_For_VMutableArray< T >::materialize_to_uninitialized(), blender::VArrayCommon< T >::materialize_to_uninitialized(), and blender::VArraySpan< T >::VArraySpan().
|
inlineprotectednoexcept |
Utility to implement a move assignment operator in a subclass.
Definition at line 589 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::impl_, blender::VArrayCommon< T >::impl_from_storage(), and blender::VArrayCommon< T >::storage_.
Referenced by blender::VMutableArray< float >::operator VArray< float >(), blender::VArray< T >::operator=(), and blender::VMutableArray< T >::operator=().
|
inline |
Return false when there is no virtual array implementation currently.
Definition at line 612 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::impl_.
|
inline |
Get the element at a specific index.
Definition at line 622 of file BLI_virtual_array.hh.
References BLI_assert, blender::VArrayCommon< T >::impl_, and blender::VArrayCommon< T >::size().
|
inline |
Return the size of the virtual array. It's allowed to call this method even when there is no virtual array. In this case 0 is returned.
Definition at line 643 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::impl_.
Referenced by blender::array_utils::booleans_mix_calc(), collect_vertex_counts_per_poly(), blender::ed::greasepencil::compute_topology_change(), blender::ed::curves::contains(), blender::array_utils::copy(), blender::io::usd::copy_blender_buffer_to_primvar(), blender::array_utils::count_booleans(), blender::array_utils::count_booleans(), blender::ed::greasepencil::create_curves_outline(), blender::nodes::node_geo_points_to_curves_cc::curve_from_points(), blender::deform_drawing_as_envelope(), blender::VArrayDevirtualizer< T, UseSingle, UseSpan >::devirtualize(), blender::nodes::node_geo_curve_fill_cc::do_group_aware_cdt(), blender::VArray< T >::ForSingle(), blender::index_mask::IndexMask::from_bools(), blender::index_mask::IndexMask::from_group_ids(), blender::index_mask::IndexMask::from_group_ids(), blender::nodes::node_geo_mesh_to_points_cc::geometry_set_mesh_to_points(), blender::fn::FieldEvaluator::get_evaluated_as_mask(), blender::ed::greasepencil::grease_pencil_weight_invert_exec(), blender::GVMutableArray::GVMutableArray(), blender::VArrayCommon< T >::index_range(), blender::VArrayCommon< T >::is_empty(), blender::VArrayCommon< T >::last(), blender::VArrayCommon< T >::materialize(), blender::VArrayCommon< T >::materialize_to_uninitialized(), blender::VArrayCommon< T >::operator[](), blender::VMutableArray< T >::set(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::geometry::trim_curves(), blender::ed::sculpt_paint::greasepencil::trim_end_points(), blender::VArray< T >::VArray(), blender::VArraySpan< T >::VArraySpan(), and blender::VArraySpan< T >::VArraySpan().
|
inline |
See #GVArrayImpl::try_assign_GVArray.
Definition at line 768 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::impl_.
|
protected |
Pointer to the currently contained virtual array implementation. This is allowed to be null.
Definition at line 510 of file BLI_virtual_array.hh.
Referenced by blender::VArrayCommon< T >::common_info(), blender::VArrayCommon< T >::copy_from(), blender::VArrayCommon< T >::emplace(), blender::VArrayCommon< T >::get_if_single(), blender::VArrayCommon< T >::get_implementation(), blender::VArrayCommon< T >::get_internal_single(), blender::VArrayCommon< T >::get_internal_span(), blender::VArrayCommon< T >::is_single(), blender::VArrayCommon< T >::is_span(), blender::VArrayCommon< T >::materialize(), blender::VArrayCommon< T >::materialize_compressed(), blender::VArrayCommon< T >::materialize_compressed_to_uninitialized(), blender::VArrayCommon< T >::materialize_to_uninitialized(), blender::VArrayCommon< T >::move_from(), blender::VArrayCommon< T >::operator bool(), blender::VArrayCommon< T >::operator[](), blender::VArrayCommon< T >::size(), blender::VArrayCommon< T >::try_assign_GVArray(), blender::VArrayCommon< T >::VArrayCommon(), blender::VArrayCommon< T >::VArrayCommon(), and blender::VArrayCommon< T >::VArrayCommon().
|
protected |
Does the memory management for the virtual array implementation. It contains one of the following:
Definition at line 518 of file BLI_virtual_array.hh.
Referenced by blender::VArrayCommon< T >::copy_from(), blender::VArrayCommon< T >::emplace(), blender::VArrayCommon< T >::impl_from_storage(), blender::VArrayCommon< T >::move_from(), blender::VArrayCommon< T >::VArrayCommon(), and blender::VArrayCommon< T >::VArrayCommon().