From 854db8951bc15a7545eea3ff2219a28897698ead Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Jun 2018 08:48:38 +0200 Subject: Cleanup: strip trailing space in bmesh module --- source/blender/bmesh/bmesh_class.h | 8 +-- source/blender/bmesh/intern/bmesh_construct.c | 4 +- source/blender/bmesh/intern/bmesh_core.c | 58 ++++++++-------- source/blender/bmesh/intern/bmesh_delete.c | 2 +- source/blender/bmesh/intern/bmesh_edgeloop.c | 2 +- source/blender/bmesh/intern/bmesh_interp.c | 44 ++++++------ source/blender/bmesh/intern/bmesh_iterators.c | 10 +-- .../blender/bmesh/intern/bmesh_iterators_inline.h | 2 +- source/blender/bmesh/intern/bmesh_log.c | 2 +- source/blender/bmesh/intern/bmesh_marking.c | 16 ++--- source/blender/bmesh/intern/bmesh_mesh.c | 20 +++--- source/blender/bmesh/intern/bmesh_mods.c | 36 +++++----- source/blender/bmesh/intern/bmesh_operators.c | 48 ++++++------- source/blender/bmesh/intern/bmesh_polygon.c | 8 +-- source/blender/bmesh/intern/bmesh_queries.c | 4 +- source/blender/bmesh/intern/bmesh_structure.c | 14 ++-- source/blender/bmesh/intern/bmesh_walkers.c | 6 +- source/blender/bmesh/intern/bmesh_walkers_impl.c | 32 ++++----- source/blender/bmesh/operators/bmo_create.c | 2 +- source/blender/bmesh/operators/bmo_dissolve.c | 12 ++-- source/blender/bmesh/operators/bmo_dupe.c | 20 +++--- source/blender/bmesh/operators/bmo_extrude.c | 20 +++--- source/blender/bmesh/operators/bmo_hull.c | 18 ++--- source/blender/bmesh/operators/bmo_mirror.c | 12 ++-- source/blender/bmesh/operators/bmo_primitive.c | 34 +++++----- source/blender/bmesh/operators/bmo_removedoubles.c | 8 +-- source/blender/bmesh/operators/bmo_subdivide.c | 78 +++++++++++----------- source/blender/bmesh/operators/bmo_triangulate.c | 12 ++-- source/blender/bmesh/tools/bmesh_bevel.c | 24 +++---- 29 files changed, 278 insertions(+), 278 deletions(-) (limited to 'source/blender') diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h index bec2c7a1f45..10e2892c5a5 100644 --- a/source/blender/bmesh/bmesh_class.h +++ b/source/blender/bmesh/bmesh_class.h @@ -119,7 +119,7 @@ typedef struct BMEdge { /* the list of loops around the edge (use l->radial_prev/next) * to access the other loops using the edge */ struct BMLoop *l; - + /* disk cycle pointers * relative data: d1 indicates indicates the next/prev edge around vertex v1 and d2 does the same for v2 */ BMDiskLink v1_disk_link, v2_disk_link; @@ -229,7 +229,7 @@ typedef struct BMesh { int toolflag_index; struct BMOperator *currentop; - + CustomData vdata, edata, ldata, pdata; #ifdef USE_BMESH_HOLES @@ -241,10 +241,10 @@ typedef struct BMesh { * make sure they're in sync! * Only use when the edit mesh cant be accessed - campbell */ short selectmode; - + /* ID of the shape key this bmesh came from */ int shapenr; - + int totflags; ListBase selected; diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index f8ecbe1756b..1b300b24808 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -712,7 +712,7 @@ BMesh *BM_mesh_copy(BMesh *bm_old) /* safety check */ BLI_assert(i == bm_old->totvert); - + BM_ITER_MESH_INDEX (e, &iter, bm_old, BM_EDGES_OF_MESH, i) { e_new = BM_edge_create(bm_new, vtable[BM_elem_index_get(e->v1)], @@ -730,7 +730,7 @@ BMesh *BM_mesh_copy(BMesh *bm_old) /* safety check */ BLI_assert(i == bm_old->totedge); - + BM_ITER_MESH_INDEX (f, &iter, bm_old, BM_FACES_OF_MESH, i) { BM_elem_index_set(f, i); /* set_inline */ diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index 7e35866887d..c6836187eee 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -158,7 +158,7 @@ BMEdge *BM_edge_create( if ((create_flag & BM_CREATE_NO_DOUBLE) && (e = BM_edge_exists(v1, v2))) return e; - + e = BLI_mempool_alloc(bm->epool); @@ -286,7 +286,7 @@ static BMLoop *bm_face_boundary_add( BMLoopList *lst = BLI_mempool_calloc(bm->looplistpool); #endif BMLoop *l = bm_loop_create(bm, startv, starte, f, NULL /* starte->l */, create_flag); - + bmesh_radial_loop_append(starte, l); #ifdef USE_BMESH_HOLES @@ -295,7 +295,7 @@ static BMLoop *bm_face_boundary_add( #else f->l_first = l; #endif - + return l; } @@ -330,7 +330,7 @@ BMFace *BM_face_copy( do { if (copy_edges) { BMVert *v1, *v2; - + if (l_iter->e->v1 == verts[i]) { v1 = verts[i]; v2 = verts[(i + 1) % f->len]; @@ -339,7 +339,7 @@ BMFace *BM_face_copy( v2 = verts[i]; v1 = verts[(i + 1) % f->len]; } - + edges[i] = BM_edge_create(bm_dst, v1, v2, l_iter->e, BM_CREATE_NOP); } else { @@ -347,11 +347,11 @@ BMFace *BM_face_copy( } i++; } while ((l_iter = l_iter->next) != l_first); - + f_copy = BM_face_create(bm_dst, verts, edges, f->len, NULL, BM_CREATE_SKIP_CD); - + BM_elem_attrs_copy(bm_src, bm_dst, f, f_copy); - + l_iter = l_first = BM_FACE_FIRST_LOOP(f); l_copy = BM_FACE_FIRST_LOOP(f_copy); do { @@ -463,12 +463,12 @@ BMFace *BM_face_create( lastl->next = l; lastl = l; } - + startl->prev = lastl; lastl->next = startl; - + f->len = len; - + if (!(create_flag & BM_CREATE_SKIP_CD)) { if (f_example) { BM_elem_attrs_copy(bm, bm, f_example, f); @@ -563,7 +563,7 @@ int bmesh_elem_check(void *element, const char htype) if (head->htype != htype) return IS_WRONG_TYPE; - + switch (htype) { case BM_VERT: { @@ -830,12 +830,12 @@ void BM_face_edges_kill(BMesh *bm, BMFace *f) BMLoop *l_iter; BMLoop *l_first; int i = 0; - + l_iter = l_first = BM_FACE_FIRST_LOOP(f); do { edges[i++] = l_iter->e; } while ((l_iter = l_iter->next) != l_first); - + for (i = 0; i < f->len; i++) { BM_edge_kill(bm, edges[i]); } @@ -851,12 +851,12 @@ void BM_face_verts_kill(BMesh *bm, BMFace *f) BMLoop *l_iter; BMLoop *l_first; int i = 0; - + l_iter = l_first = BM_FACE_FIRST_LOOP(f); do { verts[i++] = l_iter->v; } while ((l_iter = l_iter->next) != l_first); - + for (i = 0; i < f->len; i++) { BM_vert_kill(bm, verts[i]); } @@ -979,7 +979,7 @@ void BM_edge_kill(BMesh *bm, BMEdge *e) bmesh_disk_edge_remove(e, e->v1); bmesh_disk_edge_remove(e, e->v2); - + bm_kill_only_edge(bm, e); } @@ -1159,11 +1159,11 @@ static bool bm_vert_is_manifold_flagged(BMVert *v, const char api_flag) if (!l) { return false; } - + if (BM_edge_is_boundary(l->e)) { return false; } - + do { if (!BM_ELEM_API_FLAG_TEST(l->f, api_flag)) return false; @@ -1361,7 +1361,7 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del) BM_face_kill(bm, faces[i]); } } - + BLI_array_free(edges); BLI_array_free(deledges); BLI_array_free(delverts); @@ -1562,7 +1562,7 @@ BMFace *bmesh_kernel_split_face_make_edge( BM_CHECK_ELEMENT(e); BM_CHECK_ELEMENT(f); BM_CHECK_ELEMENT(f2); - + return f2; } @@ -1664,7 +1664,7 @@ BMVert *bmesh_kernel_split_edge_make_vert(BMesh *bm, BMVert *tv, BMEdge *e, BMEd is_first = false; l->radial_next = l->radial_prev = NULL; } - + bmesh_radial_loop_append(l_new->e, l_new); bmesh_radial_loop_append(l->e, l); } @@ -1784,7 +1784,7 @@ BMEdge *bmesh_kernel_join_edge_kill_vert( if (BM_vert_in_edge(e_kill, v_kill) == 0) { return NULL; } - + if (bmesh_disk_count_at_most(v_kill, 3) == 2) { #ifndef NDEBUG int valence1, valence2; @@ -2122,10 +2122,10 @@ BMFace *bmesh_kernel_join_face_kill_edge(BMesh *bm, BMFace *f1, BMFace *f2, BMEd /* join the two loop */ l_f1->prev->next = l_f2->next; l_f2->next->prev = l_f1->prev; - + l_f1->next->prev = l_f2->prev; l_f2->prev->next = l_f1->next; - + /* if l_f1 was baseloop, make l_f1->next the base. */ if (BM_FACE_FIRST_LOOP(f1) == l_f1) BM_FACE_FIRST_LOOP(f1) = l_f1->next; @@ -2137,11 +2137,11 @@ BMFace *bmesh_kernel_join_face_kill_edge(BMesh *bm, BMFace *f1, BMFace *f2, BMEd newlen = f1->len; for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f1); i < newlen; i++, l_iter = l_iter->next) l_iter->f = f1; - + /* remove edge from the disk cycle of its two vertices */ bmesh_disk_edge_remove(l_f1->e, l_f1->e->v1); bmesh_disk_edge_remove(l_f1->e, l_f1->e->v2); - + /* deallocate edge and its two loops as well as f2 */ if (bm->etoolflagpool) { BLI_mempool_free(bm->etoolflagpool, ((BMEdge_OFlag *)l_f1->e)->oflags); @@ -2165,7 +2165,7 @@ BMFace *bmesh_kernel_join_face_kill_edge(BMesh *bm, BMFace *f1, BMFace *f2, BMEd /* validate the new loop cycle */ edok = bmesh_loop_validate(f1); BMESH_ASSERT(edok != false); - + return f1; } @@ -2600,7 +2600,7 @@ void bmesh_kernel_edge_separate( BLI_assert(l_sep->e == e); BLI_assert(e->l); - + if (BM_edge_is_boundary(e)) { BLI_assert(0); /* no cut required */ return; diff --git a/source/blender/bmesh/intern/bmesh_delete.c b/source/blender/bmesh/intern/bmesh_delete.c index 1449a6ef9d7..1869bc49da0 100644 --- a/source/blender/bmesh/intern/bmesh_delete.c +++ b/source/blender/bmesh/intern/bmesh_delete.c @@ -105,7 +105,7 @@ void BMO_mesh_delete_oflag_tagged(BMesh *bm, const short oflag, const char htype bmo_remove_tagged_edges(bm, oflag); } if (htype & BM_VERT) { - bmo_remove_tagged_verts(bm, oflag); + bmo_remove_tagged_verts(bm, oflag); } } diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.c b/source/blender/bmesh/intern/bmesh_edgeloop.c index 54fe2801d0c..9e107c822ac 100644 --- a/source/blender/bmesh/intern/bmesh_edgeloop.c +++ b/source/blender/bmesh/intern/bmesh_edgeloop.c @@ -160,7 +160,7 @@ int BM_mesh_edgeloops_find( BMEdge **edges = MEM_mallocN(sizeof(*edges) * edges_len, __func__); BLI_stack_pop_n_reverse(edge_stack, edges, BLI_stack_count(edge_stack)); BLI_stack_free(edge_stack); - + for (uint i = 0; i < edges_len; i += 1) { e = edges[i]; if (BM_elem_flag_test(e, BM_ELEM_INTERNAL_TAG)) { diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 8a1090891f2..e3b779ddbcd 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -152,7 +152,7 @@ void BM_data_interp_face_vert_edge( l_v = l_iter; l_v2 = l_iter->prev; } - + if (!l_v1 || !l_v2) { return; } @@ -260,15 +260,15 @@ static int compute_mdisp_quad( mid_v3_v3v3(p, l->prev->v->co, l->v->co); mid_v3_v3v3(n, l->next->v->co, l->v->co); - + copy_v3_v3(v1, l_f_center); copy_v3_v3(v2, p); copy_v3_v3(v3, l->v->co); copy_v3_v3(v4, n); - + sub_v3_v3v3(e1, v2, v1); sub_v3_v3v3(e2, v3, v4); - + return 1; } @@ -331,7 +331,7 @@ static bool mdisp_in_mdispquad( { float v1[3], v2[3], c[3], v3[3], v4[3], e1[3], e2[3]; float eps = FLT_EPSILON * 4000; - + if (is_zero_v3(l_src->v->no)) BM_vert_normal_update_all(l_src->v); if (is_zero_v3(l_dst->v->no)) @@ -341,17 +341,17 @@ static bool mdisp_in_mdispquad( /* expand quad a bit */ mid_v3_v3v3v3v3(c, v1, v2, v3, v4); - + sub_v3_v3(v1, c); sub_v3_v3(v2, c); sub_v3_v3(v3, c); sub_v3_v3(v4, c); mul_v3_fl(v1, 1.0f + eps); mul_v3_fl(v2, 1.0f + eps); mul_v3_fl(v3, 1.0f + eps); mul_v3_fl(v4, 1.0f + eps); add_v3_v3(v1, c); add_v3_v3(v2, c); add_v3_v3(v3, c); add_v3_v3(v4, c); - + if (!quad_co(v1, v2, v3, v4, p, l_src->v->no, r_uv)) return 0; - + mul_v2_fl(r_uv, (float)(res - 1)); mdisp_axis_from_quad(v1, v2, v3, v4, r_axis_x, r_axis_y); @@ -478,14 +478,14 @@ void BM_loop_interp_multires_ex( MDisps *md_dst; float v1[3], v2[3], v3[3], v4[3] = {0.0f, 0.0f, 0.0f}, e1[3], e2[3]; float axis_x[3], axis_y[3]; - + /* ignore 2-edged faces */ if (UNLIKELY(l_dst->f->len < 3)) return; md_dst = BM_ELEM_CD_GET_VOID_P(l_dst, cd_loop_mdisp_offset); compute_mdisp_quad(l_dst, f_dst_center, v1, v2, v3, v4, e1, e2); - + /* if no disps data allocate a new grid, the size of the first grid in f_src. */ if (!md_dst->totdisp) { const MDisps *md_src = BM_ELEM_CD_GET_VOID_P(BM_FACE_FIRST_LOOP(f_src), cd_loop_mdisp_offset); @@ -499,7 +499,7 @@ void BM_loop_interp_multires_ex( return; } } - + mdisp_axis_from_quad(v1, v2, v3, v4, axis_x, axis_y); const int res = (int)sqrt(md_dst->totdisp); @@ -571,10 +571,10 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f) const int cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS); BMLoop *l; BMIter liter; - + if (cd_loop_mdisp_offset == -1) return; - + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { MDisps *mdp = BM_ELEM_CD_GET_VOID_P(l->prev, cd_loop_mdisp_offset); MDisps *mdl = BM_ELEM_CD_GET_VOID_P(l, cd_loop_mdisp_offset); @@ -582,7 +582,7 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f) float co1[3]; int sides; int y; - + /* * mdisps is a grid of displacements, ordered thus: * @@ -605,14 +605,14 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f) copy_v3_v3(mdl->disps[y], co1); } } - + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { MDisps *mdl1 = BM_ELEM_CD_GET_VOID_P(l, cd_loop_mdisp_offset); MDisps *mdl2; float co1[3], co2[3], co[3]; int sides; int y; - + /* * mdisps is a grid of displacements, ordered thus: * @@ -638,11 +638,11 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f) sides = (int)sqrt(mdl1->totdisp); for (y = 0; y < sides; y++) { int a1, a2, o1, o2; - + if (l->v != l->radial_next->v) { a1 = sides * y + sides - 2; a2 = (sides - 2) * sides + y; - + o1 = sides * y + sides - 1; o2 = (sides - 1) * sides + y; } @@ -652,16 +652,16 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f) o1 = sides * y + sides - 1; o2 = sides * y + sides - 1; } - + /* magic blending numbers, hardcoded! */ add_v3_v3v3(co1, mdl1->disps[a1], mdl2->disps[a2]); mul_v3_fl(co1, 0.18); - + add_v3_v3v3(co2, mdl1->disps[o1], mdl2->disps[o2]); mul_v3_fl(co2, 0.32); - + add_v3_v3v3(co, co1, co2); - + copy_v3_v3(mdl1->disps[o1], co); copy_v3_v3(mdl2->disps[o2], co); } diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c index 9fe28561b93..c9b7b80b658 100644 --- a/source/blender/bmesh/intern/bmesh_iterators.c +++ b/source/blender/bmesh/intern/bmesh_iterators.c @@ -508,7 +508,7 @@ void *bmiter__face_of_vert_step(struct BMIter__face_of_vert *iter) iter->l_next = iter->l_first; } } - + if (!((BMIter *)iter)->count) { iter->l_next = NULL; } @@ -549,7 +549,7 @@ void *bmiter__loop_of_vert_step(struct BMIter__loop_of_vert *iter) iter->l_next = iter->l_first; } } - + if (!((BMIter *)iter)->count) { iter->l_next = NULL; } @@ -590,7 +590,7 @@ void bmiter__loop_of_loop_begin(struct BMIter__loop_of_loop *iter) { iter->l_first = iter->ldata; iter->l_next = iter->l_first->radial_next; - + if (iter->l_next == iter->l_first) iter->l_next = NULL; } @@ -598,7 +598,7 @@ void bmiter__loop_of_loop_begin(struct BMIter__loop_of_loop *iter) void *bmiter__loop_of_loop_step(struct BMIter__loop_of_loop *iter) { BMLoop *l_curr = iter->l_next; - + if (iter->l_next) { iter->l_next = iter->l_next->radial_next; if (iter->l_next == iter->l_first) { @@ -696,7 +696,7 @@ void *bmiter__edge_of_face_step(struct BMIter__edge_of_face *iter) iter->l_next = NULL; } } - + return l_curr ? l_curr->e : NULL; } diff --git a/source/blender/bmesh/intern/bmesh_iterators_inline.h b/source/blender/bmesh/intern/bmesh_iterators_inline.h index 88985d639cf..e7bd6164c27 100644 --- a/source/blender/bmesh/intern/bmesh_iterators_inline.h +++ b/source/blender/bmesh/intern/bmesh_iterators_inline.h @@ -156,7 +156,7 @@ BLI_INLINE bool BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *da return false; break; } - + iter->begin(iter); return true; diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c index 28827a5ddaa..4e6fff03411 100644 --- a/source/blender/bmesh/intern/bmesh_log.c +++ b/source/blender/bmesh/intern/bmesh_log.c @@ -141,7 +141,7 @@ static uint bm_log_vert_id_get(BMLog *log, BMVert *v) static void bm_log_vert_id_set(BMLog *log, BMVert *v, uint id) { void *vid = SET_UINT_IN_POINTER(id); - + BLI_ghash_reinsert(log->id_to_elem, vid, v, NULL, NULL); BLI_ghash_reinsert(log->elem_to_id, v, vid, NULL, NULL); } diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index 1b96237e262..10a03050d4b 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -609,7 +609,7 @@ void BM_mesh_select_mode_set(BMesh *bm, int selectmode) { BMIter iter; BMElem *ele; - + bm->selectmode = selectmode; if (bm->selectmode & SCE_SELECT_VERTEX) { @@ -737,13 +737,13 @@ BMFace *BM_mesh_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_s BMIter iter; BMFace *f = NULL; BMEditSelection *ese; - + /* Find the latest non-hidden face from the BMEditSelection */ ese = bm->selected.last; for ( ; ese; ese = ese->prev) { if (ese->htype == BM_FACE) { f = (BMFace *)ese->ele; - + if (BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { f = NULL; } @@ -842,10 +842,10 @@ void BM_editselection_normal(BMEditSelection *ese, float r_normal[3]) BMEdge *eed = (BMEdge *)ese->ele; float plane[3]; /* need a plane to correct the normal */ float vec[3]; /* temp vec storage */ - + add_v3_v3v3(r_normal, eed->v1->no, eed->v2->no); sub_v3_v3v3(plane, eed->v2->co, eed->v1->co); - + /* the 2 vertex normals will be close but not at rightangles to the edge * for rotate about edge we want them to be at right angles, so we need to * do some extra calculation to correct the vert normals, @@ -853,7 +853,7 @@ void BM_editselection_normal(BMEditSelection *ese, float r_normal[3]) cross_v3_v3v3(vec, r_normal, plane); cross_v3_v3v3(r_normal, plane, vec); normalize_v3(r_normal); - + } else if (ese->htype == BM_FACE) { BMFace *efa = (BMFace *)ese->ele; @@ -869,7 +869,7 @@ void BM_editselection_plane(BMEditSelection *ese, float r_plane[3]) if (ese->htype == BM_VERT) { BMVert *eve = (BMVert *)ese->ele; float vec[3] = {0.0f, 0.0f, 0.0f}; - + if (ese->prev) { /* use previously selected data to make a useful vertex plane */ BM_editselection_center(ese->prev, vec); sub_v3_v3v3(r_plane, vec, eve->co); @@ -1261,7 +1261,7 @@ void BM_edge_hide_set(BMEdge *e, const bool hide) BM_elem_flag_set(l_iter->f, BM_ELEM_HIDDEN, hide); } while ((l_iter = l_iter->radial_next) != l_first); } - + BM_elem_flag_set(e, BM_ELEM_HIDDEN, hide); /* hide vertices if necessary */ diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index 7f7f48e37bd..185e5412b3d 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -168,7 +168,7 @@ BMesh *BM_mesh_create( { /* allocate the structure */ BMesh *bm = MEM_callocN(sizeof(BMesh), __func__); - + /* allocate the memory pools for the mesh elements */ bm_mempool_init(bm, allocsize, params->use_toolflags); @@ -1051,41 +1051,41 @@ static void UNUSED_FUNCTION(bm_mdisps_space_set)(Object *ob, BMesh *bm, int from BMFace *f; BMIter iter; // int i = 0; // UNUSED - + multires_set_space(dm, ob, from, to); - + mdisps = CustomData_get_layer(&dm->loopData, CD_MDISPS); - + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BMLoop *l; BMIter liter; BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { MDisps *lmd = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MDISPS); - + if (!lmd->disps) { printf("%s: warning - 'lmd->disps' == NULL\n", __func__); } - + if (lmd->disps && lmd->totdisp == mdisps->totdisp) { memcpy(lmd->disps, mdisps->disps, sizeof(float) * 3 * lmd->totdisp); } else if (mdisps->disps) { if (lmd->disps) MEM_freeN(lmd->disps); - + lmd->disps = MEM_dupallocN(mdisps->disps); lmd->totdisp = mdisps->totdisp; lmd->level = mdisps->level; } - + mdisps++; // i += 1; } } - + dm->needsFree = 1; dm->release(dm); - + /* setting this to NULL prevents BKE_editmesh_free from freeing it */ em->bm = NULL; BKE_editmesh_free(em); diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 4290f94bba1..a10f2e2bb3f 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -66,7 +66,7 @@ bool BM_vert_dissolve(BMesh *bm, BMVert *v) { /* logic for 3 or more is identical */ const int len = BM_vert_edge_count_at_most(v, 3); - + if (len == 1) { BM_vert_kill(bm, v); /* will kill edges too */ return true; @@ -110,7 +110,7 @@ bool BM_disk_dissolve(BMesh *bm, BMVert *v) if (!BM_vert_is_manifold(v)) { return false; } - + if (v->e) { /* v->e we keep, what else */ e = v->e; @@ -124,7 +124,7 @@ bool BM_disk_dissolve(BMesh *bm, BMVert *v) len++; } while (e != v->e); } - + /* this code for handling 2 and 3-valence verts * may be totally bad */ if (keepedge == NULL && len == 3) { @@ -200,7 +200,7 @@ bool BM_disk_dissolve(BMesh *bm, BMVert *v) if (!e) { return false; } - + if (e->l) { /* get remaining two faces */ if (e->l != e->l->radial_next) { @@ -286,13 +286,13 @@ BMFace *BM_face_split( if (cd_loop_mdisp_offset != -1) { f_tmp = BM_face_copy(bm, bm, f, false, false); } - + #ifdef USE_BMESH_HOLES f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, r_l, NULL, example, no_double); #else f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, r_l, example, no_double); #endif - + if (f_new) { /* handle multires update */ if (cd_loop_mdisp_offset != -1) { @@ -368,7 +368,7 @@ BMFace *BM_face_split_n( } f_tmp = BM_face_copy(bm, bm, f, true, true); - + #ifdef USE_BMESH_HOLES f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, &l_new, NULL, example, false); #else @@ -600,13 +600,13 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac) if (cd_loop_mdisp_offset != -1) { BMLoop *l; int i; - + l = e->l; do { BLI_array_append(oldfaces, l->f); l = l->radial_next; } while (l != e->l); - + /* flag existing faces so we can differentiate oldfaces from new faces */ for (i = 0; i < BLI_array_len(oldfaces); i++) { BM_ELEM_API_FLAG_ENABLE(oldfaces[i], _FLAG_OVERLAP); @@ -647,7 +647,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac) for (j = 0; j < 2; j++) { BMEdge *e1 = j ? e_new : e; BMLoop *l; - + l = e1->l; if (UNLIKELY(!l)) { @@ -669,31 +669,31 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac) } while (l != e1->l); } } - + /* destroy the old faces */ for (i = 0; i < BLI_array_len(oldfaces); i++) { BM_face_verts_kill(bm, oldfaces[i]); } - + /* fix boundaries a bit, doesn't work too well quite yet */ #if 0 for (j = 0; j < 2; j++) { BMEdge *e1 = j ? e_new : e; BMLoop *l, *l2; - + l = e1->l; if (UNLIKELY(!l)) { BMESH_ASSERT(0); break; } - + do { BM_face_multires_bounds_smooth(bm, l->f); l = l->radial_next; } while (l != e1->l); } #endif - + BLI_array_free(oldfaces); } @@ -710,7 +710,7 @@ BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts, BMVert **r_varr) int i; float percent; BMVert *v_new = NULL; - + for (i = 0; i < numcuts; i++) { percent = 1.0f / (float)(numcuts + 1 - i); v_new = BM_edge_split(bm, e, e->v2, NULL, percent); @@ -734,7 +734,7 @@ bool BM_face_validate(BMFace *face, FILE *err) BMLoop *l; int i, j; bool ret = true; - + if (face->len == 2) { fprintf(err, "warning: found two-edged face. face ptr: %p\n", face); fflush(err); @@ -765,7 +765,7 @@ bool BM_face_validate(BMFace *face, FILE *err) } } } - + BLI_array_free(verts); return ret; } diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index f814767a200..62d892712fd 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -65,10 +65,10 @@ BLI_STATIC_ASSERT(ARRAY_SIZE(bmo_error_messages) + 1 == BMERR_TOTAL, "message mi /* operator slot type information - size of one element of the type given. */ const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES] = { 0, /* 0: BMO_OP_SLOT_SENTINEL */ - sizeof(int), /* 1: BMO_OP_SLOT_BOOL */ - sizeof(int), /* 2: BMO_OP_SLOT_INT */ - sizeof(float), /* 3: BMO_OP_SLOT_FLT */ - sizeof(void *), /* 4: BMO_OP_SLOT_PNT */ + sizeof(int), /* 1: BMO_OP_SLOT_BOOL */ + sizeof(int), /* 2: BMO_OP_SLOT_INT */ + sizeof(float), /* 3: BMO_OP_SLOT_FLT */ + sizeof(void *), /* 4: BMO_OP_SLOT_PNT */ sizeof(void *), /* 5: BMO_OP_SLOT_PNT */ 0, /* 6: unused */ 0, /* 7: unused */ @@ -185,7 +185,7 @@ void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname) op->type = opcode; op->type_flag = bmo_opdefines[opcode]->type_flag; op->flag = flag; - + /* initialize the operator slot types */ bmo_op_slots_init(bmo_opdefines[opcode]->slot_types_in, op->slots_in); bmo_op_slots_init(bmo_opdefines[opcode]->slot_types_out, op->slots_out); @@ -217,10 +217,10 @@ void BMO_op_exec(BMesh *bm, BMOperator *op) if (bm->toolflag_index == 1) bmesh_edit_begin(bm, op->type_flag); op->exec(bm, op); - + if (bm->toolflag_index == 1) bmesh_edit_end(bm, op->type_flag); - + BMO_pop(bm); } @@ -406,7 +406,7 @@ void BMO_slot_mat_set(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], cons slot->len = 4; slot->data.p = BLI_memarena_alloc(op->arena, sizeof(float) * 4 * 4); - + if (size == 4) { copy_m4_m4(slot->data.p, (float (*)[4])mat); } @@ -661,7 +661,7 @@ int BMO_slot_buffer_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot { BMOpSlot *slot = BMO_slot_get(slot_args, slot_name); BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF); - + /* check if its actually a buffer */ if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF) return 0; @@ -697,7 +697,7 @@ void *bmo_slot_buffer_grow(BMesh *bm, BMOperator *op, int slot_code, int totadd) BMOpSlot *slot = &op->slots[slot_code]; void *tmp; ssize_t allocsize; - + BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF); /* check if its actually a buffer */ @@ -760,7 +760,7 @@ void *BMO_slot_buffer_alloc(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS] /* check if its actually a buffer */ if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF) return NULL; - + slot->len = len; if (len) { slot->data.buf = BLI_memarena_alloc(op->arena, BMO_OPSLOT_TYPEINFO[slot->slot_type] * len); @@ -783,7 +783,7 @@ void BMO_slot_buffer_from_all( { BMOpSlot *output = BMO_slot_get(slot_args, slot_name); int totelement = 0, i = 0; - + BLI_assert(output->slot_type == BMO_OP_SLOT_ELEMENT_BUF); BLI_assert(((output->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype); @@ -1365,7 +1365,7 @@ static void bmo_flag_layer_clear(BMesh *bm) void *BMO_slot_buffer_get_first(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name) { BMOpSlot *slot = BMO_slot_get(slot_args, slot_name); - + if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF) return NULL; @@ -1505,14 +1505,14 @@ void BMO_error_clear(BMesh *bm) void BMO_error_raise(BMesh *bm, BMOperator *owner, int errcode, const char *msg) { BMOpError *err = MEM_callocN(sizeof(BMOpError), "bmop_error"); - + err->errorcode = errcode; if (!msg) { msg = bmo_error_messages[errcode]; } err->msg = msg; err->op = owner; - + BLI_addhead(&bm->errorstack, err); } @@ -1531,17 +1531,17 @@ int BMO_error_get(BMesh *bm, const char **msg, BMOperator **op) if (msg) *msg = err->msg; if (op) *op = err->op; - + return err->errorcode; } int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op) { int errorcode = BMO_error_get(bm, msg, op); - + if (errorcode) { BMOpError *err = bm->errorstack.first; - + BLI_remlink(&bm->errorstack, bm->errorstack.first); MEM_freeN(err); } @@ -1680,7 +1680,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, /* we muck around in here, so dup it */ fmt = ofmt = BLI_strdup(_fmt); - + /* find operator name */ i = strcspn(fmt, " "); @@ -1689,7 +1689,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, opname[i] = '\0'; fmt += i + (noslot ? 0 : 1); - + i = BMO_opcode_from_opname_check(opname); if (i == -1) { @@ -1700,7 +1700,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, BMO_op_init(bm, op, flag, opname); // def = bmo_opdefines[i]; - + i = 0; state = true; /* false: not inside slot_code name, true: inside slot_code name */ @@ -1709,7 +1709,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, /* jump past leading whitespace */ i = strspn(fmt, " "); fmt += i; - + /* ignore trailing whitespace */ if (!fmt[i]) break; @@ -1725,9 +1725,9 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, if (bmo_name_to_slotcode_check(op->slots_in, fmt) < 0) { GOTO_ERROR("name to slot code check failed"); } - + BLI_strncpy(slot_name, fmt, sizeof(slot_name)); - + state = false; fmt += i; } diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index bcb940f8b96..7cbc6461667 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -611,7 +611,7 @@ void BM_edge_normals_update(BMEdge *e) { BMIter iter; BMFace *f; - + BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) { BM_face_normal_update(f); } @@ -886,7 +886,7 @@ bool BM_face_point_inside_test(const BMFace *f, const float co[3]) float co_2d[2]; BMLoop *l_iter; int i; - + BLI_assert(BM_face_is_normal_valid(f)); axis_dominant_v3_to_m3(axis_mat, f->no); @@ -1199,7 +1199,7 @@ void BM_face_splits_check_legal(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int l out[1] = max_ff(out[1], projverts[i][1]); } bm->elem_index_dirty |= BM_LOOP; - + /* ensure we are well outside the face bounds (value is arbitrary) */ add_v2_fl(out, 1.0f); @@ -1212,7 +1212,7 @@ void BM_face_splits_check_legal(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int l for (i = 0; i < len; i++) { float mid[2]; mid_v2_v2v2(mid, edgeverts[i][0], edgeverts[i][1]); - + int isect = 0; int j_prev; for (j = 0, j_prev = f->len - 1; j < f->len; j_prev = j++) { diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index ab2f017d103..5ce4b236d03 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -424,7 +424,7 @@ int BM_verts_in_face_count(BMVert **varr, int len, BMFace *f) #endif int i, count = 0; - + for (i = 0; i < len; i++) { BM_ELEM_API_FLAG_ENABLE(varr[i], _FLAG_OVERLAP); } @@ -1213,7 +1213,7 @@ int BM_face_share_edge_count(BMFace *f_a, BMFace *f_b) BMLoop *l_iter; BMLoop *l_first; int count = 0; - + l_iter = l_first = BM_FACE_FIRST_LOOP(f_a); do { if (BM_edge_in_face(l_iter->e, f_b)) { diff --git a/source/blender/bmesh/intern/bmesh_structure.c b/source/blender/bmesh/intern/bmesh_structure.c index 8aa9502c0f7..ff744ae1a42 100644 --- a/source/blender/bmesh/intern/bmesh_structure.c +++ b/source/blender/bmesh/intern/bmesh_structure.c @@ -217,7 +217,7 @@ void bmesh_disk_edge_remove(BMEdge *e, BMVert *v) BMEdge *bmesh_disk_edge_exists(const BMVert *v1, const BMVert *v2) { BMEdge *e_iter, *e_first; - + if (v1->e) { e_first = e_iter = v1->e; @@ -227,7 +227,7 @@ BMEdge *bmesh_disk_edge_exists(const BMVert *v1, const BMVert *v2) } } while ((e_iter = bmesh_disk_edge_next(e_iter, v1)) != e_first); } - + return NULL; } @@ -380,7 +380,7 @@ bool bmesh_radial_validate(int radlen, BMLoop *l) { BMLoop *l_iter = l; int i = 0; - + if (bmesh_radial_length(l) != radlen) return false; @@ -389,17 +389,17 @@ bool bmesh_radial_validate(int radlen, BMLoop *l) BMESH_ASSERT(0); return false; } - + if (l_iter->e != l->e) return false; if (l_iter->v != l->e->v1 && l_iter->v != l->e->v2) return false; - + if (UNLIKELY(i > BM_LOOP_RADIAL_MAX)) { BMESH_ASSERT(0); return false; } - + i++; } while ((l_iter = l_iter->radial_next) != l); @@ -529,7 +529,7 @@ int bmesh_radial_length(const BMLoop *l) BMESH_ASSERT(0); return 0; } - + i++; if (UNLIKELY(i >= BM_LOOP_RADIAL_MAX)) { BMESH_ASSERT(0); diff --git a/source/blender/bmesh/intern/bmesh_walkers.c b/source/blender/bmesh/intern/bmesh_walkers.c index d39fb382b96..77e9d441bbb 100644 --- a/source/blender/bmesh/intern/bmesh_walkers.c +++ b/source/blender/bmesh/intern/bmesh_walkers.c @@ -63,7 +63,7 @@ void *BMW_begin(BMWalker *walker, void *start) BLI_assert(((BMHeader *)start)->htype & walker->begin_htype); walker->begin(walker, start); - + return BMW_current_state(walker) ? walker->step(walker) : NULL; } @@ -101,7 +101,7 @@ void BMW_init( BLI_assert(0); return; } - + if (type != BMW_CUSTOM) { walker->begin_htype = bm_walker_types[type]->begin_htype; walker->begin = bm_walker_types[type]->begin; @@ -118,7 +118,7 @@ void BMW_init( BLI_assert(mask_edge == 0 || (walker->valid_mask & BM_EDGE)); BLI_assert(mask_face == 0 || (walker->valid_mask & BM_FACE)); } - + walker->worklist = BLI_mempool_create(walker->structsize, 0, 128, BLI_MEMPOOL_NOP); BLI_listbase_clear(&walker->states); } diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c index 279440984bb..81487b70edc 100644 --- a/source/blender/bmesh/intern/bmesh_walkers_impl.c +++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c @@ -210,7 +210,7 @@ static void *bmw_VertShellWalker_step(BMWalker *walker) BMVert *v_old = NULL; bool restrictpass = true; BMwShellWalker shellWalk = *((BMwShellWalker *)BMW_current_state(walker)); - + if (!BLI_gset_haskey(walker->visit_set, shellWalk.base)) { BLI_gset_insert(walker->visit_set, shellWalk.base); } @@ -228,11 +228,11 @@ static void *bmw_VertShellWalker_step(BMWalker *walker) BMwShellWalker *newstate; v_old = BM_edge_other_vert(curedge, shellWalk.base); - + /* push a new state onto the stac */ newState = BMW_state_add(walker); BLI_gset_insert(walker->visit_set, curedge); - + /* populate the new stat */ newState->base = v_old; @@ -240,7 +240,7 @@ static void *bmw_VertShellWalker_step(BMWalker *walker) } } } while ((curedge = bmesh_disk_edge_next(curedge, shellWalk.base)) != shellWalk.curedge); - + return shellWalk.curedge; } #endif @@ -711,12 +711,12 @@ static void *bmw_IslandboundWalker_step(BMWalker *walker) e = l->e; v = BM_edge_other_vert(e, iwalk->lastv); - + /* pop off current state */ BMW_state_remove(walker); - + f = l->f; - + while (1) { l = BM_loop_other_edge_loop(l, v); if (BM_loop_is_manifold(l)) { @@ -736,7 +736,7 @@ static void *bmw_IslandboundWalker_step(BMWalker *walker) break; } } - + if (l == owalk.curloop) { return NULL; } @@ -789,7 +789,7 @@ static void *bmw_IslandWalker_step_ex(BMWalker *walker, bool only_manifold) { BMwIslandWalker *iwalk, owalk; BMLoop *l_iter, *l_first; - + BMW_state_remove_r(walker, &owalk); iwalk = &owalk; @@ -1154,7 +1154,7 @@ static bool bmw_FaceLoopWalker_edge_begins_loop(BMWalker *walker, BMEdge *e) if (BM_edge_is_wire(e)) { return false; } - + /* Don't start a loop from a boundary edge if it cannot * be extended to cover any faces */ if (BM_edge_is_boundary(e)) { @@ -1162,7 +1162,7 @@ static bool bmw_FaceLoopWalker_edge_begins_loop(BMWalker *walker, BMEdge *e) return false; } } - + /* Don't start a face loop from non-manifold edges */ if (!BM_edge_is_manifold(e)) { return false; @@ -1206,7 +1206,7 @@ static void bmw_FaceLoopWalker_begin(BMWalker *walker, void *data) static void *bmw_FaceLoopWalker_yield(BMWalker *walker) { BMwFaceLoopWalker *lwalk = BMW_current_state(walker); - + if (!lwalk) { return NULL; } @@ -1225,7 +1225,7 @@ static void *bmw_FaceLoopWalker_step(BMWalker *walker) f = lwalk->l->f; l = lwalk->l->radial_next; - + if (lwalk->no_calc) { return f; } @@ -1314,7 +1314,7 @@ static void bmw_EdgeringWalker_begin(BMWalker *walker, void *data) static void *bmw_EdgeringWalker_yield(BMWalker *walker) { BMwEdgeringWalker *lwalk = BMW_current_state(walker); - + if (!lwalk) { return NULL; } @@ -1381,7 +1381,7 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker) l = l->radial_next; l = l->next->next; - + if ((l->f->len != 4) || !EDGE_CHECK(l->e) || !bmw_mask_check_face(walker, l->f)) { l = owalk.l->next->next; } @@ -1502,7 +1502,7 @@ static void bmw_UVEdgeWalker_begin(BMWalker *walker, void *data) static void *bmw_UVEdgeWalker_yield(BMWalker *walker) { BMwUVEdgeWalker *lwalk = BMW_current_state(walker); - + if (!lwalk) { return NULL; } diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index c70e8b675c7..aeaedf6417c 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -66,7 +66,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) break; } } - + /* --- Support Edge Creation --- * simple case when we only have 2 verts selected. */ diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index 816d2e8d009..0ad800cbddd 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -158,7 +158,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) } BMO_slot_buffer_flag_enable(bm, op->slots_in, "faces", BM_FACE, FACE_MARK | FACE_TAG); - + /* collect region */ BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) { BMFace *f_iter; @@ -178,7 +178,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) BLI_array_append(faces, f_iter); } BMW_end(®walker); - + for (i = 0; i < BLI_array_len(faces); i++) { f_iter = faces[i]; BMO_face_flag_disable(bm, f_iter, FACE_TAG); @@ -190,7 +190,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) BMO_error_raise(bm, op, BMERR_DISSOLVEFACES_FAILED, NULL); goto cleanup; } - + BLI_array_append(faces, NULL); BLI_array_append(regions, faces); } @@ -201,17 +201,17 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) for (i = 0; i < BLI_array_len(regions); i++) { BMFace *f_new; int tot = 0; - + faces = regions[i]; if (!faces[0]) { BMO_error_raise(bm, op, BMERR_DISSOLVEFACES_FAILED, "Could not find boundary of dissolve region"); goto cleanup; } - + while (faces[tot]) tot++; - + f_new = BM_faces_join(bm, faces, tot, true); if (f_new) { diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index 394faabbd25..eed87ed20af 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -64,7 +64,7 @@ static BMVert *bmo_vert_copy( /* Mark the vert for output */ BMO_vert_flag_enable(bm_dst, v_dst, DUPE_NEW); - + return v_dst; } @@ -103,7 +103,7 @@ static BMEdge *bmo_edge_copy( /* Lookup v1 and v2 */ e_dst_v1 = BLI_ghash_lookup(vhash, e_src->v1); e_dst_v2 = BLI_ghash_lookup(vhash, e_src->v2); - + /* Create a new edge */ e_dst = BM_edge_create(bm_dst, e_dst_v1, e_dst_v2, NULL, BM_CREATE_SKIP_CD); BMO_slot_map_elem_insert(op, slot_edgemap_out, e_src, e_dst); @@ -124,7 +124,7 @@ static BMEdge *bmo_edge_copy( /* Mark the edge for output */ BMO_edge_flag_enable(bm_dst, e_dst, DUPE_NEW); - + return e_dst; } @@ -164,7 +164,7 @@ static BMFace *bmo_face_copy( /* Copy attributes */ BM_elem_attrs_copy(bm_src, bm_dst, f_src, f_dst); - + /* copy per-loop custom data */ l_iter_src = l_first_src; l_iter_dst = BM_FACE_FIRST_LOOP(f_dst); @@ -192,7 +192,7 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *bm_dst, BMesh *bm_src) BMVert *v = NULL, *v2; BMEdge *e = NULL; BMFace *f = NULL; - + BMIter viter, eiter, fiter; GHash *vhash, *ehash; @@ -286,7 +286,7 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *bm_dst, BMesh *bm_src) BMO_face_flag_enable(bm_src, f, DUPE_DONE); } } - + /* free pointer hashes */ BLI_ghash_free(vhash, NULL, NULL); BLI_ghash_free(ehash, NULL, NULL); @@ -326,7 +326,7 @@ void bmo_duplicate_exec(BMesh *bm, BMOperator *op) { BMOperator *dupeop = op; BMesh *bm_dst = BMO_slot_ptr_get(op->slots_in, "dest"); - + if (!bm_dst) bm_dst = bm; @@ -335,7 +335,7 @@ void bmo_duplicate_exec(BMesh *bm, BMOperator *op) /* use the internal copy function */ bmo_mesh_copy(dupeop, bm_dst, bm); - + /* Output */ /* First copy the input buffers to output buffers - original data */ BMO_slot_copy(dupeop, slots_in, "geom", @@ -393,11 +393,11 @@ void bmo_split_exec(BMesh *bm, BMOperator *op) /* initialize our sub-operator */ BMO_op_init(bm, &dupeop, op->flag, "duplicate"); - + BMO_slot_copy(splitop, slots_in, "geom", &dupeop, slots_in, "geom"); BMO_op_exec(bm, &dupeop); - + BMO_slot_buffer_flag_enable(bm, splitop->slots_in, "geom", BM_ALL_NOLOOP, SPLIT_INPUT); if (use_only_faces) { diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index 87369472df7..3a6fbd419c1 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -175,7 +175,7 @@ static void bm_extrude_copy_face_loop_attributes(BMesh *bm, BMFace *f) static void bm_extrude_disable_skin_root(BMesh *bm, BMVert *v) { MVertSkin *vs; - + vs = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_MVERT_SKIN); vs->flag &= ~MVERT_SKIN_ROOT; } @@ -186,7 +186,7 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op) BMOperator dupeop; BMFace *f; BMEdge *e, *e_new; - + BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) { BMO_edge_flag_enable(bm, e, EXT_INPUT); BMO_vert_flag_enable(bm, e->v1, EXT_INPUT); @@ -227,16 +227,16 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op) /* not sure what to do about example face, pass NULL for now */ f = BM_face_create_verts(bm, f_verts, 4, NULL, BM_CREATE_NOP, true); bm_extrude_copy_face_loop_attributes(bm, f); - + if (BMO_edge_flag_test(bm, e, EXT_INPUT)) { e = e_new; } - + BMO_face_flag_enable(bm, f, EXT_KEEP); BMO_edge_flag_enable(bm, e, EXT_KEEP); BMO_vert_flag_enable(bm, e->v1, EXT_KEEP); BMO_vert_flag_enable(bm, e->v2, EXT_KEEP); - + } BMO_op_finish(bm, &dupeop); @@ -343,7 +343,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) BMO_slot_bool_get(op->slots_in, "use_select_history")); BMO_slot_buffer_flag_enable(bm, op->slots_in, "geom", BM_EDGE | BM_FACE, EXT_INPUT); - + /* if one flagged face is bordered by an un-flagged face, then we delete * original geometry unless caller explicitly asked to keep it. */ if (!BMO_slot_bool_get(op->slots_in, "use_keep_orig")) { @@ -404,7 +404,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) } } } - + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { if (BMO_face_flag_test(bm, f, EXT_INPUT)) { BMO_face_flag_enable(bm, f, EXT_DEL); @@ -436,7 +436,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) if (delorig) { BMO_op_exec(bm, &delop); } - + /* if not delorig, reverse loops of original face */ if (!delorig) { BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { @@ -445,7 +445,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) } } } - + BMO_slot_copy(&dupeop, slots_out, "geom.out", op, slots_out, "geom.out"); @@ -493,7 +493,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) else fwd = (e_new->l->v == e_new->v1); - + if (fwd) { f_verts[0] = e->v1; f_verts[1] = e->v2; diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c index d52cb00e172..ca727de5756 100644 --- a/source/blender/bmesh/operators/bmo_hull.c +++ b/source/blender/bmesh/operators/bmo_hull.c @@ -46,10 +46,10 @@ /* Internal operator flags */ typedef enum { HULL_FLAG_INPUT = (1 << 0), - + HULL_FLAG_INTERIOR_ELE = (1 << 1), HULL_FLAG_OUTPUT_GEOM = (1 << 2), - + HULL_FLAG_DEL = (1 << 3), HULL_FLAG_HOLE = (1 << 4) } HullFlags; @@ -106,7 +106,7 @@ static BMFace *hull_find_example_face(BMesh *bm, BMEdge *e) static void hull_output_triangles(BMesh *bm, GSet *hull_triangles) { GSetIterator iter; - + GSET_ITER (iter, hull_triangles) { HullTriangle *t = BLI_gsetIterator_getKey(&iter); int i; @@ -213,7 +213,7 @@ static HullFinalEdges *hull_final_edges(GSet *hull_triangles) { HullFinalEdges *final_edges; GSetIterator iter; - + final_edges = MEM_callocN(sizeof(HullFinalEdges), "HullFinalEdges"); final_edges->edges = BLI_ghash_ptr_new("final edges ghash"); final_edges->base_pool = BLI_mempool_create(sizeof(ListBase), 0, 128, BLI_MEMPOOL_NOP); @@ -286,7 +286,7 @@ static void hull_remove_overlapping( break; } } - + /* Note: can't change ghash while iterating, so mark * with 'skip' flag rather than deleting triangles */ if (BM_vert_in_face(t->v[1], f) && @@ -336,7 +336,7 @@ static void hull_tag_unused(BMesh *bm, BMOperator *op) BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) { if (BMO_vert_flag_test(bm, v, HULL_FLAG_INTERIOR_ELE)) { bool del = true; - + BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) { if (!BMO_edge_flag_test(bm, e, HULL_FLAG_INPUT)) { del = false; @@ -406,7 +406,7 @@ static void hull_tag_holes(BMesh *bm, BMOperator *op) BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) { bool hole = true; bool any_faces = false; - + BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) { any_faces = true; if (!BMO_face_flag_test(bm, f, HULL_FLAG_HOLE)) { @@ -511,7 +511,7 @@ static void hull_from_bullet( hull = plConvexHullCompute(coords, num_input_verts); hull_verts = hull_verts_from_bullet(hull, input_verts, num_input_verts); - + count = plConvexHullNumFaces(hull); for (i = 0; i < count; i++) { const int len = plConvexHullGetFaceSize(hull, i); @@ -601,7 +601,7 @@ void bmo_convex_hull_exec(BMesh *bm, BMOperator *op) hull_from_bullet(bm, op, hull_triangles, hull_pool); final_edges = hull_final_edges(hull_triangles); - + hull_mark_interior_elements(bm, op, final_edges); /* Remove hull triangles covered by an existing face */ diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c index f1bf3179cd6..64f9773714b 100644 --- a/source/blender/bmesh/operators/bmo_mirror.c +++ b/source/blender/bmesh/operators/bmo_mirror.c @@ -57,13 +57,13 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op) BMOpSlot *slot_targetmap; ototvert = bm->totvert; - + BMO_slot_mat4_get(op->slots_in, "matrix", mtx); invert_m4_m4(imtx, mtx); - + BMO_op_initf(bm, &dupeop, op->flag, "duplicate geom=%s", op, "geom"); BMO_op_exec(bm, &dupeop); - + BMO_slot_buffer_flag_enable(bm, dupeop.slots_out, "geom.out", BM_ALL_NOLOOP, ELE_NEW); /* create old -> new mappin */ @@ -74,7 +74,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op) BMO_op_callf(bm, op->flag, "transform verts=%fv matrix=%m4", ELE_NEW, mtx); BMO_op_callf(bm, op->flag, "scale verts=%fv vec=%v", ELE_NEW, scale); BMO_op_callf(bm, op->flag, "transform verts=%fv matrix=%m4", ELE_NEW, imtx); - + BMO_op_init(bm, &weldop, op->flag, "weld_verts"); slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap"); @@ -87,7 +87,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op) } v = BM_iter_step(&iter); } - + if (mirror_u || mirror_v) { BMFace *f; BMLoop *l; @@ -109,7 +109,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op) } BMO_op_exec(bm, &weldop); - + BMO_op_finish(bm, &weldop); BMO_op_finish(bm, &dupeop); diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index 95d61763902..fd9b88ca4d3 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -940,7 +940,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_VERT, VERT_MARK); BMO_op_callf(bm, op->flag, "rotate cent=%v matrix=%m3 verts=%S", vec, cmat, &bmop, "geom.out"); - + prevop = bmop; } @@ -1041,7 +1041,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op) v3 = eva[icoface[a][2]]; f = BM_face_create_quad_tri(bm, v1, v2, v3, NULL, NULL, BM_CREATE_NOP); - + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BMO_edge_flag_enable(bm, l->e, EDGE_MARK); } @@ -1296,10 +1296,10 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) BMVert *v1, *lastv1 = NULL, *cent1, *firstv1 = NULL; float vec[3], mat[4][4], phi, phid; int a; - + if (!segs) return; - + BMO_slot_mat4_get(op->slots_in, "matrix", mat); phid = 2.0f * (float)M_PI / segs; @@ -1308,7 +1308,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) if (cap_ends) { zero_v3(vec); mul_m4_v3(mat, vec); - + cent1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); BMO_vert_flag_enable(bm, cent1, VERT_MARK); } @@ -1322,17 +1322,17 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) v1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); BMO_vert_flag_enable(bm, v1, VERT_MARK); - + if (lastv1) BM_edge_create(bm, v1, lastv1, NULL, BM_CREATE_NOP); - + if (a && cap_ends) { BMFace *f; - + f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, BM_CREATE_NOP); BMO_face_flag_enable(bm, f, FACE_NEW); } - + if (!firstv1) firstv1 = v1; @@ -1346,7 +1346,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) if (cap_ends) { BMFace *f; - + f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, BM_CREATE_NOP); BMO_face_flag_enable(bm, f, FACE_NEW); @@ -1354,11 +1354,11 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) BM_mesh_calc_uvs_circle(bm, mat, radius, FACE_NEW, cd_loop_uv_offset); } } - + if (!cap_tris) { BMO_op_callf(bm, op->flag, "dissolve_faces faces=%ff", FACE_NEW); } - + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK); } @@ -1421,10 +1421,10 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op) const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV); const bool calc_uvs = (cd_loop_uv_offset != -1) && BMO_slot_bool_get(op->slots_in, "calc_uvs"); int a; - + if (!segs) return; - + BMO_slot_mat4_get(op->slots_in, "matrix", mat); phid = 2.0f * (float)M_PI / segs; @@ -1435,13 +1435,13 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op) vec[0] = vec[1] = 0.0f; vec[2] = -depth; mul_m4_v3(mat, vec); - + cent1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); vec[0] = vec[1] = 0.0f; vec[2] = depth; mul_m4_v3(mat, vec); - + cent2 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); BMO_vert_flag_enable(bm, cent1, VERT_MARK); @@ -1522,7 +1522,7 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op) if (!cap_tris) { BMO_op_callf(bm, op->flag, "dissolve_faces faces=%ff", FACE_NEW); } - + BMO_op_callf(bm, op->flag, "remove_doubles verts=%fv dist=%f", VERT_MARK, 0.000001); BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK); } diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c index e85751531ae..8468227d17e 100644 --- a/source/blender/bmesh/operators/bmo_removedoubles.c +++ b/source/blender/bmesh/operators/bmo_removedoubles.c @@ -303,7 +303,7 @@ void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op) if (l_first == NULL) { l_first = l; } - + for (i = 0; i < bm->ldata.totlayer; i++) { if (CustomData_layer_has_math(&bm->ldata, i)) { const int type = bm->ldata.layers[i].type; @@ -312,7 +312,7 @@ void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op) e1 = BM_ELEM_CD_GET_VOID_P(l_first, offset); e2 = BM_ELEM_CD_GET_VOID_P(l, offset); - + CustomData_data_multiply(type, e2, fac); if (l != l_first) { @@ -348,7 +348,7 @@ void bmo_average_vert_facedata_exec(BMesh *bm, BMOperator *op) if (!CustomData_layer_has_math(&bm->ldata, i)) continue; - + CustomData_data_initminmax(type, &min, &max); BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) { @@ -378,7 +378,7 @@ void bmo_pointmerge_exec(BMesh *bm, BMOperator *op) BMVert *v, *vert_snap = NULL; float vec[3]; BMOpSlot *slot_targetmap; - + BMO_slot_vec_get(op->slots_in, "merge_co", vec); //BMO_op_callf(bm, op->flag, "collapse_uvs edges=%s", op, "edges"); diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index 8f998797a16..90cbe9a5d76 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -156,7 +156,7 @@ static BMEdge *connect_smallest_face(BMesh *bm, BMVert *v_a, BMVert *v_b, BMFace BLI_assert(!BM_loop_is_adjacent(l_a, l_b)); f_new = BM_face_split(bm, f, l_a, l_b, &l_new, NULL, false); - + if (r_f_new) *r_f_new = f_new; return l_new ? l_new->e : NULL; } @@ -380,7 +380,7 @@ static BMVert *bm_subdivide_edge_addvert( BMEdge **r_edge) { BMVert *v_new; - + v_new = BM_edge_split(bm, edge, edge->v1, r_edge, factor_edge_split); BMO_vert_flag_enable(bm, v_new, ELE_INNER); @@ -402,7 +402,7 @@ static BMVert *bm_subdivide_edge_addvert( } } #endif - + interp_v3_v3v3(v_new->no, v_a->no, v_b->no, factor_subd); normalize_v3(v_new->no); @@ -426,7 +426,7 @@ static BMVert *subdivide_edge_num( factor_edge_split = 1.0f / (float)(totpoint + 1 - curpoint); factor_subd = (float)(curpoint + 1) / (float)(totpoint + 1); } - + v_new = bm_subdivide_edge_addvert( bm, edge, e_orig, params, factor_edge_split, factor_subd, @@ -444,7 +444,7 @@ static void bm_subdivide_multicut( e_tmp.v1 = &v1_tmp; e_tmp.v2 = &v2_tmp; - + for (i = 0; i < numcuts; i++) { v = subdivide_edge_num(bm, eed, &e_tmp, i, params->numcuts, params, v_a, v_b, &e_new); @@ -456,7 +456,7 @@ static void bm_subdivide_multicut( if (v->e) BM_CHECK_ELEMENT(v->e); if (v->e && v->e->l) BM_CHECK_ELEMENT(v->e->l->f); } - + alter_co(v1, &e_tmp, params, 0, &v1_tmp, &v2_tmp); alter_co(v2, &e_tmp, params, 1.0, &v1_tmp, &v2_tmp); } @@ -526,7 +526,7 @@ static void quad_2edge_split_path(BMesh *bm, BMFace *UNUSED(face), BMVert **vert { BMFace *f_new; int i, numcuts = params->numcuts; - + for (i = 0; i < numcuts; i++) { connect_smallest_face(bm, verts[i], verts[numcuts + (numcuts - i)], &f_new); } @@ -556,7 +556,7 @@ static void quad_2edge_split_innervert(BMesh *bm, BMFace *UNUSED(face), BMVert * BMVert *v, *v_last; BMEdge *e, *e_new, e_tmp; int i, numcuts = params->numcuts; - + v_last = verts[numcuts]; for (i = numcuts - 1; i >= 0; i--) { @@ -629,7 +629,7 @@ static void quad_3edge_split(BMesh *bm, BMFace *UNUSED(face), BMVert **verts, { BMFace *f_new; int i, add = 0, numcuts = params->numcuts; - + for (i = 0; i < numcuts; i++) { if (i == numcuts / 2) { if (numcuts % 2 != 0) { @@ -687,12 +687,12 @@ static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts for (i = 0; i < numcuts + 2; i++) { lines[(s - 1) * s + i] = verts[numcuts + i]; } - + /* first and last members of middle lines */ for (i = 0; i < numcuts; i++) { a = i; b = numcuts + 1 + numcuts + 1 + (numcuts - i - 1); - + e = connect_smallest_face(bm, verts[a], verts[b], &f_new); if (!e) continue; @@ -700,10 +700,10 @@ static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts BMO_edge_flag_enable(bm, e, ELE_INNER); BMO_face_flag_enable(bm, f_new, ELE_INNER); - + v1 = lines[(i + 1) * s] = verts[a]; v2 = lines[(i + 1) * s + s - 1] = verts[b]; - + e_tmp = *e; for (a = 0; a < numcuts; a++) { v = subdivide_edge_num(bm, e, &e_tmp, a, numcuts, params, v1, v2, &e_new); @@ -748,7 +748,7 @@ static void tri_1edge_split(BMesh *bm, BMFace *UNUSED(face), BMVert **verts, { BMFace *f_new; int i, numcuts = params->numcuts; - + for (i = 0; i < numcuts; i++) { connect_smallest_face(bm, verts[i], verts[numcuts + 1], &f_new); } @@ -780,13 +780,13 @@ static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts, BMVert ***lines, *v, v1_tmp, v2_tmp; void *stackarr[1]; int i, j, a, b, numcuts = params->numcuts; - + /* number of verts in each lin */ lines = MEM_callocN(sizeof(void *) * (numcuts + 2), "triangle vert table"); - + lines[0] = (BMVert **) stackarr; lines[0][0] = verts[numcuts * 2 + 1]; - + lines[numcuts + 1] = MEM_callocN(sizeof(void *) * (numcuts + 2), "triangle vert table 2"); for (i = 0; i < numcuts; i++) { lines[numcuts + 1][i + 1] = verts[i]; @@ -806,7 +806,7 @@ static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts, lines[i + 1][0] = verts[a]; lines[i + 1][i + 1] = verts[b]; - + e_tmp = *e; v1_tmp = *verts[a]; v2_tmp = *verts[b]; @@ -819,7 +819,7 @@ static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts, BMO_edge_flag_enable(bm, e_new, ELE_INNER); } } - + /** *
 	 *         v5
@@ -906,9 +906,9 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 	float smooth, fractal, along_normal;
 	bool use_sphere, use_single_edge, use_grid_fill, use_only_quads;
 	int cornertype, seed, i, j, a, b, numcuts, totesel, smooth_falloff;
-	
+
 	BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, SUBD_SPLIT);
-	
+
 	numcuts = BMO_slot_int_get(op->slots_in, "cuts");
 	seed = BMO_slot_int_get(op->slots_in, "seed");
 	smooth = BMO_slot_float_get(op->slots_in, "smooth");
@@ -935,7 +935,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 			patterns[1] = &quad_2edge_fan;
 			break;
 	}
