From be038b844cb53bc228d3e98bfe09071560930cde Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 7 Sep 2022 00:06:31 -0500 Subject: Cleanup: Tweak naming for recently added mesh accessors Use `verts` instead of `vertices` and `polys` instead of `polygons` in the API added in 05952aa94d33eeb50. This aligns better with existing naming where the shorter names are much more common. --- source/blender/editors/mesh/editface.cc | 32 +++++++++++++++---------------- source/blender/editors/mesh/mesh_data.cc | 10 +++++----- source/blender/editors/mesh/mesh_mirror.c | 2 +- source/blender/editors/mesh/meshtools.cc | 10 +++++----- 4 files changed, 27 insertions(+), 27 deletions(-) (limited to 'source/blender/editors/mesh') diff --git a/source/blender/editors/mesh/editface.cc b/source/blender/editors/mesh/editface.cc index 6313c01011e..26184acc8b4 100644 --- a/source/blender/editors/mesh/editface.cc +++ b/source/blender/editors/mesh/editface.cc @@ -73,11 +73,11 @@ void paintface_flush_flags(bContext *C, Mesh *me_eval = (Mesh *)ob_eval->runtime.data_eval; bke::MutableAttributeAccessor attributes_eval = bke::mesh_attributes_for_write(*me_eval); bool updated = false; - const Span me_polys = me->polygons(); + const Span me_polys = me->polys(); if (me_orig != nullptr && me_eval != nullptr && me_orig->totpoly == me->totpoly) { /* Update the COW copy of the mesh. */ - MutableSpan orig_polys = me_orig->polygons_for_write(); + MutableSpan orig_polys = me_orig->polys_for_write(); for (int i = 0; i < me->totpoly; i++) { orig_polys[i].flag = me_polys[i].flag; } @@ -92,7 +92,7 @@ void paintface_flush_flags(bContext *C, /* Mesh polys => Final derived polys */ if ((index_array = (const int *)CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX))) { - MutableSpan eval_polys = me_orig->polygons_for_write(); + MutableSpan eval_polys = me_orig->polys_for_write(); /* loop over final derived polys */ for (const int i : eval_polys.index_range()) { if (index_array[i] != ORIGINDEX_NONE) { @@ -141,7 +141,7 @@ void paintface_hide(bContext *C, Object *ob, const bool unselected) return; } - MutableSpan polys = me->polygons_for_write(); + MutableSpan polys = me->polys_for_write(); bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*me); bke::SpanAttributeWriter hide_poly = attributes.lookup_or_add_for_write_span( ".hide_poly", ATTR_DOMAIN_FACE); @@ -174,7 +174,7 @@ void paintface_reveal(bContext *C, Object *ob, const bool select) return; } - MutableSpan polys = me->polygons_for_write(); + MutableSpan polys = me->polys_for_write(); bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*me); if (select) { @@ -207,7 +207,7 @@ static void select_linked_tfaces_with_seams(Mesh *me, const uint index, const bo BLI_bitmap *poly_tag = BLI_BITMAP_NEW(me->totpoly, __func__); const Span edges = me->edges(); - MutableSpan polys = me->polygons_for_write(); + MutableSpan polys = me->polys_for_write(); const Span loops = me->loops(); bke::AttributeAccessor attributes = bke::mesh_attributes(*me); const VArray hide_poly = attributes.lookup_or_default( @@ -305,7 +305,7 @@ bool paintface_deselect_all_visible(bContext *C, Object *ob, int action, bool fl return false; } - MutableSpan polys = me->polygons_for_write(); + MutableSpan polys = me->polys_for_write(); bke::AttributeAccessor attributes = bke::mesh_attributes(*me); const VArray hide_poly = attributes.lookup_or_default( ".hide_poly", ATTR_DOMAIN_FACE, false); @@ -369,8 +369,8 @@ bool paintface_minmax(Object *ob, float r_min[3], float r_max[3]) copy_m3_m4(bmat, ob->obmat); - const Span verts = me->vertices(); - const Span polys = me->polygons(); + const Span verts = me->verts(); + const Span polys = me->polys(); const Span loops = me->loops(); bke::AttributeAccessor attributes = bke::mesh_attributes(*me); const VArray hide_poly = attributes.lookup_or_default( @@ -409,7 +409,7 @@ bool paintface_mouse_select(bContext *C, /* Get the face under the cursor */ Mesh *me = BKE_mesh_from_object(ob); - MutableSpan polys = me->polygons_for_write(); + MutableSpan polys = me->polys_for_write(); bke::AttributeAccessor attributes = bke::mesh_attributes(*me); const VArray hide_poly = attributes.lookup_or_default( ".hide_poly", ATTR_DOMAIN_FACE, false); @@ -494,8 +494,8 @@ void paintvert_flush_flags(Object *ob) index_array = (const int *)CustomData_get_layer(&me_eval->vdata, CD_ORIGINDEX); - const Span vertices = me->vertices_for_write(); - MutableSpan vertices_eval = me_eval->vertices_for_write(); + const Span vertices = me->verts_for_write(); + MutableSpan vertices_eval = me_eval->verts_for_write(); if (index_array) { int orig_index; @@ -529,7 +529,7 @@ bool paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags) return false; } - MutableSpan verts = me->vertices_for_write(); + MutableSpan verts = me->verts_for_write(); bke::AttributeAccessor attributes = bke::mesh_attributes(*me); const VArray hide_vert = attributes.lookup_or_default( ".hide_vert", ATTR_DOMAIN_POINT, false); @@ -606,7 +606,7 @@ void paintvert_select_ungrouped(Object *ob, bool extend, bool flush_flags) paintvert_deselect_all_visible(ob, SEL_DESELECT, false); } - MutableSpan verts = me->vertices_for_write(); + MutableSpan verts = me->verts_for_write(); bke::AttributeAccessor attributes = bke::mesh_attributes(*me); const VArray hide_vert = attributes.lookup_or_default( ".hide_vert", ATTR_DOMAIN_POINT, false); @@ -635,7 +635,7 @@ void paintvert_hide(bContext *C, Object *ob, const bool unselected) return; } - MutableSpan verts = me->vertices_for_write(); + MutableSpan verts = me->verts_for_write(); bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*me); bke::SpanAttributeWriter hide_vert = attributes.lookup_or_add_for_write_span( ".hide_vert", ATTR_DOMAIN_POINT); @@ -668,7 +668,7 @@ void paintvert_reveal(bContext *C, Object *ob, const bool select) return; } - MutableSpan verts = me->vertices_for_write(); + MutableSpan verts = me->verts_for_write(); bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*me); const VArray hide_vert = attributes.lookup_or_default( ".hide_vert", ATTR_DOMAIN_POINT, false); diff --git a/source/blender/editors/mesh/mesh_data.cc b/source/blender/editors/mesh/mesh_data.cc index 09673b3d7ad..4ee518b5662 100644 --- a/source/blender/editors/mesh/mesh_data.cc +++ b/source/blender/editors/mesh/mesh_data.cc @@ -225,7 +225,7 @@ void ED_mesh_uv_loop_reset_ex(Mesh *me, const int layernum) BLI_assert(CustomData_has_layer(&me->ldata, CD_MLOOPUV)); MLoopUV *mloopuv = (MLoopUV *)CustomData_get_layer_n(&me->ldata, CD_MLOOPUV, layernum); - const MPoly *polys = BKE_mesh_polygons(me); + const MPoly *polys = BKE_mesh_polys(me); for (int i = 0; i < me->totpoly; i++) { mesh_uv_reset_mface(&polys[i], mloopuv); } @@ -776,9 +776,9 @@ static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator /* Tag edges as sharp according to smooth threshold if needed, * to preserve autosmooth shading. */ if (me->flag & ME_AUTOSMOOTH) { - const Span verts = me->vertices(); + const Span verts = me->verts(); MutableSpan edges = me->edges_for_write(); - const Span polys = me->polygons(); + const Span polys = me->polys(); const Span loops = me->loops(); BKE_edges_sharp_from_angle_set(verts.data(), @@ -893,7 +893,7 @@ static void mesh_add_verts(Mesh *mesh, int len) const int old_vertex_num = mesh->totvert; mesh->totvert = totvert; - MutableSpan verts = mesh->vertices_for_write(); + MutableSpan verts = mesh->verts_for_write(); for (MVert &vert : verts.drop_front(old_vertex_num)) { vert.flag = SELECT; } @@ -986,7 +986,7 @@ static void mesh_add_polys(Mesh *mesh, int len) const int old_polys_num = mesh->totpoly; mesh->totpoly = totpoly; - MutableSpan polys = mesh->polygons_for_write(); + MutableSpan polys = mesh->polys_for_write(); for (MPoly &poly : polys.drop_front(old_polys_num)) { poly.flag = ME_FACE_SEL; } diff --git a/source/blender/editors/mesh/mesh_mirror.c b/source/blender/editors/mesh/mesh_mirror.c index 905eb5d43e1..ad5a5d362f1 100644 --- a/source/blender/editors/mesh/mesh_mirror.c +++ b/source/blender/editors/mesh/mesh_mirror.c @@ -55,7 +55,7 @@ void ED_mesh_mirror_spatial_table_begin(Object *ob, BMEditMesh *em, Mesh *me_eva } } else { - const MVert *verts = BKE_mesh_vertices(me_eval ? me_eval : me); + const MVert *verts = BKE_mesh_verts(me_eval ? me_eval : me); for (int i = 0; i < totvert; i++) { BLI_kdtree_3d_insert(MirrKdStore.tree, i, verts[i].co); } diff --git a/source/blender/editors/mesh/meshtools.cc b/source/blender/editors/mesh/meshtools.cc index 88c204b56e9..ad7f504c87b 100644 --- a/source/blender/editors/mesh/meshtools.cc +++ b/source/blender/editors/mesh/meshtools.cc @@ -906,7 +906,7 @@ static bool ed_mesh_mirror_topo_table_update(Object *ob, Mesh *me_eval) static int mesh_get_x_mirror_vert_spatial(Object *ob, Mesh *me_eval, int index) { Mesh *me = static_cast(ob->data); - const Span verts = me_eval ? me_eval->vertices() : me->vertices(); + const Span verts = me_eval ? me_eval->verts() : me->verts(); float vec[3]; @@ -1143,7 +1143,7 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, Mesh *me_eval) mirrorverts = static_cast(MEM_callocN(sizeof(int) * totvert, "MirrorVerts")); mirrorfaces = static_cast(MEM_callocN(sizeof(int[2]) * totface, "MirrorFaces")); - const Span verts = me_eval ? me_eval->vertices() : me->vertices(); + const Span verts = me_eval ? me_eval->verts() : me->verts(); MFace *mface = (MFace *)CustomData_get_layer(&(me_eval ? me_eval : me)->fdata, CD_MFACE); ED_mesh_mirror_spatial_table_begin(ob, em, me_eval); @@ -1275,8 +1275,8 @@ bool ED_mesh_pick_face_vert( const float mval_f[2] = {(float)mval[0], (float)mval[1]}; float len_best = FLT_MAX; - const Span verts = me_eval->vertices(); - const Span polys = me_eval->polygons(); + const Span verts = me_eval->verts(); + const Span polys = me_eval->polys(); const Span loops = me_eval->loops(); const int *index_mp_to_orig = (const int *)CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX); @@ -1411,7 +1411,7 @@ bool ED_mesh_pick_vert( } /* setup data */ - const Span verts = me->vertices(); + const Span verts = me->verts(); data.mvert = verts.data(); data.region = region; data.mval_f = mval_f; -- cgit v1.2.3