[Bf-blender-cvs] [b51b893df86] master: BMesh: add BM_loop_other_vert_loop_by_edge

Campbell Barton noreply at git.blender.org
Mon Jul 6 10:30:15 CEST 2020


Commit: b51b893df8623d35f657ffa3975ca9a7422b971d
Author: Campbell Barton
Date:   Mon Jul 6 17:40:55 2020 +1000
Branches: master
https://developer.blender.org/rBb51b893df8623d35f657ffa3975ca9a7422b971d

BMesh: add BM_loop_other_vert_loop_by_edge

===================================================================

M	source/blender/bmesh/intern/bmesh_query.c
M	source/blender/bmesh/intern/bmesh_query.h

===================================================================

diff --git a/source/blender/bmesh/intern/bmesh_query.c b/source/blender/bmesh/intern/bmesh_query.c
index fe67abf6aa5..80634618f6f 100644
--- a/source/blender/bmesh/intern/bmesh_query.c
+++ b/source/blender/bmesh/intern/bmesh_query.c
@@ -157,6 +157,37 @@ BMLoop *BM_loop_other_vert_loop(BMLoop *l, BMVert *v)
 #endif
 }
 
+/**
+ * Return the other loop that uses this edge.
+ *
+ * In this case the loop defines the vertex,
+ * the edge passed in defines the direction to step.
+ *
+ * <pre>
+ *     +----------+ <-- Return the face-loop of this vertex.
+ *     |          |
+ *     |        e | <-- This edge defines the direction.
+ *     |          |
+ *     +----------+ <-- This loop defines the face and vertex..
+ *                l
+ * </pre>
+ *
+ */
+BMLoop *BM_loop_other_vert_loop_by_edge(BMLoop *l, BMEdge *e)
+{
+  BLI_assert(BM_vert_in_edge(e, l->v));
+  if (l->e == e) {
+    return l->next;
+  }
+  else if (l->prev->e == e) {
+    return l->prev;
+  }
+  else {
+    BLI_assert(0);
+    return NULL;
+  }
+}
+
 /**
  * Check if verts share a face.
  */
diff --git a/source/blender/bmesh/intern/bmesh_query.h b/source/blender/bmesh/intern/bmesh_query.h
index 7e07059d4d8..31ab7e4095a 100644
--- a/source/blender/bmesh/intern/bmesh_query.h
+++ b/source/blender/bmesh/intern/bmesh_query.h
@@ -48,6 +48,8 @@ BMLoop *BM_face_other_edge_loop(BMFace *f, BMEdge *e, BMVert *v) ATTR_WARN_UNUSE
 BMLoop *BM_loop_other_edge_loop(BMLoop *l, BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 BMLoop *BM_face_other_vert_loop(BMFace *f, BMVert *v_prev, BMVert *v) ATTR_WARN_UNUSED_RESULT
     ATTR_NONNULL();
+BMLoop *BM_loop_other_vert_loop_by_edge(BMLoop *l, BMEdge *e) ATTR_WARN_UNUSED_RESULT
+    ATTR_NONNULL();
 BMLoop *BM_loop_other_vert_loop(BMLoop *l, BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 BMLoop *BM_vert_step_fan_loop(BMLoop *l, BMEdge **e_step) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();



More information about the Bf-blender-cvs mailing list