BMesh optimize face splitting by taking loops rather then verts

- add BM_vert_pair_share_face
- add BM_loop_is_adjacent
- remove BM_verts_connect
This commit is contained in:
2013-12-24 11:04:03 +11:00
parent d94db03ac8
commit 04a902965e
20 changed files with 232 additions and 180 deletions

View File

@@ -401,6 +401,7 @@ static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args,
BMesh *bm;
BMFace *f_new = NULL;
BMLoop *l_new = NULL;
BMLoop *l_a, *l_b;
if (!PyArg_ParseTupleAndKeywords(args, kw, "O!O!O!|OiO!:face_split", (char **)kwlist,
&BPy_BMFace_Type, &py_face,
@@ -422,9 +423,12 @@ static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args,
}
/* this doubles for checking that the verts are in the same mesh */
if (BM_vert_in_face(py_face->f, py_vert_a->v) == false ||
BM_vert_in_face(py_face->f, py_vert_b->v) == false)
if ((l_a = BM_face_vert_share_loop(py_face->f, py_vert_a->v)) &&
(l_b = BM_face_vert_share_loop(py_face->f, py_vert_b->v)))
{
/* pass */
}
else {
PyErr_SetString(PyExc_ValueError,
"face_split(...): one of the verts passed is not found in the face");
return NULL;
@@ -448,14 +452,14 @@ static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args,
if (ncoords) {
f_new = BM_face_split_n(bm, py_face->f,
py_vert_a->v, py_vert_b->v,
l_a, l_b,
(float (*)[3])coords, ncoords,
&l_new, py_edge_example ? py_edge_example->e : NULL);
PyMem_Free(coords);
}
else {
f_new = BM_face_split(bm, py_face->f,
py_vert_a->v, py_vert_b->v,
l_a, l_b,
&l_new, py_edge_example ? py_edge_example->e : NULL, edge_exists);
}