From 84626dfa1616e02afac26f975663997982b82805 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Sat, 30 Oct 2021 19:40:58 +0200 Subject: progress --- source/blender/blenkernel/BKE_attribute_access.hh | 4 +-- source/blender/blenlib/BLI_virtual_array.hh | 34 ++++------------------ .../blender/functions/FN_generic_virtual_array.hh | 2 +- source/blender/functions/intern/field.cc | 2 +- .../legacy/node_geo_align_rotation_to_vector.cc | 4 +-- .../nodes/legacy/node_geo_attribute_color_ramp.cc | 2 +- .../nodes/legacy/node_geo_attribute_combine_xyz.cc | 2 +- .../nodes/legacy/node_geo_attribute_compare.cc | 18 ++++++------ .../nodes/legacy/node_geo_attribute_curve_map.cc | 6 ++-- .../nodes/legacy/node_geo_attribute_mix.cc | 6 ++-- .../nodes/legacy/node_geo_attribute_proximity.cc | 2 +- .../legacy/node_geo_attribute_sample_texture.cc | 2 +- .../nodes/legacy/node_geo_attribute_transfer.cc | 16 +++++----- .../nodes/legacy/node_geo_attribute_vector_math.cc | 14 ++++----- .../nodes/legacy/node_geo_delete_geometry.cc | 8 ++--- .../nodes/legacy/node_geo_point_translate.cc | 4 +-- .../geometry/nodes/legacy/node_geo_raycast.cc | 20 ++++++------- .../nodes/geometry/nodes/node_geo_convex_hull.cc | 8 ++--- .../geometry/nodes/node_geo_transfer_attribute.cc | 14 ++++----- 19 files changed, 72 insertions(+), 96 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_attribute_access.hh b/source/blender/blenkernel/BKE_attribute_access.hh index 610e17b7097..76528dd6b9e 100644 --- a/source/blender/blenkernel/BKE_attribute_access.hh +++ b/source/blender/blenkernel/BKE_attribute_access.hh @@ -279,9 +279,9 @@ template class OutputAttribute_Typed { return varray_; } - VMutableArrayImpl *operator->() + VMutableArray *operator->() { - return &*varray_; + return &varray_; } VMutableArray &varray() diff --git a/source/blender/blenlib/BLI_virtual_array.hh b/source/blender/blenlib/BLI_virtual_array.hh index a6440c07f9e..d5cb110acf2 100644 --- a/source/blender/blenlib/BLI_virtual_array.hh +++ b/source/blender/blenlib/BLI_virtual_array.hh @@ -730,18 +730,6 @@ template class VArray : public detail::VArrayCommon { this->move_from(std::move(other)); return *this; } - - const VArrayImpl *operator->() const - { - BLI_assert(*this); - return this->impl_; - } - - const VArrayImpl &operator*() const - { - BLI_assert(*this); - return *this->impl_; - } }; template class VMutableArray : public detail::VArrayCommon { @@ -814,18 +802,6 @@ template class VMutableArray : public detail::VArrayCommon { return *this; } - VMutableArrayImpl *operator->() const - { - BLI_assert(*this); - return (VMutableArrayImpl *)this->impl_; - } - - VMutableArrayImpl &operator*() const - { - BLI_assert(*this); - return *(VMutableArrayImpl *)this->impl_; - } - MutableSpan get_internal_span() const { BLI_assert(this->is_span()); @@ -878,13 +854,13 @@ template class VArray_Span final : public Span { public: VArray_Span(VArray varray) : Span(), varray_(std::move(varray)) { - this->size_ = varray_->size(); + this->size_ = varray_.size(); if (varray_.is_span()) { this->data_ = varray_.get_internal_span().data(); } else { owned_data_.~Array(); - new (&owned_data_) Array(varray_->size(), NoInitialization{}); + new (&owned_data_) Array(varray_.size(), NoInitialization{}); varray_.materialize_to_uninitialized(owned_data_); this->data_ = owned_data_.data(); } @@ -911,18 +887,18 @@ template class VMutableArray_Span final : public MutableSpan { VMutableArray_Span(VMutableArray varray, const bool copy_values_to_span = true) : MutableSpan(), varray_(std::move(varray)) { - this->size_ = varray_->size(); + this->size_ = varray_.size(); if (varray_.is_span()) { this->data_ = varray_.get_internal_span().data(); } else { if (copy_values_to_span) { owned_data_.~Array(); - new (&owned_data_) Array(varray_->size(), NoInitialization{}); + new (&owned_data_) Array(varray_.size(), NoInitialization{}); varray_.materialize_to_uninitialized(owned_data_); } else { - owned_data_.reinitialize(varray_->size()); + owned_data_.reinitialize(varray_.size()); } this->data_ = owned_data_.data(); } diff --git a/source/blender/functions/FN_generic_virtual_array.hh b/source/blender/functions/FN_generic_virtual_array.hh index 59a5937ff93..790d71af4e6 100644 --- a/source/blender/functions/FN_generic_virtual_array.hh +++ b/source/blender/functions/FN_generic_virtual_array.hh @@ -444,7 +444,7 @@ template class GVMutableArrayImpl_For_VMutableArray : public GVMutab public: GVMutableArrayImpl_For_VMutableArray(VMutableArray varray) - : GVMutableArrayImpl(CPPType::get(), varray->size()), varray_(std::move(varray)) + : GVMutableArrayImpl(CPPType::get(), varray.size()), varray_(std::move(varray)) { } diff --git a/source/blender/functions/intern/field.cc b/source/blender/functions/intern/field.cc index f5a1628571b..7a2e31105bb 100644 --- a/source/blender/functions/intern/field.cc +++ b/source/blender/functions/intern/field.cc @@ -692,7 +692,7 @@ IndexMask FieldEvaluator::get_evaluated_as_mask(const int field_index) if (varray.is_single()) { if (varray.get_internal_single()) { - return IndexRange(varray->size()); + return IndexRange(varray.size()); } return IndexRange(0); } diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_align_rotation_to_vector.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_align_rotation_to_vector.cc index 5b8cd08207b..b95548c2dee 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_align_rotation_to_vector.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_align_rotation_to_vector.cc @@ -80,7 +80,7 @@ static void align_rotations_auto_pivot(const VArray &vectors, const float3 local_main_axis, const MutableSpan rotations) { - threading::parallel_for(IndexRange(vectors->size()), 128, [&](IndexRange range) { + threading::parallel_for(IndexRange(vectors.size()), 128, [&](IndexRange range) { for (const int i : range) { const float3 vector = vectors[i]; if (is_zero_v3(vector)) { @@ -131,7 +131,7 @@ static void align_rotations_fixed_pivot(const VArray &vectors, return; } - threading::parallel_for(IndexRange(vectors->size()), 128, [&](IndexRange range) { + threading::parallel_for(IndexRange(vectors.size()), 128, [&](IndexRange range) { for (const int i : range) { const float3 vector = vectors[i]; if (is_zero_v3(vector)) { diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_color_ramp.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_color_ramp.cc index f3983a611d7..061f5f3d7ee 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_color_ramp.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_color_ramp.cc @@ -91,7 +91,7 @@ static void execute_on_component(const GeoNodeExecParams ¶ms, GeometryCompon MutableSpan results = attribute_result.as_span(); ColorBand *color_ramp = &node_storage->color_ramp; - threading::parallel_for(IndexRange(attribute_in->size()), 512, [&](IndexRange range) { + threading::parallel_for(IndexRange(attribute_in.size()), 512, [&](IndexRange range) { for (const int i : range) { BKE_colorband_evaluate(color_ramp, attribute_in[i], results[i]); } diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_combine_xyz.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_combine_xyz.cc index 38666c2c9b6..631e5cddd67 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_combine_xyz.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_combine_xyz.cc @@ -106,7 +106,7 @@ static void combine_attributes(GeometryComponent &component, const GeoNodeExecPa const float x = attribute_x[i]; const float y = attribute_y[i]; const float z = attribute_z[i]; - attribute_result->set_impl(i, {x, y, z}); + attribute_result->set(i, {x, y, z}); } attribute_result.save(); } diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_compare.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_compare.cc index c3991c865a7..d9756577d2c 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_compare.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_compare.cc @@ -82,7 +82,7 @@ static void do_math_operation(const VArray &input_a, const FloatCompareOperation operation, MutableSpan span_result) { - const int size = input_a->size(); + const int size = input_a.size(); if (try_dispatch_float_math_fl_fl_to_bool( operation, [&](auto math_function, const FloatMathOperationInfo &UNUSED(info)) { @@ -105,7 +105,7 @@ static void do_equal_operation_float(const VArray &input_a, const float threshold, MutableSpan span_result) { - const int size = input_a->size(); + const int size = input_a.size(); for (const int i : IndexRange(size)) { const float a = input_a[i]; const float b = input_b[i]; @@ -119,7 +119,7 @@ static void do_equal_operation_float3(const VArray &input_a, MutableSpan span_result) { const float threshold_squared = pow2f(threshold); - const int size = input_a->size(); + const int size = input_a.size(); for (const int i : IndexRange(size)) { const float3 a = input_a[i]; const float3 b = input_b[i]; @@ -133,7 +133,7 @@ static void do_equal_operation_color4f(const VArray &input_a, MutableSpan span_result) { const float threshold_squared = pow2f(threshold); - const int size = input_a->size(); + const int size = input_a.size(); for (const int i : IndexRange(size)) { const ColorGeometry4f a = input_a[i]; const ColorGeometry4f b = input_b[i]; @@ -146,7 +146,7 @@ static void do_equal_operation_bool(const VArray &input_a, const float UNUSED(threshold), MutableSpan span_result) { - const int size = input_a->size(); + const int size = input_a.size(); for (const int i : IndexRange(size)) { const bool a = input_a[i]; const bool b = input_b[i]; @@ -159,7 +159,7 @@ static void do_not_equal_operation_float(const VArray &input_a, const float threshold, MutableSpan span_result) { - const int size = input_a->size(); + const int size = input_a.size(); for (const int i : IndexRange(size)) { const float a = input_a[i]; const float b = input_b[i]; @@ -173,7 +173,7 @@ static void do_not_equal_operation_float3(const VArray &input_a, MutableSpan span_result) { const float threshold_squared = pow2f(threshold); - const int size = input_a->size(); + const int size = input_a.size(); for (const int i : IndexRange(size)) { const float3 a = input_a[i]; const float3 b = input_b[i]; @@ -187,7 +187,7 @@ static void do_not_equal_operation_color4f(const VArray &input_ MutableSpan span_result) { const float threshold_squared = pow2f(threshold); - const int size = input_a->size(); + const int size = input_a.size(); for (const int i : IndexRange(size)) { const ColorGeometry4f a = input_a[i]; const ColorGeometry4f b = input_b[i]; @@ -200,7 +200,7 @@ static void do_not_equal_operation_bool(const VArray &input_a, const float UNUSED(threshold), MutableSpan span_result) { - const int size = input_a->size(); + const int size = input_a.size(); for (const int i : IndexRange(size)) { const bool a = input_a[i]; const bool b = input_b[i]; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_curve_map.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_curve_map.cc index 76ec977d763..3f50585f855 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_curve_map.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_curve_map.cc @@ -139,7 +139,7 @@ static void execute_on_component(const GeoNodeExecParams ¶ms, GeometryCompon VArray attribute_in = component.attribute_get_for_read( input_name, result_domain, float(0.0f)); MutableSpan results = attribute_result.as_span(); - threading::parallel_for(IndexRange(attribute_in->size()), 512, [&](IndexRange range) { + threading::parallel_for(IndexRange(attribute_in.size()), 512, [&](IndexRange range) { for (const int i : range) { results[i] = BKE_curvemapping_evaluateF(cumap, 3, attribute_in[i]); } @@ -151,7 +151,7 @@ static void execute_on_component(const GeoNodeExecParams ¶ms, GeometryCompon VArray attribute_in = component.attribute_get_for_read( input_name, result_domain, float3(0.0f)); MutableSpan results = attribute_result.as_span(); - threading::parallel_for(IndexRange(attribute_in->size()), 512, [&](IndexRange range) { + threading::parallel_for(IndexRange(attribute_in.size()), 512, [&](IndexRange range) { for (const int i : range) { BKE_curvemapping_evaluate3F(cumap, results[i], attribute_in[i]); } @@ -163,7 +163,7 @@ static void execute_on_component(const GeoNodeExecParams ¶ms, GeometryCompon VArray attribute_in = component.attribute_get_for_read( input_name, result_domain, ColorGeometry4f(0.0f, 0.0f, 0.0f, 1.0f)); MutableSpan results = attribute_result.as_span(); - threading::parallel_for(IndexRange(attribute_in->size()), 512, [&](IndexRange range) { + threading::parallel_for(IndexRange(attribute_in.size()), 512, [&](IndexRange range) { for (const int i : range) { BKE_curvemapping_evaluateRGBF(cumap, results[i], attribute_in[i]); } diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_mix.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_mix.cc index eb91212c608..36ac6e040ee 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_mix.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_mix.cc @@ -87,7 +87,7 @@ static void do_mix_operation_float(const int blend_mode, const VArray &inputs_b, VMutableArray &results) { - const int size = results->size(); + const int size = results.size(); threading::parallel_for(IndexRange(size), 512, [&](IndexRange range) { for (const int i : range) { const float factor = factors[i]; @@ -106,7 +106,7 @@ static void do_mix_operation_float3(const int blend_mode, const VArray &inputs_b, VMutableArray &results) { - const int size = results->size(); + const int size = results.size(); threading::parallel_for(IndexRange(size), 512, [&](IndexRange range) { for (const int i : range) { const float factor = factors[i]; @@ -124,7 +124,7 @@ static void do_mix_operation_color4f(const int blend_mode, const VArray &inputs_b, VMutableArray &results) { - const int size = results->size(); + const int size = results.size(); threading::parallel_for(IndexRange(size), 512, [&](IndexRange range) { for (const int i : range) { const float factor = factors[i]; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_proximity.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_proximity.cc index ff048e5eb1c..0122f9b7598 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_proximity.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_proximity.cc @@ -166,7 +166,7 @@ static void attribute_calc_proximity(GeometryComponent &component, /* Theoretically it would be possible to avoid using the distance array when it's not required * and there is only one component. However, this only adds an allocation and a single float * comparison per vertex, so it's likely not worth it. */ - distances_internal.reinitialize(positions->size()); + distances_internal.reinitialize(positions.size()); distances = distances_internal; } distances.fill(FLT_MAX); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_sample_texture.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_sample_texture.cc index 3f857db2284..9748ca3f2ad 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_sample_texture.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_sample_texture.cc @@ -86,7 +86,7 @@ static void execute_on_component(GeometryComponent &component, const GeoNodeExec mapping_name, result_domain, {0, 0, 0}); MutableSpan colors = attribute_out.as_span(); - threading::parallel_for(IndexRange(mapping_attribute->size()), 128, [&](IndexRange range) { + threading::parallel_for(IndexRange(mapping_attribute.size()), 128, [&](IndexRange range) { for (const int i : range) { TexResult texture_result = {0}; const float3 position = mapping_attribute[i]; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_transfer.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_transfer.cc index d66e4f34c09..91016145a52 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_transfer.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_transfer.cc @@ -104,9 +104,9 @@ static void get_closest_in_bvhtree(BVHTreeFromMesh &tree_data, const MutableSpan r_distances_sq, const MutableSpan r_positions) { - BLI_assert(positions->size() == r_indices.size() || r_indices.is_empty()); - BLI_assert(positions->size() == r_distances_sq.size() || r_distances_sq.is_empty()); - BLI_assert(positions->size() == r_positions.size() || r_positions.is_empty()); + BLI_assert(positions.size() == r_indices.size() || r_indices.is_empty()); + BLI_assert(positions.size() == r_distances_sq.size() || r_distances_sq.is_empty()); + BLI_assert(positions.size() == r_positions.size() || r_positions.is_empty()); for (const int i : positions.index_range()) { BVHTreeNearest nearest; @@ -131,7 +131,7 @@ static void get_closest_pointcloud_points(const PointCloud &pointcloud, const MutableSpan r_indices, const MutableSpan r_distances_sq) { - BLI_assert(positions->size() == r_indices.size()); + BLI_assert(positions.size() == r_indices.size()); BLI_assert(pointcloud.totpoint > 0); BVHTreeFromPointCloud tree_data; @@ -197,7 +197,7 @@ static void get_closest_mesh_polygons(const Mesh &mesh, { BLI_assert(mesh.totpoly > 0); - Array looptri_indices(positions->size()); + Array looptri_indices(positions.size()); get_closest_mesh_looptris(mesh, positions, looptri_indices, r_distances_sq, r_positions); const Span looptris{BKE_mesh_runtime_looptri_ensure(&mesh), @@ -216,7 +216,7 @@ static void get_closest_mesh_corners(const Mesh &mesh, const MutableSpan r_positions) { BLI_assert(mesh.totloop > 0); - Array poly_indices(positions->size()); + Array poly_indices(positions.size()); get_closest_mesh_polygons(mesh, positions, poly_indices, {}, {}); for (const int i : positions.index_range()) { @@ -259,7 +259,7 @@ static void transfer_attribute_nearest_face_interpolated(const GeometrySet &src_ const StringRef src_name, const StringRef dst_name) { - const int tot_samples = dst_positions->size(); + const int tot_samples = dst_positions.size(); const MeshComponent *component = src_geometry.get_component_for_read(); if (component == nullptr) { return; @@ -312,7 +312,7 @@ static void transfer_attribute_nearest(const GeometrySet &src_geometry, const MeshComponent *mesh_component = src_geometry.get_component_for_read(); const Mesh *mesh = mesh_component ? mesh_component->get_for_read() : nullptr; - const int tot_samples = dst_positions->size(); + const int tot_samples = dst_positions.size(); Array pointcloud_indices; Array pointcloud_distances_sq; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_vector_math.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_vector_math.cc index b75f8620d80..2b28a50f4b5 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_vector_math.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_vector_math.cc @@ -190,7 +190,7 @@ static void do_math_operation_fl3_fl3_to_fl3(const VArray &input_a, const VMutableArray &result, const NodeVectorMathOperation operation) { - const int size = input_a->size(); + const int size = input_a.size(); VArray_Span span_a{input_a}; VArray_Span span_b{input_b}; @@ -221,7 +221,7 @@ static void do_math_operation_fl3_fl3_fl3_to_fl3(const VArray &input_a, const VMutableArray &result, const NodeVectorMathOperation operation) { - const int size = input_a->size(); + const int size = input_a.size(); VArray_Span span_a{input_a}; VArray_Span span_b{input_b}; @@ -254,7 +254,7 @@ static void do_math_operation_fl3_fl3_fl_to_fl3(const VArray &input_a, const VMutableArray &result, const NodeVectorMathOperation operation) { - const int size = input_a->size(); + const int size = input_a.size(); VArray_Span span_a{input_a}; VArray_Span span_b{input_b}; @@ -286,7 +286,7 @@ static void do_math_operation_fl3_fl3_to_fl(const VArray &input_a, const VMutableArray &result, const NodeVectorMathOperation operation) { - const int size = input_a->size(); + const int size = input_a.size(); VArray_Span span_a{input_a}; VArray_Span span_b{input_b}; @@ -316,7 +316,7 @@ static void do_math_operation_fl3_fl_to_fl3(const VArray &input_a, const VMutableArray &result, const NodeVectorMathOperation operation) { - const int size = input_a->size(); + const int size = input_a.size(); VArray_Span span_a{input_a}; VArray_Span span_b{input_b}; @@ -345,7 +345,7 @@ static void do_math_operation_fl3_to_fl3(const VArray &input_a, const VMutableArray &result, const NodeVectorMathOperation operation) { - const int size = input_a->size(); + const int size = input_a.size(); VArray_Span span_a{input_a}; VMutableArray_Span span_result{result, false}; @@ -372,7 +372,7 @@ static void do_math_operation_fl3_to_fl(const VArray &input_a, const VMutableArray &result, const NodeVectorMathOperation operation) { - const int size = input_a->size(); + const int size = input_a.size(); VArray_Span span_a{input_a}; VMutableArray_Span span_result{result, false}; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_delete_geometry.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_delete_geometry.cc index 0a30110910f..f62a22d7934 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_delete_geometry.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_delete_geometry.cc @@ -222,7 +222,7 @@ static void compute_selected_vertices_from_vertex_selection(const VArray & MutableSpan r_vertex_map, uint *r_num_selected_vertices) { - BLI_assert(vertex_selection->size() == r_vertex_map.size()); + BLI_assert(vertex_selection.size() == r_vertex_map.size()); uint num_selected_vertices = 0; for (const int i : r_vertex_map.index_range()) { @@ -271,7 +271,7 @@ static void compute_selected_polygons_from_vertex_selection(const Mesh &mesh, uint *r_num_selected_polys, uint *r_num_selected_loops) { - BLI_assert(mesh.totvert == vertex_selection->size()); + BLI_assert(mesh.totvert == vertex_selection.size()); r_selected_poly_indices.reserve(mesh.totpoly); r_loop_starts.reserve(mesh.totloop); @@ -313,7 +313,7 @@ static void compute_selected_vertices_and_edges_from_edge_selection( uint *r_num_selected_vertices, uint *r_num_selected_edges) { - BLI_assert(mesh.totedge == edge_selection->size()); + BLI_assert(mesh.totedge == edge_selection.size()); uint num_selected_edges = 0; uint num_selected_vertices = 0; @@ -459,7 +459,7 @@ static void compute_selected_mesh_data_from_poly_selection(const Mesh &mesh, uint *r_num_selected_polys, uint *r_num_selected_loops) { - BLI_assert(mesh.totpoly == poly_selection->size()); + BLI_assert(mesh.totpoly == poly_selection.size()); BLI_assert(mesh.totedge == r_edge_map.size()); r_vertex_map.fill(-1); r_edge_map.fill(-1); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_point_translate.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_point_translate.cc index c5e367b94cf..f16b46d0531 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_point_translate.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_point_translate.cc @@ -46,8 +46,8 @@ static void execute_on_component(GeoNodeExecParams params, GeometryComponent &co VArray attribute = params.get_input_attribute( "Translation", component, ATTR_DOMAIN_POINT, {0, 0, 0}); - for (const int i : IndexRange(attribute->size())) { - position_attribute->set_impl(i, position_attribute->get_impl(i) + attribute[i]); + for (const int i : IndexRange(attribute.size())) { + position_attribute->set(i, position_attribute->get(i) + attribute[i]); } position_attribute.save(); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_raycast.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_raycast.cc index 38c23f837ba..a3e1e4e60c6 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_raycast.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_raycast.cc @@ -86,13 +86,13 @@ static void raycast_to_mesh(const Mesh &mesh, const MutableSpan r_hit_normals, const MutableSpan r_hit_distances) { - BLI_assert(ray_origins->size() == ray_directions->size()); - BLI_assert(ray_origins->size() == ray_lengths->size()); - BLI_assert(ray_origins->size() == r_hit.size() || r_hit.is_empty()); - BLI_assert(ray_origins->size() == r_hit_indices.size() || r_hit_indices.is_empty()); - BLI_assert(ray_origins->size() == r_hit_positions.size() || r_hit_positions.is_empty()); - BLI_assert(ray_origins->size() == r_hit_normals.size() || r_hit_normals.is_empty()); - BLI_assert(ray_origins->size() == r_hit_distances.size() || r_hit_distances.is_empty()); + BLI_assert(ray_origins.size() == ray_directions.size()); + BLI_assert(ray_origins.size() == ray_lengths.size()); + BLI_assert(ray_origins.size() == r_hit.size() || r_hit.is_empty()); + BLI_assert(ray_origins.size() == r_hit_indices.size() || r_hit_indices.is_empty()); + BLI_assert(ray_origins.size() == r_hit_positions.size() || r_hit_positions.is_empty()); + BLI_assert(ray_origins.size() == r_hit_normals.size() || r_hit_normals.is_empty()); + BLI_assert(ray_origins.size() == r_hit_distances.size() || r_hit_distances.is_empty()); BVHTreeFromMesh tree_data; BKE_bvhtree_from_mesh_get(&tree_data, &mesh, BVHTREE_FROM_LOOPTRI, 4); @@ -218,10 +218,10 @@ static void raycast_from_points(const GeoNodeExecParams ¶ms, Array hit_indices; Array hit_positions_internal; if (!hit_attribute_names.is_empty()) { - hit_indices.reinitialize(ray_origins->size()); + hit_indices.reinitialize(ray_origins.size()); if (!hit_position_attribute) { - hit_positions_internal.reinitialize(ray_origins->size()); + hit_positions_internal.reinitialize(ray_origins.size()); } } const MutableSpan is_hit = hit_attribute ? hit_attribute.as_span() : MutableSpan(); @@ -251,7 +251,7 @@ static void raycast_from_points(const GeoNodeExecParams ¶ms, /* Custom interpolated attributes */ bke::mesh_surface_sample::MeshAttributeInterpolator interp( - src_mesh, IndexMask(ray_origins->size()), hit_positions, hit_indices); + src_mesh, IndexMask(ray_origins.size()), hit_positions, hit_indices); for (const int i : hit_attribute_names.index_range()) { const std::optional meta_data = src_mesh_component->attribute_get_meta_data( hit_attribute_names[i]); diff --git a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc index a27d9381a78..221fb421ab4 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc @@ -202,8 +202,8 @@ static Mesh *compute_hull(const GeometrySet &geometry_set) const MeshComponent *component = geometry_set.get_component_for_read(); VArray varray = component->attribute_get_for_read( "position", ATTR_DOMAIN_POINT, {0, 0, 0}); - varray.materialize(positions.as_mutable_span().slice(offset, varray->size())); - offset += varray->size(); + varray.materialize(positions.as_mutable_span().slice(offset, varray.size())); + offset += varray.size(); } if (geometry_set.has_pointcloud()) { @@ -211,8 +211,8 @@ static Mesh *compute_hull(const GeometrySet &geometry_set) geometry_set.get_component_for_read(); VArray varray = component->attribute_get_for_read( "position", ATTR_DOMAIN_POINT, {0, 0, 0}); - varray.materialize(positions.as_mutable_span().slice(offset, varray->size())); - offset += varray->size(); + varray.materialize(positions.as_mutable_span().slice(offset, varray.size())); + offset += varray.size(); } if (geometry_set.has_curve()) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc index 289434225e0..94458f49b30 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc @@ -131,9 +131,9 @@ static void get_closest_in_bvhtree(BVHTreeFromMesh &tree_data, const MutableSpan r_distances_sq, const MutableSpan r_positions) { - BLI_assert(positions->size() == r_indices.size() || r_indices.is_empty()); - BLI_assert(positions->size() == r_distances_sq.size() || r_distances_sq.is_empty()); - BLI_assert(positions->size() == r_positions.size() || r_positions.is_empty()); + BLI_assert(positions.size() == r_indices.size() || r_indices.is_empty()); + BLI_assert(positions.size() == r_distances_sq.size() || r_distances_sq.is_empty()); + BLI_assert(positions.size() == r_positions.size() || r_positions.is_empty()); for (const int i : mask) { BVHTreeNearest nearest; @@ -159,7 +159,7 @@ static void get_closest_pointcloud_points(const PointCloud &pointcloud, const MutableSpan r_indices, const MutableSpan r_distances_sq) { - BLI_assert(positions->size() == r_indices.size()); + BLI_assert(positions.size() == r_indices.size()); BLI_assert(pointcloud.totpoint > 0); BVHTreeFromPointCloud tree_data; @@ -232,7 +232,7 @@ static void get_closest_mesh_polygons(const Mesh &mesh, { BLI_assert(mesh.totpoly > 0); - Array looptri_indices(positions->size()); + Array looptri_indices(positions.size()); get_closest_mesh_looptris(mesh, positions, mask, looptri_indices, r_distances_sq, r_positions); const Span looptris{BKE_mesh_runtime_looptri_ensure(&mesh), @@ -253,7 +253,7 @@ static void get_closest_mesh_corners(const Mesh &mesh, const MutableSpan r_positions) { BLI_assert(mesh.totloop > 0); - Array poly_indices(positions->size()); + Array poly_indices(positions.size()); get_closest_mesh_polygons(mesh, positions, mask, poly_indices, {}, {}); for (const int i : mask) { @@ -311,7 +311,7 @@ void copy_with_indices_clamped(const VArray &src, if (src.is_empty()) { return; } - const int max_index = src->size() - 1; + const int max_index = src.size() - 1; threading::parallel_for(mask.index_range(), 4096, [&](IndexRange range) { for (const int i : range) { const int index = mask[i]; -- cgit v1.2.3