diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-07 08:06:31 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-07 08:06:31 +0300 |
commit | be038b844cb53bc228d3e98bfe09071560930cde (patch) | |
tree | 13de4a3fc3b49a8b2075a0413dc8261603fbc718 /source/blender/io/wavefront_obj | |
parent | 20daaeffce4cf9bfe48ab7c84cb9e2b1d71d2c91 (diff) |
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.
Diffstat (limited to 'source/blender/io/wavefront_obj')
3 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc index 272afe4a843..cd724152b05 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc +++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc @@ -189,7 +189,7 @@ void OBJMesh::ensure_mesh_edges() const void OBJMesh::calc_smooth_groups(const bool use_bitflags) { const Span<MEdge> edges = export_mesh_eval_->edges(); - const Span<MPoly> polys = export_mesh_eval_->polygons(); + const Span<MPoly> polys = export_mesh_eval_->polys(); const Span<MLoop> loops = export_mesh_eval_->loops(); poly_smooth_groups_ = BKE_mesh_calc_smoothgroups(edges.data(), edges.size(), @@ -242,7 +242,7 @@ const Material *OBJMesh::get_object_material(const int16_t mat_nr) const bool OBJMesh::is_ith_poly_smooth(const int poly_index) const { - const Span<MPoly> polygons = export_mesh_eval_->polygons(); + const Span<MPoly> polygons = export_mesh_eval_->polys(); return polygons[poly_index].flag & ME_SMOOTH; } @@ -268,7 +268,7 @@ const char *OBJMesh::get_object_material_name(const int16_t mat_nr) const float3 OBJMesh::calc_vertex_coords(const int vert_index, const float scaling_factor) const { float3 r_coords; - const Span<MVert> verts = export_mesh_eval_->vertices(); + const Span<MVert> verts = export_mesh_eval_->verts(); copy_v3_v3(r_coords, verts[vert_index].co); mul_m4_v3(world_and_axes_transform_, r_coords); mul_v3_fl(r_coords, scaling_factor); @@ -277,7 +277,7 @@ float3 OBJMesh::calc_vertex_coords(const int vert_index, const float scaling_fac Vector<int> OBJMesh::calc_poly_vertex_indices(const int poly_index) const { - const Span<MPoly> polys = export_mesh_eval_->polygons(); + const Span<MPoly> polys = export_mesh_eval_->polys(); const Span<MLoop> loops = export_mesh_eval_->loops(); const MPoly &mpoly = polys[poly_index]; const MLoop *mloop = &loops[mpoly.loopstart]; @@ -291,7 +291,7 @@ Vector<int> OBJMesh::calc_poly_vertex_indices(const int poly_index) const void OBJMesh::store_uv_coords_and_indices() { - const Span<MPoly> polys = export_mesh_eval_->polygons(); + const Span<MPoly> polys = export_mesh_eval_->polys(); const Span<MLoop> loops = export_mesh_eval_->loops(); const int totvert = export_mesh_eval_->totvert; const MLoopUV *mloopuv = static_cast<const MLoopUV *>( @@ -347,8 +347,8 @@ Span<int> OBJMesh::calc_poly_uv_indices(const int poly_index) const float3 OBJMesh::calc_poly_normal(const int poly_index) const { float3 r_poly_normal; - const Span<MVert> verts = export_mesh_eval_->vertices(); - const Span<MPoly> polys = export_mesh_eval_->polygons(); + const Span<MVert> verts = export_mesh_eval_->verts(); + const Span<MPoly> polys = export_mesh_eval_->polys(); const Span<MLoop> loops = export_mesh_eval_->loops(); const MPoly &poly = polys[poly_index]; BKE_mesh_calc_poly_normal(&poly, &loops[poly.loopstart], verts.data(), r_poly_normal); @@ -375,7 +375,7 @@ static float3 round_float3_to_n_digits(const float3 &v, int round_digits) void OBJMesh::store_normal_coords_and_indices() { - const Span<MPoly> polys = export_mesh_eval_->polygons(); + const Span<MPoly> polys = export_mesh_eval_->polys(); /* We'll round normal components to 4 digits. * This will cover up some minor differences @@ -436,7 +436,7 @@ Vector<int> OBJMesh::calc_poly_normal_indices(const int poly_index) const if (loop_to_normal_index_.is_empty()) { return {}; } - const Span<MPoly> polys = export_mesh_eval_->polygons(); + const Span<MPoly> polys = export_mesh_eval_->polys(); const MPoly &mpoly = polys[poly_index]; const int totloop = mpoly.totloop; Vector<int> r_poly_normal_indices(totloop); @@ -460,7 +460,7 @@ int16_t OBJMesh::get_poly_deform_group_index(const int poly_index, { BLI_assert(poly_index < export_mesh_eval_->totpoly); BLI_assert(group_weights.size() == BKE_object_defgroup_count(&export_object_eval_)); - const Span<MPoly> polys = export_mesh_eval_->polygons(); + const Span<MPoly> polys = export_mesh_eval_->polys(); const Span<MLoop> loops = export_mesh_eval_->loops(); const Span<MDeformVert> dverts = export_mesh_eval_->deform_verts(); if (dverts.is_empty()) { diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc b/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc index 4b4609c053b..84f1c6dd6b0 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc +++ b/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc @@ -158,7 +158,7 @@ void MeshFromGeometry::fixup_invalid_faces() void MeshFromGeometry::create_vertices(Mesh *mesh) { - MutableSpan<MVert> verts = mesh->vertices_for_write(); + MutableSpan<MVert> verts = mesh->verts_for_write(); /* Go through all the global vertex indices from min to max, * checking which ones are actually and building a global->local * index mapping. Write out the used vertex positions into the Mesh @@ -185,7 +185,7 @@ void MeshFromGeometry::create_polys_loops(Mesh *mesh, bool use_vertex_groups) dverts = mesh->deform_verts_for_write(); } - MutableSpan<MPoly> polys = mesh->polygons_for_write(); + MutableSpan<MPoly> polys = mesh->polys_for_write(); MutableSpan<MLoop> loops = mesh->loops_for_write(); bke::SpanAttributeWriter<int> material_indices = bke::mesh_attributes_for_write(*mesh).lookup_or_add_for_write_only_span<int>( diff --git a/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc b/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc index 669a7ba80cf..99e12aed99c 100644 --- a/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc +++ b/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc @@ -96,7 +96,7 @@ class obj_importer_test : public BlendfileLoadingBaseTest { EXPECT_EQ(mesh->totedge, exp.mesh_totedge_or_curve_endp); EXPECT_EQ(mesh->totpoly, exp.mesh_totpoly_or_curve_order); EXPECT_EQ(mesh->totloop, exp.mesh_totloop_or_curve_cyclic); - const Span<MVert> verts = mesh->vertices(); + const Span<MVert> verts = mesh->verts(); EXPECT_V3_NEAR(verts.first().co, exp.vert_first, 0.0001f); EXPECT_V3_NEAR(verts.last().co, exp.vert_last, 0.0001f); const float3 *lnors = (const float3 *)(CustomData_get_layer(&mesh->ldata, CD_NORMAL)); |