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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-02-26 08:03:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-02-26 08:03:21 +0300
commit58a394073fcd2cf009724514b483aa36b554c3cd (patch)
treed596057d157b3b831ee43425ad8bc535f43fca61 /source/blender/bmesh/intern/bmesh_query.c
parent2986923f8c62ef78b783991ff5fbf9e8cadb209c (diff)
BMesh: utility functions for visible element access
Needed for drawing code which skips hidden elements.
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_query.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_query.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_query.c b/source/blender/bmesh/intern/bmesh_query.c
index 166712225bd..7a0d1c7ec5a 100644
--- a/source/blender/bmesh/intern/bmesh_query.c
+++ b/source/blender/bmesh/intern/bmesh_query.c
@@ -377,6 +377,13 @@ BMLoop *BM_vert_find_first_loop(BMVert *v)
{
return v->e ? bmesh_disk_faceloop_find_first(v->e, v) : NULL;
}
+/**
+ * A version of #BM_vert_find_first_loop that ignores hidden loops.
+ */
+BMLoop *BM_vert_find_first_loop_visible(BMVert *v)
+{
+ return v->e ? bmesh_disk_faceloop_find_first_visible(v->e, v) : NULL;
+}
/**
* Returns true if the vertex is used in a given face.
@@ -2000,6 +2007,24 @@ BMEdge *BM_edge_find_double(BMEdge *e)
}
/**
+ * Only #BMEdge.l access us needed, however when we want the first visible loop,
+ * a utility function is needed.
+ */
+BMLoop *BM_edge_find_first_loop_visible(BMEdge *e)
+{
+ if (e->l != NULL) {
+ BMLoop *l_iter, *l_first;
+ l_iter = l_first = e->l;
+ do {
+ if (!BM_elem_flag_test(l_iter->f, BM_ELEM_HIDDEN)) {
+ return l_iter;
+ }
+ } while ((l_iter = l_iter->radial_next) != l_first);
+ }
+ return NULL;
+}
+
+/**
* Given a set of vertices (varr), find out if
* there is a face with exactly those vertices
* (and only those vertices).