Cleanup: use short names for verts & polys as they're unambiguous
Follow conventions used in most existing code.
This commit is contained in:
parent
0c0c361123
commit
d4a082bc70
|
@ -136,13 +136,13 @@ static void make_edges_mdata_extend(Mesh &mesh)
|
|||
const MPoly *mp;
|
||||
int i;
|
||||
|
||||
Span<MPoly> polygons(mesh.mpoly, mesh.totpoly);
|
||||
Span<MPoly> polys(mesh.mpoly, mesh.totpoly);
|
||||
MutableSpan<MLoop> loops(mesh.mloop, mesh.totloop);
|
||||
|
||||
const int eh_reserve = max_ii(totedge, BLI_EDGEHASH_SIZE_GUESS_FROM_POLYS(mesh.totpoly));
|
||||
EdgeHash *eh = BLI_edgehash_new_ex(__func__, eh_reserve);
|
||||
|
||||
for (const MPoly &poly : polygons) {
|
||||
for (const MPoly &poly : polys) {
|
||||
BKE_mesh_poly_edgehash_insert(eh, &poly, &loops[poly.loopstart]);
|
||||
}
|
||||
|
||||
|
@ -240,14 +240,14 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
|
|||
}
|
||||
|
||||
Mesh *mesh = BKE_mesh_new_nomain(totvert, totedge, 0, totloop, totpoly);
|
||||
MutableSpan<MVert> vertices(mesh->mvert, mesh->totvert);
|
||||
MutableSpan<MVert> verts(mesh->mvert, mesh->totvert);
|
||||
MutableSpan<MEdge> edges(mesh->medge, mesh->totedge);
|
||||
MutableSpan<MPoly> polygons(mesh->mpoly, mesh->totpoly);
|
||||
MutableSpan<MPoly> polys(mesh->mpoly, mesh->totpoly);
|
||||
MutableSpan<MLoop> loops(mesh->mloop, mesh->totloop);
|
||||
|
||||
MVert *mvert = vertices.data();
|
||||
MVert *mvert = verts.data();
|
||||
MEdge *medge = edges.data();
|
||||
MPoly *mpoly = polygons.data();
|
||||
MPoly *mpoly = polys.data();
|
||||
MLoop *mloop = loops.data();
|
||||
MLoopUV *mloopuv = static_cast<MLoopUV *>(CustomData_add_layer_named(
|
||||
&mesh->ldata, CD_MLOOPUV, CD_CALLOC, nullptr, mesh->totloop, "UVMap"));
|
||||
|
|
|
@ -887,12 +887,12 @@ void BKE_mesh_legacy_convert_hide_layers_to_flags(Mesh *mesh)
|
|||
using namespace blender::bke;
|
||||
const AttributeAccessor attributes = mesh_attributes(*mesh);
|
||||
|
||||
MutableSpan<MVert> vertices(mesh->mvert, mesh->totvert);
|
||||
MutableSpan<MVert> verts(mesh->mvert, mesh->totvert);
|
||||
const VArray<bool> hide_vert = attributes.lookup_or_default<bool>(
|
||||
".hide_vert", ATTR_DOMAIN_POINT, false);
|
||||
threading::parallel_for(vertices.index_range(), 4096, [&](IndexRange range) {
|
||||
threading::parallel_for(verts.index_range(), 4096, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
SET_FLAG_FROM_TEST(vertices[i].flag, hide_vert[i], ME_HIDE);
|
||||
SET_FLAG_FROM_TEST(verts[i].flag, hide_vert[i], ME_HIDE);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -905,12 +905,12 @@ void BKE_mesh_legacy_convert_hide_layers_to_flags(Mesh *mesh)
|
|||
}
|
||||
});
|
||||
|
||||
MutableSpan<MPoly> polygons(mesh->mpoly, mesh->totpoly);
|
||||
MutableSpan<MPoly> polys(mesh->mpoly, mesh->totpoly);
|
||||
const VArray<bool> hide_poly = attributes.lookup_or_default<bool>(
|
||||
".hide_poly", ATTR_DOMAIN_FACE, false);
|
||||
threading::parallel_for(polygons.index_range(), 4096, [&](IndexRange range) {
|
||||
threading::parallel_for(polys.index_range(), 4096, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
SET_FLAG_FROM_TEST(polygons[i].flag, hide_poly[i], ME_HIDE);
|
||||
SET_FLAG_FROM_TEST(polys[i].flag, hide_poly[i], ME_HIDE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -921,15 +921,14 @@ void BKE_mesh_legacy_convert_flags_to_hide_layers(Mesh *mesh)
|
|||
using namespace blender::bke;
|
||||
MutableAttributeAccessor attributes = mesh_attributes_for_write(*mesh);
|
||||
|
||||
const Span<MVert> vertices(mesh->mvert, mesh->totvert);
|
||||
if (std::any_of(vertices.begin(), vertices.end(), [](const MVert &vert) {
|
||||
return vert.flag & ME_HIDE;
|
||||
})) {
|
||||
const Span<MVert> verts(mesh->mvert, mesh->totvert);
|
||||
if (std::any_of(
|
||||
verts.begin(), verts.end(), [](const MVert &vert) { return vert.flag & ME_HIDE; })) {
|
||||
SpanAttributeWriter<bool> hide_vert = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".hide_vert", ATTR_DOMAIN_POINT);
|
||||
threading::parallel_for(vertices.index_range(), 4096, [&](IndexRange range) {
|
||||
threading::parallel_for(verts.index_range(), 4096, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
hide_vert.span[i] = vertices[i].flag & ME_HIDE;
|
||||
hide_vert.span[i] = verts[i].flag & ME_HIDE;
|
||||
}
|
||||
});
|
||||
hide_vert.finish();
|
||||
|
@ -948,15 +947,14 @@ void BKE_mesh_legacy_convert_flags_to_hide_layers(Mesh *mesh)
|
|||
hide_edge.finish();
|
||||
}
|
||||
|
||||
const Span<MPoly> polygons(mesh->mpoly, mesh->totpoly);
|
||||
if (std::any_of(polygons.begin(), polygons.end(), [](const MPoly &poly) {
|
||||
return poly.flag & ME_HIDE;
|
||||
})) {
|
||||
const Span<MPoly> polys(mesh->mpoly, mesh->totpoly);
|
||||
if (std::any_of(
|
||||
polys.begin(), polys.end(), [](const MPoly &poly) { return poly.flag & ME_HIDE; })) {
|
||||
SpanAttributeWriter<bool> hide_poly = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".hide_poly", ATTR_DOMAIN_FACE);
|
||||
threading::parallel_for(polygons.index_range(), 4096, [&](IndexRange range) {
|
||||
threading::parallel_for(polys.index_range(), 4096, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
hide_poly.span[i] = polygons[i].flag & ME_HIDE;
|
||||
hide_poly.span[i] = polys[i].flag & ME_HIDE;
|
||||
}
|
||||
});
|
||||
hide_poly.finish();
|
||||
|
|
|
@ -633,10 +633,10 @@ void paintvert_hide(bContext *C, Object *ob, const bool unselected)
|
|||
bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*me);
|
||||
bke::SpanAttributeWriter<bool> hide_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".hide_vert", ATTR_DOMAIN_POINT);
|
||||
MutableSpan<MVert> vertices(me->mvert, me->totvert);
|
||||
MutableSpan<MVert> verts(me->mvert, me->totvert);
|
||||
|
||||
for (const int i : vertices.index_range()) {
|
||||
MVert &vert = vertices[i];
|
||||
for (const int i : verts.index_range()) {
|
||||
MVert &vert = verts[i];
|
||||
if (!hide_vert.span[i]) {
|
||||
if (((vert.flag & SELECT) == 0) == unselected) {
|
||||
hide_vert.span[i] = true;
|
||||
|
@ -666,10 +666,10 @@ void paintvert_reveal(bContext *C, Object *ob, const bool select)
|
|||
bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*me);
|
||||
const VArray<bool> hide_vert = attributes.lookup_or_default<bool>(
|
||||
".hide_vert", ATTR_DOMAIN_POINT, false);
|
||||
MutableSpan<MVert> vertices(me->mvert, me->totvert);
|
||||
MutableSpan<MVert> verts(me->mvert, me->totvert);
|
||||
|
||||
for (const int i : vertices.index_range()) {
|
||||
MVert &vert = vertices[i];
|
||||
for (const int i : verts.index_range()) {
|
||||
MVert &vert = verts[i];
|
||||
if (hide_vert[i]) {
|
||||
SET_FLAG_FROM_TEST(vert.flag, select, SELECT);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue