Blender
V3.3
|
#include <BLI_index_range.hh>
Classes | |
class | Iterator |
Public Member Functions | |
constexpr | IndexRange ()=default |
constexpr | IndexRange (int64_t size) |
constexpr | IndexRange (int64_t start, int64_t size) |
constexpr Iterator | begin () const |
constexpr Iterator | end () const |
constexpr int64_t | operator[] (int64_t index) const |
constexpr int64_t | size () const |
constexpr bool | is_empty () const |
constexpr IndexRange | after (int64_t n) const |
constexpr IndexRange | before (int64_t n) const |
constexpr int64_t | first () const |
constexpr int64_t | last (const int64_t n=0) const |
constexpr int64_t | one_before_start () const |
constexpr int64_t | one_after_last () const |
constexpr int64_t | start () const |
constexpr bool | contains (int64_t value) const |
constexpr IndexRange | slice (int64_t start, int64_t size) const |
constexpr IndexRange | slice (IndexRange range) const |
constexpr IndexRange | drop_front (int64_t n) const |
constexpr IndexRange | drop_back (int64_t n) const |
constexpr IndexRange | take_front (int64_t n) const |
constexpr IndexRange | take_back (int64_t n) const |
constexpr IndexRange | shift (int64_t n) const |
Span< int64_t > | as_span () const |
Friends | |
constexpr friend bool | operator== (IndexRange a, IndexRange b) |
std::ostream & | operator<< (std::ostream &stream, IndexRange range) |
Definition at line 52 of file BLI_index_range.hh.
|
constexprdefault |
Referenced by after(), before(), drop_back(), drop_front(), shift(), slice(), take_back(), and take_front().
|
inlineexplicitconstexpr |
Definition at line 60 of file BLI_index_range.hh.
References BLI_assert, and size().
Definition at line 65 of file BLI_index_range.hh.
References BLI_assert, size(), and start().
|
inlineconstexpr |
Create a new range starting at the end of the current one.
Definition at line 163 of file BLI_index_range.hh.
References BLI_assert, and IndexRange().
Referenced by 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(), and blender::tests::TEST().
Get read-only access to a memory buffer that contains the range as actual numbers.
This is defined here, because in BLI_index_range.hh
Span
is not yet defined.
Definition at line 726 of file BLI_span.hh.
Referenced by blender::tests::TEST().
|
inlineconstexpr |
Create a new range that ends at the start of the current one.
Definition at line 172 of file BLI_index_range.hh.
References BLI_assert, and IndexRange().
Referenced by blender::tests::TEST().
|
inlineconstexpr |
Definition at line 116 of file BLI_index_range.hh.
Referenced by blender::tests::TEST().
Returns true when the range contains a certain number, otherwise false.
Definition at line 229 of file BLI_index_range.hh.
Referenced by blender::ui::BuildOnlyVisibleButtonsHelper::is_item_visible(), blender::bke::curves::bezier::segment_is_vector(), and blender::tests::TEST().
|
inlineconstexpr |
Returns a new IndexRange with n elements removed from the end of the range. This invokes undefined behavior when n is negative.
Definition at line 265 of file BLI_index_range.hh.
References BLI_assert, and IndexRange().
Referenced by blender::bke::curves::accumulate_counts_to_offsets(), blender::geometry::catmull_rom_to_bezier_handles(), blender::geometry::nurbs_to_bezier_assign(), blender::bke::curves::bezier::segment_is_vector(), blender::geometry::subdivide_bezier_positions(), and blender::length_parameterize::tests::test_uniform_lengths().
|
inlineconstexpr |
Returns a new IndexRange with n elements removed from the beginning of the range. This invokes undefined behavior when n is negative.
Definition at line 254 of file BLI_index_range.hh.
References BLI_assert, and IndexRange().
Referenced by blender::geometry::calculate_angles(), blender::geometry::catmull_rom_to_bezier_handles(), blender::geometry::edges_to_curve_point_indices(), blender::bke::curves::catmull_rom::evaluate_segment(), blender::bke::curves::bezier::linear_interpolation(), blender::geometry::linear_interpolation(), blender::ed::sculpt_paint::move_last_point_and_resample(), and blender::geometry::nurbs_to_bezier_assign().
|
inlineconstexpr |
Definition at line 121 of file BLI_index_range.hh.
|
inlineconstexpr |
Get the first element in the range. Asserts when the range is empty.
Definition at line 182 of file BLI_index_range.hh.
References BLI_assert, and size().
Referenced by blender::IndexMask::contained_in(), DRW_shgroup_curves_create_sub(), blender::threading::parallel_for(), blender::threading::parallel_reduce(), blender::geometry::point_merge_by_distance(), blender::geometry::subdivide_bezier_segment(), blender::tests::TEST(), and blender::ed::curves::convert_to_particle_system::try_convert_single_object().
|
inlineconstexpr |
Returns true if the size is zero.
Definition at line 155 of file BLI_index_range.hh.
Referenced by blender::tests::TEST().
Get the nth last element in the range. Asserts when the range is empty or when n is negative.
Definition at line 192 of file BLI_index_range.hh.
References BLI_assert, and size().
Referenced by blender::geometry::calculate_bezier_handles_bezier_mode(), blender::geometry::calculate_bezier_handles_poly_mode(), blender::bke::calculate_evaluated_offsets(), blender::geometry::calculate_fillet_positions(), blender::IndexMask::contained_in(), curve_create_curves_lines(), DRW_shgroup_curves_create_sub(), ED_spreadsheet_context_path_exists(), blender::ui::BuildOnlyVisibleButtonsHelper::fill_layout_after_visible(), blender::geometry::subdivide_bezier_segment(), and blender::tests::TEST().
|
inlineconstexpr |
Get the element one after the end. The returned value is undefined when the range is empty.
Definition at line 213 of file BLI_index_range.hh.
Referenced by blender::bke::CurvesGeometry::evaluated_points_for_curves(), blender::IndexMask::extract_ranges_invert(), blender::GVArrayImpl_For_SlicedGVArray::GVArrayImpl_For_SlicedGVArray(), blender::threading::parallel_for(), blender::threading::parallel_reduce(), blender::bke::CurvesGeometry::points_for_curves(), blender::geometry::subdivide_bezier_segment(), and blender::tests::TEST().
|
inlineconstexpr |
Get the element one before the beginning. The returned value is undefined when the range is empty, and the range must start after zero already.
Definition at line 204 of file BLI_index_range.hh.
References BLI_assert.
Referenced by blender::tests::TEST().
Access an element in the range.
Definition at line 129 of file BLI_index_range.hh.
References BLI_assert, and size().
|
inlineconstexpr |
Move the range forward or backward within the larger array. The amount may be negative, but its absolute value cannot be greater than the existing start of the range.
Definition at line 298 of file BLI_index_range.hh.
References IndexRange().
Referenced by blender::geometry::subdivide_bezier_segment().
|
inlineconstexpr |
Get the amount of numbers in the range.
Definition at line 147 of file BLI_index_range.hh.
Referenced by blender::nodes::node_geo_instance_on_points_cc::add_instances_from_component(), blender::bke::calculate_evaluated_offsets(), blender::bke::calculate_result_offsets(), blender::IndexMask::contained_in(), blender::bke::copy_between_buffers(), blender::nodes::node_geo_duplicate_elements_cc::copy_stable_id_faces(), blender::nodes::node_geo_extrude_mesh_cc::copy_with_mixing(), blender::bke::copy_with_removed_curves(), curve_create_curves_lines(), blender::geometry::curve_dst_offsets(), curve_eval_render_wire_verts_edges_len_get(), blender::bke::curve_to_mesh_sweep(), curves_batch_cache_fill_strands_data(), curves_to_curve_eval(), blender::nodes::node_geo_curve_fill_cc::do_cdt(), DRW_shgroup_curves_create_sub(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_faces(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_instances(), blender::bke::CurvesGeometry::evaluated_normals(), blender::fn::materialize_detail::execute_materialized_impl(), blender::IndexMask::extract_ranges_invert(), 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::ed::sculpt_paint::find_curves_brush_position(), first(), IndexRange(), blender::geometry::interpolate_position_with_interpolation(), blender::bke::CurvesGeometry::interpolate_to_evaluated(), blender::IndexMask::invert(), last(), blender::GVArrayImpl_For_SlicedGVArray::materialize_compressed_to_uninitialized(), operator[](), blender::threading::parallel_for(), blender::threading::parallel_reduce(), blender::GSpan::slice(), blender::GMutableSpan::slice(), blender::Span< T >::slice(), blender::MutableSpan< T >::slice(), blender::GVArray::slice(), slice(), blender::geometry::subdivide_bezier_segment(), blender::tests::TEST(), and blender::ed::curves::convert_to_particle_system::try_convert_single_object().
|
inlineconstexpr |
Definition at line 245 of file BLI_index_range.hh.
|
inlineconstexpr |
Returns a new range, that contains a sub-interval of the current one.
Definition at line 237 of file BLI_index_range.hh.
References BLI_assert, IndexRange(), size(), and start().
Referenced by slice(), blender::tests::TEST(), and blender::geometry::weld_poly_loop_ctx_alloc().
|
inlineconstexpr |
Get the first element in the range. The returned value is undefined when the range is empty.
Definition at line 221 of file BLI_index_range.hh.
Referenced by blender::bke::copy_between_buffers(), blender::geometry::curve_dst_offsets(), blender::bke::curve_to_mesh_sweep(), curves_batch_cache_fill_strands_data(), blender::bke::CurvesGeometry::evaluated_points_for_curves(), blender::IndexMask::extract_ranges_invert(), IndexRange(), blender::GVArrayImpl_For_SlicedGVArray::materialize_compressed_to_uninitialized(), blender::bke::CurvesGeometry::points_for_curves(), blender::GSpan::slice(), blender::GMutableSpan::slice(), blender::Span< T >::slice(), blender::MutableSpan< T >::slice(), slice(), and blender::tests::TEST().
|
inlineconstexpr |
Returns a new IndexRange that only contains the last n elements. This invokes undefined behavior when n is negative.
Definition at line 287 of file BLI_index_range.hh.
References BLI_assert, and IndexRange().
|
inlineconstexpr |
Returns a new IndexRange that only contains the first n elements. This invokes undefined behavior when n is negative.
Definition at line 276 of file BLI_index_range.hh.
References BLI_assert, and IndexRange().
|
friend |
Definition at line 308 of file BLI_index_range.hh.
|
friend |
Two ranges compare equal when they contain the same numbers.
Definition at line 139 of file BLI_index_range.hh.