Mesh: Rename "polys" to "faces"

Implements part of #101689.

The "poly" name was chosen to distinguish the `MLoop` + `MPoly`
combination from the `MFace` struct it replaced. Those two structures
persisted together for a long time, but nowadays `MPoly` is gone, and
`MFace` is only used in some legacy code like the particle system.

To avoid unnecessarily using a different term, increase consistency
with the UI and with BMesh, and generally make code a bit easier to
read, this commit replaces the `poly` term with `poly`. Most variables
that use the term are renamed too. `Mesh.totface` and `Mesh.fdata` now
have a `_legacy` suffix to reduce confusion. In a next step, `pdata`
can be renamed to `face_data` as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/109819
This commit is contained in:
Hans Goudey
2023-07-24 22:06:55 +02:00
committed by Hans Goudey
parent 13ec961c4a
commit 5e9ea9243b
320 changed files with 6213 additions and 6155 deletions

View File

@@ -1145,7 +1145,7 @@ static PyObject *C_BVHTree_FromObject(PyObject * /*cls*/, PyObject *args, PyObje
const blender::Span<int> corner_verts = mesh->corner_verts();
const blender::Span<MLoopTri> looptris = mesh->looptris();
const blender::Span<int> looptri_polys = mesh->looptri_polys();
const blender::Span<int> looptri_faces = mesh->looptri_faces();
/* Get data for tessellation */
@@ -1167,11 +1167,11 @@ static PyObject *C_BVHTree_FromObject(PyObject * /*cls*/, PyObject *args, PyObje
if (tree) {
orig_index = static_cast<int *>(
MEM_mallocN(sizeof(*orig_index) * size_t(looptris.size()), __func__));
if (!BKE_mesh_poly_normals_are_dirty(mesh)) {
const blender::Span<blender::float3> poly_normals = mesh->poly_normals();
if (!BKE_mesh_face_normals_are_dirty(mesh)) {
const blender::Span<blender::float3> face_normals = mesh->face_normals();
orig_normal = static_cast<blender::float3 *>(
MEM_malloc_arrayN(size_t(mesh->totpoly), sizeof(blender::float3), __func__));
blender::MutableSpan(orig_normal, poly_normals.size()).copy_from(poly_normals);
MEM_malloc_arrayN(size_t(mesh->faces_num), sizeof(blender::float3), __func__));
blender::MutableSpan(orig_normal, face_normals.size()).copy_from(face_normals);
}
for (const int64_t i : looptris.index_range()) {
@@ -1186,7 +1186,7 @@ static PyObject *C_BVHTree_FromObject(PyObject * /*cls*/, PyObject *args, PyObje
copy_v3_v3(co[2], coords[tris[i][2]]);
BLI_bvhtree_insert(tree, int(i), co[0], 3);
orig_index[i] = int(looptri_polys[i]);
orig_index[i] = int(looptri_faces[i]);
}
BLI_bvhtree_balance(tree);