-	
+
 	if (use_single_edge) {
 		patterns[0] = &quad_1edge;
 		patterns[2] = &tri_1edge;
@@ -953,12 +953,12 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 		patterns[3] = NULL;
 		patterns[5] = NULL;
 	}
-	
+
 	/* add a temporary shapekey layer to store displacements on current geometry */
 	BM_data_layer_add(bm, &bm->vdata, CD_SHAPEKEY);
 
 	bmo_subd_init_shape_info(bm, ¶ms);
-	
+
 	BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
 		float *co = BM_ELEM_CD_GET_VOID_P(v, params.shape_info.cd_vert_shape_offset_tmp);
 		copy_v3_v3(co, v->co);
@@ -990,7 +990,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 
 		BLI_rng_free(rng);
 	}
-	
+
 	BMO_slot_map_to_flag(bm, op->slots_in, "custom_patterns",
 	                     BM_FACE, FACE_CUSTOMFILL);
 
@@ -1105,10 +1105,10 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 			}
 
 		}
-		
+
 		if (!matched && totesel) {
 			SubDFaceData *fd;
-			
+
 			BMO_face_flag_enable(bm, face, SUBD_SPLIT);
 
 			/* must initialize all members here */
@@ -1146,7 +1146,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 
 		if (!pat && fd->totedgesel == 2) {
 			int vlen;
-			
+
 			/* ok, no pattern.  we still may be able to do something */
 			BLI_array_clear(loops);
 			BLI_array_clear(loops_split);
@@ -1156,7 +1156,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 			BM_ITER_ELEM_INDEX (l, &liter, face, BM_LOOPS_OF_FACE, a) {
 				loops[a] = l;
 			}
-			
+
 			vlen = BLI_array_len(loops);
 
 			/* find the boundary of one of the split edges */
@@ -1167,7 +1167,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 					break;
 				}
 			}
