From 17243337d7317045a46c521cfc74c3739a5404d6 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Sat, 31 Jul 2021 14:26:01 -0400 Subject: Cleanup: Remove unecessary helper function Retrieving a mesh's looptris now take's a const mesh after rB5f8969bb4b4, which removes the need for this function. Since it's only two lines, avoiding the use of a separate function in this case is simpler. --- .../nodes/geometry/nodes/node_geo_attribute_transfer.cc | 3 ++- .../nodes/geometry/nodes/node_geo_point_distribute.cc | 16 ++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'source/blender/nodes') diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_transfer.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_transfer.cc index 6a23443d3ab..ab2136f4e8d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_transfer.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_transfer.cc @@ -204,7 +204,8 @@ static void get_closest_mesh_polygons(const Mesh &mesh, Array looptri_indices(positions.size()); get_closest_mesh_looptris(mesh, positions, looptri_indices, r_distances_sq, r_positions); - Span looptris = bke::mesh_surface_sample::get_mesh_looptris(mesh); + const Span looptris{BKE_mesh_runtime_looptri_ensure(&mesh), + BKE_mesh_runtime_looptri_len(&mesh)}; for (const int i : positions.index_range()) { const MLoopTri &looptri = looptris[looptri_indices[i]]; r_poly_indices[i] = looptri.poly; diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc index d456c72744f..99930b5ae46 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc @@ -81,13 +81,6 @@ static float3 normal_to_euler_rotation(const float3 normal) return rotation; } -static Span get_mesh_looptris(const Mesh &mesh) -{ - const MLoopTri *looptris = BKE_mesh_runtime_looptri_ensure(&mesh); - const int looptris_len = BKE_mesh_runtime_looptri_len(&mesh); - return {looptris, looptris_len}; -} - static void sample_mesh_surface(const Mesh &mesh, const float4x4 &transform, const float base_density, @@ -97,7 +90,8 @@ static void sample_mesh_surface(const Mesh &mesh, Vector &r_bary_coords, Vector &r_looptri_indices) { - Span looptris = get_mesh_looptris(mesh); + const Span looptris{BKE_mesh_runtime_looptri_ensure(&mesh), + BKE_mesh_runtime_looptri_len(&mesh)}; for (const int looptri_index : looptris.index_range()) { const MLoopTri &looptri = looptris[looptri_index]; @@ -208,7 +202,8 @@ BLI_NOINLINE static void update_elimination_mask_based_on_density_factors( Span looptri_indices, MutableSpan elimination_mask) { - Span looptris = get_mesh_looptris(mesh); + const Span looptris{BKE_mesh_runtime_looptri_ensure(&mesh), + BKE_mesh_runtime_looptri_len(&mesh)}; for (const int i : bary_coords.index_range()) { if (elimination_mask[i]) { continue; @@ -365,7 +360,8 @@ BLI_NOINLINE static void compute_special_attributes(Span const GeometrySet &set = set_group.geometry_set; const MeshComponent &component = *set.get_component_for_read(); const Mesh &mesh = *component.get_for_read(); - Span looptris = get_mesh_looptris(mesh); + const Span looptris{BKE_mesh_runtime_looptri_ensure(&mesh), + BKE_mesh_runtime_looptri_len(&mesh)}; for (const float4x4 &transform : set_group.transforms) { const int offset = instance_start_offsets[i_instance]; -- cgit v1.2.3