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>2018-12-06 06:50:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-12-06 06:52:55 +0300
commitd24cfa329b221cae4a6e7ecc4d0e4ea778ac5c71 (patch)
tree7f143391b5c812d368ab29ca2c3469dff19df9f6 /source/blender/bmesh/intern
parentf6c615a8c287183b59884a24065273f35cb7a578 (diff)
Fix T58832: Spin tool creates duplicate faces
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r--source/blender/bmesh/intern/bmesh_query.c34
-rw-r--r--source/blender/bmesh/intern/bmesh_query.h1
2 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_query.c b/source/blender/bmesh/intern/bmesh_query.c
index e1f16508b8b..13e2029381e 100644
--- a/source/blender/bmesh/intern/bmesh_query.c
+++ b/source/blender/bmesh/intern/bmesh_query.c
@@ -2063,6 +2063,40 @@ BMFace *BM_face_exists(BMVert **varr, int len)
return NULL;
}
+/**
+ * Check if the face has an exact duplicate (both winding directions).
+ */
+BMFace *BM_face_find_double(BMFace *f)
+{
+ BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
+ for (BMLoop *l_iter = l_first->radial_next; l_first != l_iter; l_iter = l_iter->radial_next) {
+ if (l_iter->f->len == l_first->f->len) {
+ if (l_iter->v == l_first->v) {
+ BMLoop *l_a = l_first, *l_b = l_iter, *l_b_init = l_iter;
+ do {
+ if (l_a->e != l_b->e) {
+ break;
+ }
+ } while (((void)(l_a = l_a->next), (l_b = l_b->next)) != l_b_init);
+ if (l_b == l_b_init) {
+ return l_iter->f;
+ }
+ }
+ else {
+ BMLoop *l_a = l_first, *l_b = l_iter, *l_b_init = l_iter;
+ do {
+ if (l_a->e != l_b->e) {
+ break;
+ }
+ } while (((void)(l_a = l_a->prev), (l_b = l_b->next)) != l_b_init);
+ if (l_b == l_b_init) {
+ return l_iter->f;
+ }
+ }
+ }
+ }
+ return NULL;
+}
/**
* Given a set of vertices and edges (\a varr, \a earr), find out if
diff --git a/source/blender/bmesh/intern/bmesh_query.h b/source/blender/bmesh/intern/bmesh_query.h
index fb625c9acc8..17bf0f38d0c 100644
--- a/source/blender/bmesh/intern/bmesh_query.h
+++ b/source/blender/bmesh/intern/bmesh_query.h
@@ -141,6 +141,7 @@ BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2) ATTR_WARN_UNUSED_RESULT ATTR_NONN
BMEdge *BM_edge_find_double(BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
BMFace *BM_face_exists(BMVert **varr, int len) ATTR_NONNULL(1);
+BMFace *BM_face_find_double(BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
bool BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
bool BM_face_exists_multi_edge(BMEdge **earr, int len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();