diff options
author | Jacques Lucke <jacques@blender.org> | 2022-09-24 12:41:08 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-09-24 12:41:08 +0300 |
commit | c25df02ac3036449081701349d36d2f16b2c92f2 (patch) | |
tree | 29603afd3baced747546f4a841cbd4ab73bc7052 /source/blender/editors | |
parent | 8422da13c929f65850a723794a27baa924929377 (diff) |
Cleanup: simplify accessing mesh looptris
Diffstat (limited to 'source/blender/editors')
5 files changed, 9 insertions, 18 deletions
diff --git a/source/blender/editors/curves/intern/curves_ops.cc b/source/blender/editors/curves/intern/curves_ops.cc index 54d91ccfc90..f52e11276e9 100644 --- a/source/blender/editors/curves/intern/curves_ops.cc +++ b/source/blender/editors/curves/intern/curves_ops.cc @@ -232,8 +232,7 @@ static void try_convert_single_object(Object &curves_ob, BLI_SCOPED_DEFER([&]() { free_bvhtree_from_mesh(&surface_bvh); }); const Span<float3> positions_cu = curves.positions(); - const Span<MLoopTri> looptris{BKE_mesh_runtime_looptri_ensure(&surface_me), - BKE_mesh_runtime_looptri_len(&surface_me)}; + const Span<MLoopTri> looptris = surface_me.looptris(); if (looptris.is_empty()) { *r_could_not_convert_some_curves = true; @@ -545,8 +544,7 @@ static void snap_curves_to_surface_exec_object(Object &curves_ob, const Mesh &surface_mesh = *static_cast<const Mesh *>(surface_ob.data); const Span<MVert> verts = surface_mesh.verts(); const Span<MLoop> loops = surface_mesh.loops(); - const Span<MLoopTri> surface_looptris = {BKE_mesh_runtime_looptri_ensure(&surface_mesh), - BKE_mesh_runtime_looptri_len(&surface_mesh)}; + const Span<MLoopTri> surface_looptris = surface_mesh.looptris(); VArraySpan<float2> surface_uv_map; if (curves_id.surface_uv_map != nullptr) { const bke::AttributeAccessor surface_attributes = surface_mesh.attributes(); diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc index b5d739ae08e..00130e6d19e 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc @@ -144,8 +144,7 @@ struct AddOperationExecutor { } surface_verts_eval_ = surface_eval_->verts(); surface_loops_eval_ = surface_eval_->loops(); - surface_looptris_eval_ = {BKE_mesh_runtime_looptri_ensure(surface_eval_), - BKE_mesh_runtime_looptri_len(surface_eval_)}; + surface_looptris_eval_ = surface_eval_->looptris(); BKE_bvhtree_from_mesh_get(&surface_bvh_eval_, surface_eval_, BVHTREE_FROM_LOOPTRI, 2); BLI_SCOPED_DEFER([&]() { free_bvhtree_from_mesh(&surface_bvh_eval_); }); @@ -206,8 +205,7 @@ struct AddOperationExecutor { return; } - const Span<MLoopTri> surface_looptris_orig = {BKE_mesh_runtime_looptri_ensure(&surface_orig), - BKE_mesh_runtime_looptri_len(&surface_orig)}; + const Span<MLoopTri> surface_looptris_orig = surface_orig.looptris(); /* Find normals. */ if (!CustomData_has_layer(&surface_orig.ldata, CD_NORMAL)) { diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_density.cc b/source/blender/editors/sculpt_paint/curves_sculpt_density.cc index a37eb4bb560..1e598e6bc5b 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_density.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_density.cc @@ -132,8 +132,7 @@ struct DensityAddOperationExecutor { BKE_bvhtree_from_mesh_get(&surface_bvh_eval_, surface_eval_, BVHTREE_FROM_LOOPTRI, 2); BLI_SCOPED_DEFER([&]() { free_bvhtree_from_mesh(&surface_bvh_eval_); }); - surface_looptris_eval_ = {BKE_mesh_runtime_looptri_ensure(surface_eval_), - BKE_mesh_runtime_looptri_len(surface_eval_)}; + surface_looptris_eval_ = surface_eval_->looptris(); /* Find UV map. */ VArraySpan<float2> surface_uv_map; if (curves_id_orig_->surface_uv_map != nullptr) { @@ -265,8 +264,7 @@ struct DensityAddOperationExecutor { reinterpret_cast<const float3 *>(CustomData_get_layer(&surface_orig_->ldata, CD_NORMAL)), surface_orig_->totloop}; - const Span<MLoopTri> surface_looptris_orig = {BKE_mesh_runtime_looptri_ensure(surface_orig_), - BKE_mesh_runtime_looptri_len(surface_orig_)}; + const Span<MLoopTri> surface_looptris_orig = surface_orig_->looptris(); const geometry::ReverseUVSampler reverse_uv_sampler{surface_uv_map, surface_looptris_orig}; geometry::AddCurvesOnMeshInputs add_inputs; diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_puff.cc b/source/blender/editors/sculpt_paint/curves_sculpt_puff.cc index ec69aae372c..b4e949106e7 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_puff.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_puff.cc @@ -121,8 +121,7 @@ struct PuffOperationExecutor { surface_verts_ = surface_->verts(); surface_loops_ = surface_->loops(); - surface_looptris_ = {BKE_mesh_runtime_looptri_ensure(surface_), - BKE_mesh_runtime_looptri_len(surface_)}; + surface_looptris_ = surface_->looptris(); BKE_bvhtree_from_mesh_get(&surface_bvh_, surface_, BVHTREE_FROM_LOOPTRI, 2); BLI_SCOPED_DEFER([&]() { free_bvhtree_from_mesh(&surface_bvh_); }); diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc b/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc index 1108f5c72a9..c607f8f3b69 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc @@ -178,8 +178,7 @@ struct SlideOperationExecutor { report_empty_original_surface(stroke_extension.reports); return; } - surface_looptris_orig_ = {BKE_mesh_runtime_looptri_ensure(surface_orig_), - BKE_mesh_runtime_looptri_len(surface_orig_)}; + surface_looptris_orig_ = surface_orig_->looptris(); surface_uv_map_orig_ = surface_orig_->attributes().lookup<float2>(uv_map_name, ATTR_DOMAIN_CORNER); if (surface_uv_map_orig_.is_empty()) { @@ -205,8 +204,7 @@ struct SlideOperationExecutor { report_empty_evaluated_surface(stroke_extension.reports); return; } - surface_looptris_eval_ = {BKE_mesh_runtime_looptri_ensure(surface_eval_), - BKE_mesh_runtime_looptri_len(surface_eval_)}; + surface_looptris_eval_ = surface_eval_->looptris(); surface_verts_eval_ = surface_eval_->verts(); surface_loops_eval_ = surface_eval_->loops(); surface_uv_map_eval_ = surface_eval_->attributes().lookup<float2>(uv_map_name, |