BMesh: remove checks for tessellating 2 sided faces

2 sided faces aren't supported and will cause problems in many areas
of Blender's code.

Removing (implied) support for faces with fewer than 3 sides
means the total number of triangles is known ahead of time.

This simplifies adding support for multi-threading and partial updates
to an existing tessellation - as the face and loop indices can be used
to access the range of triangles associated with a face.

Also correct outdated comments.
This commit is contained in:
2021-06-01 12:49:22 +10:00
parent f8ce744c83
commit 5e7fb77dc4
7 changed files with 21 additions and 36 deletions

View File

@@ -1385,7 +1385,6 @@ static PyObject *bpy_bmesh_calc_loop_triangles(BPy_BMElem *self)
BMesh *bm;
int looptris_tot;
int tottri;
BMLoop *(*looptris)[3];
PyObject *ret;
@@ -1398,10 +1397,10 @@ static PyObject *bpy_bmesh_calc_loop_triangles(BPy_BMElem *self)
looptris_tot = poly_to_tri_count(bm->totface, bm->totloop);
looptris = PyMem_MALLOC(sizeof(*looptris) * looptris_tot);
BM_mesh_calc_tessellation(bm, looptris, &tottri);
BM_mesh_calc_tessellation(bm, looptris);
ret = PyList_New(tottri);
for (i = 0; i < tottri; i++) {
ret = PyList_New(looptris_tot);
for (i = 0; i < looptris_tot; i++) {
PyList_SET_ITEM(ret, i, BPy_BMLoop_Array_As_Tuple(bm, looptris[i], 3));
}

View File

@@ -961,8 +961,6 @@ static PyObject *C_BVHTree_FromBMesh(PyObject *UNUSED(cls), PyObject *args, PyOb
/* Get data for tessellation */
{
int tris_len_dummy;
coords_len = (uint)bm->totvert;
tris_len = (uint)poly_to_tri_count(bm->totface, bm->totloop);
@@ -971,8 +969,7 @@ static PyObject *C_BVHTree_FromBMesh(PyObject *UNUSED(cls), PyObject *args, PyOb
looptris = MEM_mallocN(sizeof(*looptris) * (size_t)tris_len, __func__);
BM_mesh_calc_tessellation(bm, looptris, &tris_len_dummy);
BLI_assert(tris_len_dummy == (int)tris_len);
BM_mesh_calc_tessellation(bm, looptris);
}
{