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:
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_mesh.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.c41
1 files changed, 27 insertions, 14 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index fe7c9dba08e..8eed3141c7f 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -650,7 +650,7 @@ bool BM_loop_check_cyclic_smooth_fan(BMLoop *l_curr)
return false;
}
/* Smooth loop/edge... */
- else if (BM_elem_flag_test(lfan_pivot_next, BM_ELEM_TAG)) {
+ if (BM_elem_flag_test(lfan_pivot_next, BM_ELEM_TAG)) {
if (lfan_pivot_next == l_curr) {
/* We walked around a whole cyclic smooth fan
* without finding any already-processed loop,
@@ -660,10 +660,8 @@ bool BM_loop_check_cyclic_smooth_fan(BMLoop *l_curr)
/* ... already checked in some previous looping, we can abort. */
return false;
}
- else {
- /* ... we can skip it in future, and keep checking the smooth fan. */
- BM_elem_flag_enable(lfan_pivot_next, BM_ELEM_TAG);
- }
+ /* ... we can skip it in future, and keep checking the smooth fan. */
+ BM_elem_flag_enable(lfan_pivot_next, BM_ELEM_TAG);
}
}
@@ -2379,6 +2377,27 @@ BMFace *BM_face_at_index_find(BMesh *bm, const int index)
return BLI_mempool_findelem(bm->fpool, index);
}
+BMLoop *BM_loop_at_index_find(BMesh *bm, const int index)
+{
+ BMIter iter;
+ BMFace *f;
+ int i = index;
+ BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+ if (i < f->len) {
+ BMLoop *l_first, *l_iter;
+ l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+ do {
+ if (i == 0) {
+ return l_iter;
+ }
+ i -= 1;
+ } while ((l_iter = l_iter->next) != l_first);
+ }
+ i -= f->len;
+ }
+ return NULL;
+}
+
/**
* Use lookup table when available, else use slower find functions.
*
@@ -2389,9 +2408,7 @@ BMVert *BM_vert_at_index_find_or_table(BMesh *bm, const int index)
if ((bm->elem_table_dirty & BM_VERT) == 0) {
return (index < bm->totvert) ? bm->vtable[index] : NULL;
}
- else {
- return BM_vert_at_index_find(bm, index);
- }
+ return BM_vert_at_index_find(bm, index);
}
BMEdge *BM_edge_at_index_find_or_table(BMesh *bm, const int index)
@@ -2399,9 +2416,7 @@ BMEdge *BM_edge_at_index_find_or_table(BMesh *bm, const int index)
if ((bm->elem_table_dirty & BM_EDGE) == 0) {
return (index < bm->totedge) ? bm->etable[index] : NULL;
}
- else {
- return BM_edge_at_index_find(bm, index);
- }
+ return BM_edge_at_index_find(bm, index);
}
BMFace *BM_face_at_index_find_or_table(BMesh *bm, const int index)
@@ -2409,9 +2424,7 @@ BMFace *BM_face_at_index_find_or_table(BMesh *bm, const int index)
if ((bm->elem_table_dirty & BM_FACE) == 0) {
return (index < bm->totface) ? bm->ftable[index] : NULL;
}
- else {
- return BM_face_at_index_find(bm, index);
- }
+ return BM_face_at_index_find(bm, index);
}
/**