-			
+
 			if (BMO_vert_flag_test(bm, loops[(a + numcuts + 1) % vlen]->v, ELE_INNER)) {
 				b = (a + numcuts + 1) % vlen;
 			}
@@ -1182,7 +1182,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 					}
 				}
 			}
-			
+
 			b += numcuts - 1;
 
 			BLI_array_grow_items(loops_split, numcuts);
@@ -1230,7 +1230,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 				b = (b - 1) % vlen;
 				a = (a + 1) % vlen;
 			}
-			
+
 			/* Since these are newly created vertices, we don't need to worry about them being legal,
 			 * ... though there are some cases we _should_ check for
 			 * - concave corner of an ngon.
@@ -1281,7 +1281,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 	}
 
 	BM_data_layer_free_n(bm, &bm->vdata, CD_SHAPEKEY, params.shape_info.tmpkey);
-	
+
 	BLI_stack_free(facedata);
 	if (edges) BLI_array_free(edges);
 	if (verts) BLI_array_free(verts);
@@ -1290,7 +1290,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 
 	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_inner.out", BM_ALL_NOLOOP, ELE_INNER);
 	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_split.out", BM_ALL_NOLOOP, ELE_SPLIT);
-	
+
 	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL_NOLOOP, ELE_INNER | ELE_SPLIT | SUBD_SPLIT);
 }
 
@@ -1306,7 +1306,7 @@ void BM_mesh_esubdivide(
         const int seed)
 {
 	BMOperator op;
-	
+
 	/* use_sphere isnt exposed here since its only used for new primitives */
 	BMO_op_initf(bm, &op, BMO_FLAG_DEFAULTS,
 	             "subdivide_edges edges=%he "
@@ -1325,9 +1325,9 @@ void BM_mesh_esubdivide(
 	             use_single_edge, use_grid_fill,
 	             use_only_quads,
 	             seed);
-	
+
 	BMO_op_exec(bm, &op);
-	
+
 	switch (seltype) {
 		case SUBDIV_SELECT_NONE:
 			break;
@@ -1354,11 +1354,11 @@ void bmo_bisect_edges_exec(BMesh *bm, BMOperator *op)
 	BMOIter siter;
 	BMEdge *e;
 	SubDParams params = {0};
-	
+
 	params.numcuts = BMO_slot_int_get(op->slots_in, "cuts");
 	params.op = op;
 	params.slot_edge_percents = BMO_slot_get(op->slots_in, "edge_percents");
-	
+
 	BM_data_layer_add(bm, &bm->vdata, CD_SHAPEKEY);
 
 	bmo_subd_init_shape_info(bm, ¶ms);
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index 163a9ef599c..e686ef0429a 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -83,9 +83,9 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
 	sf_vert_map = BLI_ghash_ptr_new_ex(__func__, BMO_slot_buffer_count(op->slots_in, "edges"));
 
 	BMO_slot_vec_get(op->slots_in, "normal", normal);
-	
+
 	BLI_scanfill_begin(&sf_ctx);
-	
+
 	BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 		ScanFillVert *sf_verts[2];
 		BMVert **e_verts = &e->v1;
@@ -108,7 +108,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
 	}
 	nors_tot = BLI_ghash_len(sf_vert_map);
 	BLI_ghash_free(sf_vert_map, NULL, NULL);
-	
+
 
 	if (is_zero_v3(normal)) {
 		/* calculate the normal from the cross product of vert-edge pairs.
@@ -225,7 +225,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
 		f = BM_face_create_quad_tri(bm,
 		                            sf_tri->v1->tmp.p, sf_tri->v2->tmp.p, sf_tri->v3->tmp.p, NULL,
 		                            NULL, BM_CREATE_NO_DOUBLE);
-		
+
 		BMO_face_flag_enable(bm, f, ELE_NEW);
 		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
 			if (!BMO_edge_flag_test(bm, l->e, EDGE_MARK)) {
@@ -233,9 +233,9 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
 			}
 		}
 	}
-	
+
 	BLI_scanfill_end(&sf_ctx);
-	
+
 	if (use_beauty) {
 		BMOperator bmop;
 
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index ca96e5b4b78..33380cee18e 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -151,7 +151,7 @@ typedef struct BoundVert {
 	bool any_seam;      /* are any of the edges attached here seams? */
 	bool visited;       /* used during delta adjust pass */
 //	int _pad;
-} BoundVert;	
+} BoundVert;
 
 /* Mesh structure replacing a vertex */
 typedef struct VMesh {
@@ -511,7 +511,7 @@ static BMFace *bev_create_ngon(
 
 static BMFace *bev_create_quad(
         BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
-        BMFace *f1, BMFace *f2, BMFace *f3, BMFace *f4, 
+        BMFace *f1, BMFace *f2, BMFace *f3, BMFace *f4,
         int mat_nr)
 {
 	BMVert *varr[4] = {v1, v2, v3, v4};
@@ -521,7 +521,7 @@ static BMFace *bev_create_quad(
 
 static BMFace *bev_create_quad_ex(
         BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
-        BMFace *f1, BMFace *f2, BMFace *f3, BMFace *f4, 
+        BMFace *f1, BMFace *f2, BMFace *f3, BMFace *f4,
         BMEdge *e1, BMEdge *e2, BMEdge *e3, BMEdge *e4,
         int mat_nr)
 {
@@ -1355,7 +1355,7 @@ static void get_profile_point(BevelParams *bp, const Profile *pro, int i, int n,
 		else
 			copy_v3_v3(r_co, pro->cob);
 	}
-	
+
 	else {
 		if (n == bp->seg) {
 			BLI_assert(pro->prof_co != NULL);
@@ -2119,7 +2119,7 @@ static void adjust_the_cycle_or_chain(BoundVert *vstart, bool iscycle)
 #ifdef DEBUG_ADJUST
 			printf("b[%d]=%f * %f, for e%d->offset_r\n", row, weight, eright->offset_r, BM_elem_index_get(eright->e));
 #endif
-			
+
 			/* residue np + 2*i + 1 (if cycle) else np - 1 + 2*i + 1:
 			 * left offset for parm i matches its spec; weighted */
 			 row = row + 1;
@@ -2607,7 +2607,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
 	float beta, gamma;
 	VMesh *vm1;
 	BoundVert *bndv;
-	
+
 	n = vm0->count;
 	ns0 = vm0->seg;
 	ns20 = ns0 / 2;
@@ -2627,7 +2627,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
 			add_v3_v3v3(acc, co1, co2);
 			madd_v3_v3fl(acc, co, -2.0f);
 			madd_v3_v3fl(co, acc, -1.0f / 6.0f);
-			
+
 			copy_v3_v3(mesh_vert_canon(vm1, i, 0, 2 * k)->co, co);
 		}
 	}
@@ -2642,7 +2642,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
 			add_v3_v3v3(acc, co1, co2);
 			madd_v3_v3fl(acc, co, -2.0f);
 			madd_v3_v3fl(co, acc, -1.0f / 6.0f);
-			
+
 			copy_v3_v3(mesh_vert_canon(vm1, i, 0, k)->co, co);
 		}
 		bndv = bndv->next;
@@ -2661,7 +2661,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
 
 	/* Now we do the internal vertices, using standard Catmull-Clark
 	 * and assuming all boundary vertices have valence 4 */
-	
+
 	/* The new face vertices */
 	for (i = 0; i < n; i++) {
 		for (j = 0; j < ns20; j++) {
@@ -2882,7 +2882,7 @@ static VMesh *make_cube_corner_adj_vmesh(BevelParams *bp)
 		copy_v3_v3(bndv->profile.proj_dir, bndv->profile.plane_no);
 		calculate_profile(bp, bndv);
 		get_profile_point(bp, &bndv->profile, 1, 2, mesh_vert(vm0, i, 0, 1)->co);
-		
+
 		bndv = bndv->next;
 	}
 	/* center vertex */
@@ -4618,7 +4618,7 @@ static void bevel_reattach_wires(BMesh *bm, BevelParams *bp, BMVert *v)
 						vclosest = bndv->nv.v;
 						votherclosest = bndvother->nv.v;
 						dclosest = d;
-						
+
 					}
 				} while ((bndvother = bndvother->next) != bvother->vmesh->boundstart);
 			}
@@ -5215,7 +5215,7 @@ static float geometry_collide_offset(BevelParams *bp, EdgeHalf *eb)
 	kc = kc / bp->offset;
 	th1 = angle_v3v3v3(va->co, vb->co, vc->co);
 	th2 = angle_v3v3v3(vb->co, vc->co, vd->co);
-	
+
 	/* First calculate offset at which edge B collapses, which happens
 	 * when advancing clones of A, B, C all meet at a point.
 	 * This only happens if at least two of those three edges have non-zero k's */
-- 
cgit v1.2.3