From b3a3b94976fc2ebdb0c228fa6e830c3ae428cf9b Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 2 May 2023 15:07:40 -0400 Subject: [PATCH] Cleanup: Avoid allocating extra array in sample nearest node The distances array was filled but never used. --- .../nodes/geometry/nodes/node_geo_sample_nearest.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc index 652368ea51f..35c8bbd5561 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc @@ -263,19 +263,18 @@ class SampleNearestFunction : public mf::MultiFunction { case GEO_COMPONENT_TYPE_MESH: { const MeshComponent &component = *static_cast(src_component_); const Mesh &mesh = *component.get_for_read(); - Array distances(mask.min_array_size()); switch (domain_) { case ATTR_DOMAIN_POINT: - get_closest_mesh_points(mesh, positions, mask, indices, distances, {}); + get_closest_mesh_points(mesh, positions, mask, indices, {}, {}); break; case ATTR_DOMAIN_EDGE: - get_closest_mesh_edges(mesh, positions, mask, indices, distances, {}); + get_closest_mesh_edges(mesh, positions, mask, indices, {}, {}); break; case ATTR_DOMAIN_FACE: - get_closest_mesh_polys(mesh, positions, mask, indices, distances, {}); + get_closest_mesh_polys(mesh, positions, mask, indices, {}, {}); break; case ATTR_DOMAIN_CORNER: - get_closest_mesh_corners(mesh, positions, mask, indices, distances, {}); + get_closest_mesh_corners(mesh, positions, mask, indices, {}, {}); break; default: break; @@ -286,8 +285,7 @@ class SampleNearestFunction : public mf::MultiFunction { const PointCloudComponent &component = *static_cast( src_component_); const PointCloud &points = *component.get_for_read(); - Array distances(mask.min_array_size()); - get_closest_pointcloud_points(points, positions, mask, indices, distances); + get_closest_pointcloud_points(points, positions, mask, indices, {}); break; } default: