From 5d9ade27de54b6910ed32f92d20d8f692959603c Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Sat, 2 Jul 2022 11:45:57 +0200 Subject: BLI: improve span access to virtual arrays * Make the class names more consistent. * Implement missing move-constructors and assignment-operators. --- .../nodes/geometry/nodes/node_geo_curve_sample.cc | 2 +- .../nodes/geometry/nodes/node_geo_curve_spline_type.cc | 6 +++--- .../nodes/geometry/nodes/node_geo_delete_geometry.cc | 8 ++++---- .../blender/nodes/geometry/nodes/node_geo_dual_mesh.cc | 2 +- .../geometry/nodes/node_geo_duplicate_elements.cc | 18 +++++++++--------- .../nodes/geometry/nodes/node_geo_join_geometry.cc | 2 +- .../geometry/nodes/node_geo_points_to_vertices.cc | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) (limited to 'source/blender/nodes') diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc index 9077b59254c..01cf1d8db52 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc @@ -135,7 +135,7 @@ class SampleCurveFunction : public fn::MultiFunction { } const VArray &lengths_varray = params.readonly_single_input(0, "Length"); - const VArray_Span lengths{lengths_varray}; + const VArraySpan lengths{lengths_varray}; #ifdef DEBUG for (const float length : lengths) { /* Lengths must be in range of the curve's total length. This is ensured in diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc index f846a6be53b..5c836391abe 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc @@ -410,8 +410,8 @@ static void convert_to_bezier(const CurveComponent &src_component, }; auto bezier_to_bezier = [&](IndexMask selection) { - const VArray_Span src_types_l = src_curves.handle_types_left(); - const VArray_Span src_types_r = src_curves.handle_types_right(); + const VArraySpan src_types_l = src_curves.handle_types_left(); + const VArraySpan src_types_r = src_curves.handle_types_right(); const Span src_handles_l = src_curves.handle_positions_left(); const Span src_handles_r = src_curves.handle_positions_right(); @@ -569,7 +569,7 @@ static void convert_to_nurbs(const CurveComponent &src_component, src_cyclic.get_internal_single() ? NURBS_KNOT_MODE_NORMAL : NURBS_KNOT_MODE_ENDPOINT); } else { - VArray_Span cyclic{src_cyclic}; + VArraySpan cyclic{src_cyclic}; MutableSpan knots_modes = dst_curves.nurbs_knots_modes_for_write(); threading::parallel_for(selection.index_range(), 1024, [&](IndexRange range) { for (const int i : selection.slice(range)) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc index 352411dd8f5..68489d1b9a6 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc @@ -69,7 +69,7 @@ static void copy_attributes(const Map &attributes attribute_math::convert_to_static_type(data_type, [&](auto dummy) { using T = decltype(dummy); - VArray_Span span{attribute.varray.typed()}; + VArraySpan span{attribute.varray.typed()}; MutableSpan out_span = result_attribute.as_span(); out_span.copy_from(span); }); @@ -109,7 +109,7 @@ static void copy_attributes_based_on_mask(const Map span{attribute.varray.typed()}; + VArraySpan span{attribute.varray.typed()}; MutableSpan out_span = result_attribute.as_span(); copy_data_based_on_mask(span, out_span, mask); }); @@ -145,7 +145,7 @@ static void copy_attributes_based_on_map(const Map span{attribute.varray.typed()}; + VArraySpan span{attribute.varray.typed()}; MutableSpan out_span = result_attribute.as_span(); copy_data_based_on_map(span, out_span, index_map); }); @@ -1067,7 +1067,7 @@ static void separate_mesh_selection(GeometrySet &geometry_set, return; } - const VArray_Span selection_span{selection}; + const VArraySpan selection_span{selection}; do_mesh_separation(geometry_set, src_component, selection_span, selection_domain, mode); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc index 52156b59c51..8a256a9b91b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc @@ -175,7 +175,7 @@ static void transfer_attributes( attribute_math::convert_to_static_type(data_type, [&](auto dummy) { using T = decltype(dummy); - VArray_Span span{src_attribute.varray.typed()}; + VArraySpan span{src_attribute.varray.typed()}; MutableSpan dst_span = dst_attribute.as_span(); if (src_attribute.domain == ATTR_DOMAIN_FACE) { dst_span.take_front(span.size()).copy_from(span); diff --git a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc index 108a9443d58..5fe300e0a08 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc @@ -178,7 +178,7 @@ static void copy_stable_id_point(const Span offsets, return; } - VArray_Span src{src_attribute.varray.typed()}; + VArraySpan src{src_attribute.varray.typed()}; MutableSpan dst = dst_attribute.as_span(); threaded_id_offset_copy(offsets, src, dst); dst_attribute.save(); @@ -211,7 +211,7 @@ static void copy_attributes_without_id(GeometrySet &geometry_set, } attribute_math::convert_to_static_type(data_type, [&](auto dummy) { using T = decltype(dummy); - VArray_Span src = src_attribute.varray.typed(); + VArraySpan src = src_attribute.varray.typed(); MutableSpan dst = dst_attribute.as_span(); threaded_slice_fill(offsets, selection, src, dst); }); @@ -258,7 +258,7 @@ static void copy_curve_attributes_without_id(const GeometrySet &geometry_set, attribute_math::convert_to_static_type(data_type, [&](auto dummy) { using T = decltype(dummy); - VArray_Span src{src_attribute.varray.typed()}; + VArraySpan src{src_attribute.varray.typed()}; MutableSpan dst = dst_attribute.as_span(); switch (out_domain) { @@ -307,7 +307,7 @@ static void copy_stable_id_curves(const bke::CurvesGeometry &src_curves, return; } - VArray_Span src{src_attribute.varray.typed()}; + VArraySpan src{src_attribute.varray.typed()}; MutableSpan dst = dst_attribute.as_span(); threading::parallel_for(selection.index_range(), 512, [&](IndexRange range) { @@ -439,7 +439,7 @@ static void copy_face_attributes_without_id(GeometrySet &geometry_set, attribute_math::convert_to_static_type(data_type, [&](auto dummy) { using T = decltype(dummy); - VArray_Span src{src_attribute.varray.typed()}; + VArraySpan src{src_attribute.varray.typed()}; MutableSpan dst = dst_attribute.as_span(); switch (out_domain) { @@ -487,7 +487,7 @@ static void copy_stable_id_faces(const Mesh &mesh, return; } - VArray_Span src{src_attribute.varray.typed()}; + VArraySpan src{src_attribute.varray.typed()}; MutableSpan dst = dst_attribute.as_span(); Span polys(mesh.mpoly, mesh.totpoly); @@ -651,7 +651,7 @@ static void copy_edge_attributes_without_id(GeometrySet &geometry_set, } attribute_math::convert_to_static_type(data_type, [&](auto dummy) { using T = decltype(dummy); - VArray_Span src{src_attribute.varray.typed()}; + VArraySpan src{src_attribute.varray.typed()}; MutableSpan dst = dst_attribute.as_span(); switch (out_domain) { @@ -691,7 +691,7 @@ static void copy_stable_id_edges(const Mesh &mesh, Span edges(mesh.medge, mesh.totedge); - VArray_Span src{src_attribute.varray.typed()}; + VArraySpan src{src_attribute.varray.typed()}; MutableSpan dst = dst_attribute.as_span(); threading::parallel_for(IndexRange(selection.size()), 1024, [&](IndexRange range) { for (const int i_selection : range) { @@ -853,7 +853,7 @@ static void duplicate_points_curve(GeometrySet &geometry_set, attribute_math::convert_to_static_type(data_type, [&](auto dummy) { using T = decltype(dummy); - VArray_Span src{src_attribute.varray.typed()}; + VArraySpan src{src_attribute.varray.typed()}; MutableSpan dst = dst_attribute.as_span(); switch (domain) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc index 0c56b0e9804..62cd1d8ac3a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc @@ -63,7 +63,7 @@ static void fill_new_attribute(Span src_components, GVArray read_attribute = component->attribute_get_for_read( attribute_id, domain, data_type, nullptr); - GVArray_GSpan src_span{read_attribute}; + GVArraySpan src_span{read_attribute}; const void *src_buffer = src_span.data(); void *dst_buffer = dst_span[offset]; cpp_type->copy_assign_n(src_buffer, dst_buffer, domain_num); diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc b/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc index 00b3d167755..95ff53b7146 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc @@ -68,7 +68,7 @@ static void geometry_set_points_to_vertices(GeometrySet &geometry_set, attribute_math::convert_to_static_type(data_type, [&](auto dummy) { using T = decltype(dummy); VArray src_typed = src.typed(); - VArray_Span src_typed_span{src_typed}; + VArraySpan src_typed_span{src_typed}; copy_attribute_to_vertices(src_typed_span, selection, dst.as_span().typed()); }); dst.save(); -- cgit v1.2.3