diff options
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_construct.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_core.c | 58 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_delete.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_edgeloop.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_interp.c | 44 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_iterators.c | 10 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_iterators_inline.h | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_log.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_marking.c | 16 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh.c | 20 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mods.c | 36 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operators.c | 48 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_polygon.c | 8 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_queries.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_structure.c | 14 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_walkers.c | 6 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_walkers_impl.c | 32 |
17 files changed, 154 insertions, 154 deletions
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; } |