Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-05-14 06:56:24 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-05-14 06:56:24 +0400
commitc838b2d2a7708d9d9afddc9dc40b3638f4b917a5 (patch)
tree63b7e488f548f0e2c364ff88124bc514ef72fd2c /source
parent6ea2dec330a0d460deb1396f258c461be34fa3c8 (diff)
bmesh api: add 'is_boundary' attribute to verts.
Diffstat (limited to 'source')
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c19
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.h1
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c10
3 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index 8a1d513a8fc..aefea576563 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -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
diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h
index 6b1bfca2d80..47b6d87f91a 100644
--- a/source/blender/bmesh/intern/bmesh_queries.h
+++ b/source/blender/bmesh/intern/bmesh_queries.h
@@ -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);
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 2a0964cefbd..e6f9958d1d1 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -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 */