Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-07-31 21:26:01 +0300
committerHans Goudey <h.goudey@me.com>2021-07-31 21:26:01 +0300
commit17243337d7317045a46c521cfc74c3739a5404d6 (patch)
treea2acccc35d4c2c37376591fa41520d6db354db45 /source/blender/blenkernel/intern/mesh_sample.cc
parent2f63303e2540ceeca9e99cc47c07de37f3d79c0a (diff)
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.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_sample.cc')
-rw-r--r--source/blender/blenkernel/intern/mesh_sample.cc23
1 files changed, 10 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/mesh_sample.cc b/source/blender/blenkernel/intern/mesh_sample.cc
index bd46407d060..5388f6e530e 100644
--- a/source/blender/blenkernel/intern/mesh_sample.cc
+++ b/source/blender/blenkernel/intern/mesh_sample.cc
@@ -24,14 +24,6 @@
namespace blender::bke::mesh_surface_sample {
-Span<MLoopTri> get_mesh_looptris(const Mesh &mesh)
-{
- /* This only updates a cache and can be considered to be logically const. */
- const MLoopTri *looptris = BKE_mesh_runtime_looptri_ensure(const_cast<Mesh *>(&mesh));
- const int looptris_len = BKE_mesh_runtime_looptri_len(&mesh);
- return {looptris, looptris_len};
-}
-
template<typename T>
BLI_NOINLINE static void sample_point_attribute(const Mesh &mesh,
const Span<int> looptri_indices,
@@ -39,7 +31,8 @@ BLI_NOINLINE static void sample_point_attribute(const Mesh &mesh,
const VArray<T> &data_in,
const MutableSpan<T> data_out)
{
- const Span<MLoopTri> looptris = get_mesh_looptris(mesh);
+ const Span<MLoopTri> looptris{BKE_mesh_runtime_looptri_ensure(&mesh),
+ BKE_mesh_runtime_looptri_len(&mesh)};
for (const int i : bary_coords.index_range()) {
const int looptri_index = looptri_indices[i];
@@ -85,7 +78,8 @@ BLI_NOINLINE static void sample_corner_attribute(const Mesh &mesh,
const VArray<T> &data_in,
const MutableSpan<T> data_out)
{
- Span<MLoopTri> looptris = get_mesh_looptris(mesh);
+ const Span<MLoopTri> looptris{BKE_mesh_runtime_looptri_ensure(&mesh),
+ BKE_mesh_runtime_looptri_len(&mesh)};
for (const int i : bary_coords.index_range()) {
const int looptri_index = looptri_indices[i];
@@ -130,7 +124,8 @@ void sample_face_attribute(const Mesh &mesh,
const VArray<T> &data_in,
const MutableSpan<T> data_out)
{
- Span<MLoopTri> looptris = get_mesh_looptris(mesh);
+ const Span<MLoopTri> looptris{BKE_mesh_runtime_looptri_ensure(&mesh),
+ BKE_mesh_runtime_looptri_len(&mesh)};
for (const int i : data_out.index_range()) {
const int looptri_index = looptri_indices[i];
@@ -172,7 +167,8 @@ Span<float3> MeshAttributeInterpolator::ensure_barycentric_coords()
}
bary_coords_.reinitialize(positions_.size());
- Span<MLoopTri> looptris = get_mesh_looptris(*mesh_);
+ const Span<MLoopTri> looptris{BKE_mesh_runtime_looptri_ensure(mesh_),
+ BKE_mesh_runtime_looptri_len(mesh_)};
for (const int i : bary_coords_.index_range()) {
const int looptri_index = looptri_indices_[i];
@@ -199,7 +195,8 @@ Span<float3> MeshAttributeInterpolator::ensure_nearest_weights()
}
nearest_weights_.reinitialize(positions_.size());
- Span<MLoopTri> looptris = get_mesh_looptris(*mesh_);
+ const Span<MLoopTri> looptris{BKE_mesh_runtime_looptri_ensure(mesh_),
+ BKE_mesh_runtime_looptri_len(mesh_)};
for (const int i : nearest_weights_.index_range()) {
const int looptri_index = looptri_indices_[i];