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. + * + *
+ * +----------+ <-- Return the face-loop of this vertex. + * | | + * | e | <-- This edge defines the direction. + * | | + * +----------+ <-- This loop defines the face and vertex.. + * l + *+ * + */ +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();