bmesh api: add 'is_boundary' attribute to verts.

This commit is contained in:
Campbell Barton 2013-05-14 02:56:24 +00:00
parent 6ea2dec330
commit c838b2d2a7
3 changed files with 30 additions and 0 deletions

@ -821,6 +821,25 @@ int BM_edge_is_boundary(BMEdge *e)
}
#endif
bool BM_vert_is_boundary(BMVert *v)
{
if (v->e) {
BMEdge *e_first, *e_iter;
e_first = e_iter = v->e;
do {
if (BM_edge_is_boundary(e_iter)) {
return true;
}
} while ((e_iter = bmesh_disk_edge_next(e_iter, v)) != e_first);
return false;
}
else {
return false;
}
}
/**
* Returns the number of faces that are adjacent to both f1 and f2,
* \note Could be sped up a bit by not using iterators and by tagging

@ -61,6 +61,7 @@ bool BM_edge_is_wire(BMEdge *e);
bool BM_vert_is_manifold(BMVert *v);
bool BM_edge_is_manifold(BMEdge *e);
bool BM_vert_is_boundary(BMVert *v);
bool BM_edge_is_boundary(BMEdge *e);
bool BM_edge_is_contiguous(BMEdge *e);
bool BM_edge_is_convex(BMEdge *e);

@ -401,6 +401,15 @@ static PyObject *bpy_bmvert_is_wire_get(BPy_BMVert *self)
return PyBool_FromLong(BM_vert_is_wire(self->v));
}
PyDoc_STRVAR(bpy_bmvert_is_boundary_doc,
"True when this vertex connected to any boundary edges (read-only).\n\n:type: boolean"
);
static PyObject *bpy_bmvert_is_boundary_get(BPy_BMVert *self)
{
BPY_BM_CHECK_OBJ(self);
return PyBool_FromLong(BM_vert_is_boundary(self->v));
}
/* Edge
* ^^^^ */
@ -685,6 +694,7 @@ static PyGetSetDef bpy_bmvert_getseters[] = {
/* readonly checks */
{(char *)"is_manifold", (getter)bpy_bmvert_is_manifold_get, (setter)NULL, (char *)bpy_bmvert_is_manifold_doc, NULL},
{(char *)"is_wire", (getter)bpy_bmvert_is_wire_get, (setter)NULL, (char *)bpy_bmvert_is_wire_doc, NULL},
{(char *)"is_boundary", (getter)bpy_bmvert_is_boundary_get, (setter)NULL, (char *)bpy_bmvert_is_boundary_doc, NULL},
{(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */