From 93508ab2dff9def0b9af4fa489712a2cd75bfbea Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 1 Mar 2023 22:30:38 -0500 Subject: [PATCH] Cleanup: Make mesh validation functions static These functions used internal values and only really make sense in the context of the mesh validation process where they're used to remove invalid elements from the mesh. --- source/blender/blenkernel/BKE_mesh.h | 13 ++----------- source/blender/blenkernel/intern/mesh_validate.cc | 11 +++++++---- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index ba162782251..57bde3b637a 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -871,15 +871,6 @@ bool BKE_mesh_validate_all_customdata(struct CustomData *vdata, bool *r_change); void BKE_mesh_strip_loose_faces(struct Mesh *me); -/** - * Works on both loops and polys! - * - * \note It won't try to guess which loops of an invalid poly to remove! - * this is the work of the caller, to mark those loops. - * See e.g. #BKE_mesh_validate_arrays(). - */ -void BKE_mesh_strip_loose_polysloops(struct Mesh *me); -void BKE_mesh_strip_loose_edges(struct Mesh *me); /** * Calculate edges from polygons. @@ -921,7 +912,7 @@ void BKE_mesh_debug_print(const struct Mesh *me) ATTR_NONNULL(1); /** * \return The material index for each polygon. May be null. - * \note In C++ code, prefer using the attribute API (#MutableAttributeAccessor)/ + * \note In C++ code, prefer using the attribute API (#AttributeAccessor). */ BLI_INLINE const int *BKE_mesh_material_indices(const Mesh *mesh) { @@ -930,7 +921,7 @@ BLI_INLINE const int *BKE_mesh_material_indices(const Mesh *mesh) /** * \return The material index for each polygon. Create the layer if it doesn't exist. - * \note In C++ code, prefer using the attribute API (#MutableAttributeAccessor)/ + * \note In C++ code, prefer using the attribute API (#MutableAttributeAccessor). */ BLI_INLINE int *BKE_mesh_material_indices_for_write(Mesh *mesh) { diff --git a/source/blender/blenkernel/intern/mesh_validate.cc b/source/blender/blenkernel/intern/mesh_validate.cc index f6adf1247bc..39c18a6cf46 100644 --- a/source/blender/blenkernel/intern/mesh_validate.cc +++ b/source/blender/blenkernel/intern/mesh_validate.cc @@ -42,6 +42,9 @@ using blender::Span; static CLG_LogRef LOG = {"bke.mesh"}; +void mesh_strip_polysloops(Mesh *me); +void mesh_strip_edges(Mesh *me); + /* -------------------------------------------------------------------- */ /** \name Internal functions * \{ */ @@ -862,11 +865,11 @@ bool BKE_mesh_validate_arrays(Mesh *mesh, } if (free_flag.polyloops) { - BKE_mesh_strip_loose_polysloops(mesh); + mesh_strip_polysloops(mesh); } if (free_flag.edges) { - BKE_mesh_strip_loose_edges(mesh); + mesh_strip_edges(mesh); } if (recalc_flag.edges) { @@ -1205,7 +1208,7 @@ void BKE_mesh_strip_loose_faces(Mesh *me) } } -void BKE_mesh_strip_loose_polysloops(Mesh *me) +void mesh_strip_polysloops(Mesh *me) { MutableSpan polys = me->polys_for_write(); MutableSpan loops = me->loops_for_write(); @@ -1279,7 +1282,7 @@ void BKE_mesh_strip_loose_polysloops(Mesh *me) MEM_freeN(new_idx); } -void BKE_mesh_strip_loose_edges(Mesh *me) +void mesh_strip_edges(Mesh *me) { MEdge *e; int a, b;