diff options
Diffstat (limited to 'source/blender')
38 files changed, 263 insertions, 296 deletions
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index 01fe1c83bc0..76095728d5a 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -80,7 +80,7 @@ BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example) BM_elem_attrs_copy(bm, bm, example, v); } - BM_CHECK_ELEMENT(bm, v); + BM_CHECK_ELEMENT(v); return v; } @@ -122,7 +122,7 @@ BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, if (example) BM_elem_attrs_copy(bm, bm, example, e); - BM_CHECK_ELEMENT(bm, e); + BM_CHECK_ELEMENT(e); return e; } @@ -314,12 +314,12 @@ BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len, f->len = len; - BM_CHECK_ELEMENT(bm, f); + BM_CHECK_ELEMENT(f); return f; } -int bmesh_elem_check(BMesh *UNUSED(bm), void *element, const char htype) +int bmesh_elem_check(void *element, const char htype) { BMHeader *head = element; int err = 0; @@ -555,7 +555,7 @@ void BM_face_kill(BMesh *bm, BMFace *f) BMLoopList *ls, *ls_next; #endif - BM_CHECK_ELEMENT(bm, f); + BM_CHECK_ELEMENT(f); #ifdef USE_BMESH_HOLES for (ls = f->loops.first; ls; ls = ls_next) @@ -733,15 +733,15 @@ static int bm_loop_reverse_loop(BMesh *bm, BMFace *f /* validate radia */ for (i = 0, l_iter = l_first; i < len; i++, l_iter = l_iter->next) { - BM_CHECK_ELEMENT(bm, l_iter); - BM_CHECK_ELEMENT(bm, l_iter->e); - BM_CHECK_ELEMENT(bm, l_iter->v); - BM_CHECK_ELEMENT(bm, l_iter->f); + BM_CHECK_ELEMENT(l_iter); + BM_CHECK_ELEMENT(l_iter->e); + BM_CHECK_ELEMENT(l_iter->v); + BM_CHECK_ELEMENT(l_iter->f); } BLI_array_free(edar); - BM_CHECK_ELEMENT(bm, f); + BM_CHECK_ELEMENT(f); return 1; } @@ -755,7 +755,7 @@ int bmesh_loop_reverse(BMesh *bm, BMFace *f) #endif } -static void bm_elements_systag_enable(BMesh *UNUSED(bm), void *veles, int tot, int flag) +static void bm_elements_systag_enable(void *veles, int tot, int flag) { BMHeader **eles = veles; int i; @@ -765,7 +765,7 @@ static void bm_elements_systag_enable(BMesh *UNUSED(bm), void *veles, int tot, i } } -static void bm_elements_systag_disable(BMesh *UNUSED(bm), void *veles, int tot, int flag) +static void bm_elements_systag_disable(void *veles, int tot, int flag) { BMHeader **eles = veles; int i; @@ -893,7 +893,7 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const short do_del if (totface == 1) return faces[0]; - bm_elements_systag_enable(bm, faces, totface, _FLAG_JF); + bm_elements_systag_enable(faces, totface, _FLAG_JF); for (i = 0; i < totface; i++) { f = faces[i]; @@ -1012,7 +1012,7 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const short do_del } while ((l_iter = l_iter->next) != l_first); } - bm_elements_systag_disable(bm, faces, totface, _FLAG_JF); + bm_elements_systag_disable(faces, totface, _FLAG_JF); BM_ELEM_API_FLAG_DISABLE(newf, _FLAG_JF); /* handle multi-res data */ @@ -1046,11 +1046,11 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const short do_del BLI_array_free(deledges); BLI_array_free(delverts); - BM_CHECK_ELEMENT(bm, newf); + BM_CHECK_ELEMENT(newf); return newf; error: - bm_elements_systag_disable(bm, faces, totface, _FLAG_JF); + bm_elements_systag_disable(faces, totface, _FLAG_JF); BLI_array_free(edges); BLI_array_free(deledges); BLI_array_free(delverts); @@ -1092,13 +1092,13 @@ static BMFace *bm_face_create__sfme(BMesh *bm, BMFace *UNUSED(example)) * \par Examples: * * Before: After: - * ---------- ---------- + * +--------+ +--------+ * | | | | * | | | f1 | * v1 f1 v2 v1======v2 * | | | f2 | * | | | | - * ---------- ---------- + * +--------+ +--------+ * * \note the input vertices can be part of the same edge. This will * result in a two edged face. This is desirable for advanced construction @@ -1243,9 +1243,9 @@ BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, } #endif - BM_CHECK_ELEMENT(bm, e); - BM_CHECK_ELEMENT(bm, f); - BM_CHECK_ELEMENT(bm, f2); + BM_CHECK_ELEMENT(e); + BM_CHECK_ELEMENT(f); + BM_CHECK_ELEMENT(f2); return f2; } @@ -1391,10 +1391,10 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e) BMESH_ASSERT(l->e != l->next->e); /* verify loop cycle for kloop-> */ - BM_CHECK_ELEMENT(bm, l); - BM_CHECK_ELEMENT(bm, l->v); - BM_CHECK_ELEMENT(bm, l->e); - BM_CHECK_ELEMENT(bm, l->f); + BM_CHECK_ELEMENT(l); + BM_CHECK_ELEMENT(l->v); + BM_CHECK_ELEMENT(l->e); + BM_CHECK_ELEMENT(l->f); } /* verify loop->v and loop->next->v pointers for ne */ for (i = 0, l = ne->l; i < radlen; i++, l = l->radial_next) { @@ -1406,18 +1406,18 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e) BMESH_ASSERT(l->v != l->next->v); BMESH_ASSERT(l->e != l->next->e); - BM_CHECK_ELEMENT(bm, l); - BM_CHECK_ELEMENT(bm, l->v); - BM_CHECK_ELEMENT(bm, l->e); - BM_CHECK_ELEMENT(bm, l->f); + BM_CHECK_ELEMENT(l); + BM_CHECK_ELEMENT(l->v); + BM_CHECK_ELEMENT(l->e); + BM_CHECK_ELEMENT(l->f); } } - BM_CHECK_ELEMENT(bm, ne); - BM_CHECK_ELEMENT(bm, nv); - BM_CHECK_ELEMENT(bm, ov); - BM_CHECK_ELEMENT(bm, e); - BM_CHECK_ELEMENT(bm, tv); + BM_CHECK_ELEMENT(ne); + BM_CHECK_ELEMENT(nv); + BM_CHECK_ELEMENT(ov); + BM_CHECK_ELEMENT(e); + BM_CHECK_ELEMENT(tv); if (r_e) *r_e = ne; return nv; @@ -1561,10 +1561,10 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou edok = bmesh_loop_validate(l->f); BMESH_ASSERT(edok != FALSE); - BM_CHECK_ELEMENT(bm, l); - BM_CHECK_ELEMENT(bm, l->v); - BM_CHECK_ELEMENT(bm, l->e); - BM_CHECK_ELEMENT(bm, l->f); + BM_CHECK_ELEMENT(l); + BM_CHECK_ELEMENT(l->v); + BM_CHECK_ELEMENT(l->e); + BM_CHECK_ELEMENT(l->f); } if (check_edge_double) { @@ -1574,9 +1574,9 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou } } - BM_CHECK_ELEMENT(bm, ov); - BM_CHECK_ELEMENT(bm, tv); - BM_CHECK_ELEMENT(bm, oe); + BM_CHECK_ELEMENT(ov); + BM_CHECK_ELEMENT(tv); + BM_CHECK_ELEMENT(oe); return oe; } @@ -1718,7 +1718,7 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e) /* account for both above */ bm->elem_index_dirty |= BM_EDGE | BM_FACE; - BM_CHECK_ELEMENT(bm, f1); + BM_CHECK_ELEMENT(f1); /* validate the new loop cycle */ edok = bmesh_loop_validate(f1); @@ -1757,8 +1757,8 @@ int BM_vert_splice(BMesh *bm, BMVert *v, BMVert *vtarget) bmesh_disk_edge_append(e, vtarget); } - BM_CHECK_ELEMENT(bm, v); - BM_CHECK_ELEMENT(bm, vtarget); + BM_CHECK_ELEMENT(v); + BM_CHECK_ELEMENT(vtarget); /* v is unused now, and can be killed */ BM_vert_kill(bm, v); @@ -1880,7 +1880,7 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len) BLI_ghash_free(visithash, NULL, NULL); for (i = 0; i < maxindex; i++) { - BM_CHECK_ELEMENT(bm, verts[i]); + BM_CHECK_ELEMENT(verts[i]); } if (r_vout_len != NULL) { @@ -1943,8 +1943,8 @@ int BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *etarget) BLI_assert(bmesh_radial_length(e->l) == 0); - BM_CHECK_ELEMENT(bm, e); - BM_CHECK_ELEMENT(bm, etarget); + BM_CHECK_ELEMENT(e); + BM_CHECK_ELEMENT(etarget); /* removes from disks too */ BM_edge_kill(bm, e); @@ -1989,8 +1989,8 @@ int bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep) BLI_assert(bmesh_radial_length(e->l) == radlen - 1); BLI_assert(bmesh_radial_length(ne->l) == 1); - BM_CHECK_ELEMENT(bm, ne); - BM_CHECK_ELEMENT(bm, e); + BM_CHECK_ELEMENT(ne); + BM_CHECK_ELEMENT(e); return TRUE; } diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index c56d2c622a4..5149a5436a2 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -327,16 +327,16 @@ static void mdisp_axis_from_quad(float v1[3], float v2[3], float UNUSED(v3[3]), /* tl is loop to project onto, l is loop whose internal displacement, co, is being * projected. x and y are location in loop's mdisps grid of point co. */ -static int mdisp_in_mdispquad(BMesh *bm, BMLoop *l, BMLoop *tl, float p[3], float *x, float *y, +static int mdisp_in_mdispquad(BMLoop *l, BMLoop *tl, float p[3], float *x, float *y, int res, float axis_x[3], float axis_y[3]) { float v1[3], v2[3], c[3], v3[3], v4[3], e1[3], e2[3]; float eps = FLT_EPSILON * 4000; if (len_v3(l->v->no) == 0.0f) - BM_vert_normal_update_all(bm, l->v); + BM_vert_normal_update_all(l->v); if (len_v3(tl->v->no) == 0.0f) - BM_vert_normal_update_all(bm, tl->v); + BM_vert_normal_update_all(tl->v); compute_mdisp_quad(tl, v1, v2, v3, v4, e1, e2); @@ -466,7 +466,7 @@ static void bm_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source) md1 = CustomData_bmesh_get(&bm->ldata, target->head.data, CD_MDISPS); md2 = CustomData_bmesh_get(&bm->ldata, l_iter->head.data, CD_MDISPS); - if (mdisp_in_mdispquad(bm, target, l_iter, co, &x2, &y2, res, src_axis_x, src_axis_y)) { + if (mdisp_in_mdispquad(target, l_iter, co, &x2, &y2, res, src_axis_x, src_axis_y)) { old_mdisps_bilinear(md1->disps[iy * res + ix], md2->disps, res, (float)x2, (float)y2); bm_loop_flip_disp(src_axis_x, src_axis_y, axis_x, axis_y, md1->disps[iy * res + ix]); diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index 2e61592c172..7cf29031765 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -563,7 +563,7 @@ BMFace *BM_active_face_get(BMesh *bm, int sloppy) * - #EM_editselection_normal * - #EM_editselection_plane */ -void BM_editselection_center(BMesh *bm, float r_center[3], BMEditSelection *ese) +void BM_editselection_center(float r_center[3], BMEditSelection *ese) { if (ese->htype == BM_VERT) { BMVert *eve = (BMVert *)ese->ele; @@ -576,7 +576,7 @@ void BM_editselection_center(BMesh *bm, float r_center[3], BMEditSelection *ese) } else if (ese->htype == BM_FACE) { BMFace *efa = (BMFace *)ese->ele; - BM_face_center_bounds_calc(bm, efa, r_center); + BM_face_center_bounds_calc(efa, r_center); } } @@ -621,7 +621,7 @@ void BM_editselection_plane(BMesh *bm, float r_plane[3], BMEditSelection *ese) 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(bm, vec, ese->prev); + BM_editselection_center(vec, ese->prev); sub_v3_v3v3(r_plane, vec, eve->co); } else { @@ -890,7 +890,7 @@ void BM_mesh_elem_hflag_enable_all(BMesh *bm, const char htype, const char hflag /***************** Mesh Hiding stuff *********** */ -static void vert_flush_hide_set(BMesh *bm, BMVert *v) +static void vert_flush_hide_set(BMVert *v) { BMIter iter; BMEdge *e; @@ -903,7 +903,7 @@ static void vert_flush_hide_set(BMesh *bm, BMVert *v) BM_elem_flag_set(v, BM_ELEM_HIDDEN, hide); } -static void edge_flush_hide(BMesh *bm, BMEdge *e) +static void edge_flush_hide(BMEdge *e) { BMIter iter; BMFace *f; @@ -916,7 +916,7 @@ static void edge_flush_hide(BMesh *bm, BMEdge *e) BM_elem_flag_set(e, BM_ELEM_HIDDEN, hide); } -void BM_vert_hide_set(BMesh *bm, BMVert *v, int hide) +void BM_vert_hide_set(BMVert *v, int hide) { /* vert hiding: vert + surrounding edges and faces */ BMIter iter, fiter; @@ -934,7 +934,7 @@ void BM_vert_hide_set(BMesh *bm, BMVert *v, int hide) } } -void BM_edge_hide_set(BMesh *bm, BMEdge *e, int hide) +void BM_edge_hide_set(BMEdge *e, int hide) { BMIter iter; BMFace *f; @@ -948,11 +948,11 @@ void BM_edge_hide_set(BMesh *bm, BMEdge *e, int hide) BM_elem_flag_set(e, BM_ELEM_HIDDEN, hide); /* hide vertices if necessary */ - vert_flush_hide_set(bm, e->v1); - vert_flush_hide_set(bm, e->v2); + vert_flush_hide_set(e->v1); + vert_flush_hide_set(e->v2); } -void BM_face_hide_set(BMesh *bm, BMFace *f, int hide) +void BM_face_hide_set(BMFace *f, int hide) { BMIter iter; BMLoop *l; @@ -960,11 +960,11 @@ void BM_face_hide_set(BMesh *bm, BMFace *f, int hide) BM_elem_flag_set(f, BM_ELEM_HIDDEN, hide); BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) { - edge_flush_hide(bm, l->e); + edge_flush_hide(l->e); } BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) { - vert_flush_hide_set(bm, l->v); + vert_flush_hide_set(l->v); } } @@ -975,15 +975,15 @@ void _bm_elem_hide_set(BMesh *bm, BMHeader *head, int hide) switch (head->htype) { case BM_VERT: if (hide) BM_vert_select_set(bm, (BMVert *)head, FALSE); - BM_vert_hide_set(bm, (BMVert *)head, hide); + BM_vert_hide_set((BMVert *)head, hide); break; case BM_EDGE: if (hide) BM_edge_select_set(bm, (BMEdge *)head, FALSE); - BM_edge_hide_set(bm, (BMEdge *)head, hide); + BM_edge_hide_set((BMEdge *)head, hide); break; case BM_FACE: if (hide) BM_face_select_set(bm, (BMFace *)head, FALSE); - BM_face_hide_set(bm, (BMFace *)head, hide); + BM_face_hide_set((BMFace *)head, hide); break; default: BMESH_ASSERT(0); diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h index 73423bc181d..a3e97ea9677 100644 --- a/source/blender/bmesh/intern/bmesh_marking.h +++ b/source/blender/bmesh/intern/bmesh_marking.h @@ -37,9 +37,9 @@ typedef struct BMEditSelection /* geometry hiding code */ #define BM_elem_hide_set(bm, ele, hide) _bm_elem_hide_set(bm, &(ele)->head, hide) void _bm_elem_hide_set(BMesh *bm, BMHeader *ele, int hide); -void BM_vert_hide_set(BMesh *bm, BMVert *v, int hide); -void BM_edge_hide_set(BMesh *bm, BMEdge *e, int hide); -void BM_face_hide_set(BMesh *bm, BMFace *f, int hide); +void BM_vert_hide_set(BMVert *v, int hide); +void BM_edge_hide_set(BMEdge *e, int hide); +void BM_face_hide_set(BMFace *f, int hide); /* Selection code */ #define BM_elem_select_set(bm, ele, hide) _bm_elem_select_set(bm, &(ele)->head, hide) @@ -71,9 +71,9 @@ int BM_mesh_elem_hflag_count_enabled(BMesh *bm, const char htype, const char hfl int BM_mesh_elem_hflag_count_disabled(BMesh *bm, const char htype, const char hflag, int respecthide); /* edit selection stuff */ -void BM_active_face_set(BMesh *em, BMFace *f); +void BM_active_face_set(BMesh *bm, BMFace *f); BMFace *BM_active_face_get(BMesh *bm, int sloppy); -void BM_editselection_center(BMesh *bm, float r_center[3], BMEditSelection *ese); +void BM_editselection_center(float r_center[3], BMEditSelection *ese); void BM_editselection_normal(float r_normal[3], BMEditSelection *ese); void BM_editselection_plane(BMesh *bm, float r_plane[3], BMEditSelection *ese); diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index e2b9732e87a..454ab58d720 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -219,7 +219,7 @@ void BM_mesh_normals_update(BMesh *bm, const short skip_hidden) continue; #endif - BM_face_normal_update(bm, f); + BM_face_normal_update(f); } /* Zero out vertex normals */ diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c index d15e3d36523..574fb62b703 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_conv.c +++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c @@ -582,7 +582,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess) i++; mvert++; - BM_CHECK_ELEMENT(bm, v); + BM_CHECK_ELEMENT(v); } bm->elem_index_dirty &= ~BM_VERT; @@ -608,7 +608,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess) i++; med++; - BM_CHECK_ELEMENT(bm, e); + BM_CHECK_ELEMENT(e); } bm->elem_index_dirty &= ~BM_EDGE; @@ -627,9 +627,9 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess) /* copy over customdat */ CustomData_from_bmesh_block(&bm->ldata, &me->ldata, l->head.data, j); - BM_CHECK_ELEMENT(bm, l); - BM_CHECK_ELEMENT(bm, l->e); - BM_CHECK_ELEMENT(bm, l->v); + BM_CHECK_ELEMENT(l); + BM_CHECK_ELEMENT(l->e); + BM_CHECK_ELEMENT(l->v); } if (f == bm->act_face) me->act_face = i; @@ -639,7 +639,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess) i++; mpoly++; - BM_CHECK_ELEMENT(bm, f); + BM_CHECK_ELEMENT(f); } /* patch hook indices and vertex parents */ diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index a29b657d76e..21654097219 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -817,14 +817,14 @@ int BM_face_validate(BMesh *bm, BMFace *face, FILE *err) * * \note #BM_edge_rotate_check must have already run. */ -void BM_edge_rotate_calc(BMesh *bm, BMEdge *e, int ccw, +void BM_edge_rotate_calc(BMEdge *e, int ccw, BMLoop **r_l1, BMLoop **r_l2) { BMVert *v1, *v2; BMFace *fa, *fb; /* this should have already run */ - BLI_assert(BM_edge_rotate_check(bm, e) == TRUE); + BLI_assert(BM_edge_rotate_check(e) == TRUE); /* we know this will work */ BM_edge_face_pair(e, &fa, &fb); @@ -842,9 +842,6 @@ void BM_edge_rotate_calc(BMesh *bm, BMEdge *e, int ccw, *r_l1 = BM_face_other_vert_loop(fb, v2, v1); *r_l2 = BM_face_other_vert_loop(fa, v1, v2); - - /* when assert isn't used */ - (void)bm; } /** @@ -853,7 +850,7 @@ void BM_edge_rotate_calc(BMesh *bm, BMEdge *e, int ccw, * Quick check to see if we could rotate the edge, * use this to avoid calling exceptions on common cases. */ -int BM_edge_rotate_check(BMesh *UNUSED(bm), BMEdge *e) +int BM_edge_rotate_check(BMEdge *e) { BMFace *fa, *fb; if (BM_edge_face_pair(e, &fa, &fb)) { @@ -894,8 +891,7 @@ int BM_edge_rotate_check(BMesh *UNUSED(bm), BMEdge *e) * \param l1,l2 are the loops of the proposed verts to rotate too and should * be the result of calling #BM_edge_rotate_calc */ -int BM_edge_rotate_check_degenerate(BMesh *bm, BMEdge *e, - BMLoop *l1, BMLoop *l2) +int BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2) { /* note: for these vars 'old' just means initial edge state. */ @@ -922,7 +918,7 @@ int BM_edge_rotate_check_degenerate(BMesh *bm, BMEdge *e, BMVert *v1_alt, *v2_alt; /* this should have already run */ - BLI_assert(BM_edge_rotate_check(bm, e) == TRUE); + BLI_assert(BM_edge_rotate_check(e) == TRUE); BM_edge_ordered_verts(e, &v1_old, &v2_old); @@ -981,12 +977,9 @@ int BM_edge_rotate_check_degenerate(BMesh *bm, BMEdge *e, } return TRUE; - - /* when assert isn't used */ - (void)bm; } -int BM_edge_rotate_check_beauty(BMesh *UNUSED(bm), BMEdge *e, +int BM_edge_rotate_check_beauty(BMEdge *e, BMLoop *l1, BMLoop *l2) { /* Stupid check for now: @@ -1019,11 +1012,11 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_ char f_hflag_prev_1; char f_hflag_prev_2; - if (!BM_edge_rotate_check(bm, e)) { + if (!BM_edge_rotate_check(e)) { return NULL; } - BM_edge_rotate_calc(bm, e, ccw, &l1, &l2); + BM_edge_rotate_calc(e, ccw, &l1, &l2); /* the loops will be freed so assign verts */ v1 = l1->v; @@ -1033,7 +1026,7 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_ /* Checking Code - make sure we can rotate */ if (check_flag & BM_EDGEROT_CHECK_BEAUTY) { - if (!BM_edge_rotate_check_beauty(bm, e, l1, l2)) { + if (!BM_edge_rotate_check_beauty(e, l1, l2)) { return NULL; } } @@ -1047,7 +1040,7 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_ /* slowest, check last */ if (check_flag & BM_EDGEROT_CHECK_DEGENERATE) { - if (!BM_edge_rotate_check_degenerate(bm, e, l1, l2)) { + if (!BM_edge_rotate_check_degenerate(e, l1, l2)) { return NULL; } } diff --git a/source/blender/bmesh/intern/bmesh_mods.h b/source/blender/bmesh/intern/bmesh_mods.h index ba601eb64dc..ba6acac1a27 100644 --- a/source/blender/bmesh/intern/bmesh_mods.h +++ b/source/blender/bmesh/intern/bmesh_mods.h @@ -43,9 +43,9 @@ BMFace *BM_face_split(BMesh *bm, BMFace *f, BMEdge *example, const short nodouble); BMFace *BM_face_split_n(BMesh *bm, BMFace *f, - BMVert *v1, BMVert *v2, - float cos[][3], int n, - BMLoop **r_l, BMEdge *example); + BMVert *v1, BMVert *v2, + float cos[][3], int n, + BMLoop **r_l, BMEdge *example); BMEdge* BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, const short join_faces, const short kill_degenerate_faces); @@ -59,12 +59,12 @@ BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts); int BM_face_validate(BMesh *bm, BMFace *face, FILE *err); -void BM_edge_rotate_calc(BMesh *bm, BMEdge *e, int ccw, - BMLoop **r_l1, BMLoop **r_l2); -int BM_edge_rotate_check(BMesh *UNUSED(bm), BMEdge *e); -int BM_edge_rotate_check_degenerate(BMesh *bm, BMEdge *e, +void BM_edge_rotate_calc(BMEdge *e, int ccw, + BMLoop **r_l1, BMLoop **r_l2); +int BM_edge_rotate_check(BMEdge *e); +int BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2); -int BM_edge_rotate_check_beauty(BMesh *bm, BMEdge *e, +int BM_edge_rotate_check_beauty(BMEdge *e, BMLoop *l1, BMLoop *l2); BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_flag); diff --git a/source/blender/bmesh/intern/bmesh_operators_private.h b/source/blender/bmesh/intern/bmesh_operators_private.h index 62cabe88b05..423b30a503a 100644 --- a/source/blender/bmesh/intern/bmesh_operators_private.h +++ b/source/blender/bmesh/intern/bmesh_operators_private.h @@ -37,11 +37,11 @@ void bmo_split_exec(BMesh *bm, BMOperator *op); void bmo_spin_exec(BMesh *bm, BMOperator *op); void bmo_dupe_exec(BMesh *bm, BMOperator *op); void bmo_del_exec(BMesh *bm, BMOperator *op); -void bmo_esubd_exec(BMesh *bmesh, BMOperator *op); -void bmo_triangulate_exec(BMesh *bmesh, BMOperator *op); -void bmo_dissolve_faces_exec(BMesh *bmesh, BMOperator *op); -void bmo_dissolve_verts_exec(BMesh *bmesh, BMOperator *op); -void bmo_dissolve_limit_exec(BMesh *bmesh, BMOperator *op); +void bmo_esubd_exec(BMesh *bm, BMOperator *op); +void bmo_triangulate_exec(BMesh *bm, BMOperator *op); +void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op); +void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op); +void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op); void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op); void bmo_vertex_slide_exec(BMesh *bm, BMOperator *op); void bmo_connectverts_exec(BMesh *bm, BMOperator *op); diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 971ad96c24a..e7ee5cb605d 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -153,7 +153,7 @@ static void bm_face_compute_poly_normal_vertex_cos(BMFace *f, float n[3], /** * get the area of the face */ -float BM_face_area_calc(BMesh *bm, BMFace *f) +float BM_face_area_calc(BMFace *f) { BMLoop *l; BMIter iter; @@ -187,7 +187,7 @@ float BM_face_area_calc(BMesh *bm, BMFace *f) /** * compute the perimeter of an ngon */ -float BM_face_perimeter_calc(BMesh *UNUSED(bm), BMFace *f) +float BM_face_perimeter_calc(BMFace *f) { BMLoop *l_iter, *l_first; float perimeter = 0.0f; @@ -203,7 +203,7 @@ float BM_face_perimeter_calc(BMesh *UNUSED(bm), BMFace *f) /** * computes center of face in 3d. uses center of bounding box. */ -void BM_face_center_bounds_calc(BMesh *UNUSED(bm), BMFace *f, float r_cent[3]) +void BM_face_center_bounds_calc(BMFace *f, float r_cent[3]) { BMLoop *l_iter; BMLoop *l_first; @@ -222,7 +222,7 @@ void BM_face_center_bounds_calc(BMesh *UNUSED(bm), BMFace *f, float r_cent[3]) /** * computes the center of a face, using the mean average */ -void BM_face_center_mean_calc(BMesh *UNUSED(bm), BMFace *f, float r_cent[3]) +void BM_face_center_mean_calc(BMFace *f, float r_cent[3]) { BMLoop *l_iter; BMLoop *l_first; @@ -332,24 +332,23 @@ void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nvert /** * updates face and vertex normals incident on an edge */ -void BM_edge_normals_update(BMesh *bm, BMEdge *e) +void BM_edge_normals_update(BMEdge *e) { BMIter iter; BMFace *f; - f = BM_iter_new(&iter, bm, BM_FACES_OF_EDGE, e); - for (; f; f = BM_iter_step(&iter)) { - BM_face_normal_update(bm, f); + BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) { + BM_face_normal_update(f); } - BM_vert_normal_update(bm, e->v1); - BM_vert_normal_update(bm, e->v2); + BM_vert_normal_update(e->v1); + BM_vert_normal_update(e->v2); } /** * update a vert normal (but not the faces incident on it) */ -void BM_vert_normal_update(BMesh *bm, BMVert *v) +void BM_vert_normal_update(BMVert *v) { /* TODO, we can normalize each edge only once, then compare with previous edge */ @@ -379,16 +378,16 @@ void BM_vert_normal_update(BMesh *bm, BMVert *v) } } -void BM_vert_normal_update_all(BMesh *bm, BMVert *v) +void BM_vert_normal_update_all(BMVert *v) { BMIter iter; BMFace *f; BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) { - BM_face_normal_update(bm, f); + BM_face_normal_update(f); } - BM_vert_normal_update(bm, v); + BM_vert_normal_update(v); } /** @@ -401,7 +400,7 @@ void BM_vert_normal_update_all(BMesh *bm, BMVert *v) * is passed in as well. */ -void BM_face_normal_update(BMesh *UNUSED(bm), BMFace *f) +void BM_face_normal_update(BMFace *f) { BMLoop *l; @@ -564,7 +563,7 @@ static int linecrossesf(const float v1[2], const float v2[2], const float v3[2], * instead of projecting co directly into f's orientation space, * so there might be accuracy issues. */ -int BM_face_point_inside_test(BMesh *bm, BMFace *f, const float co[3]) +int BM_face_point_inside_test(BMFace *f, const float co[3]) { int ax, ay; float co2[2], cent[2] = {0.0f, 0.0f}, out[2] = {FLT_MAX * 0.5f, FLT_MAX * 0.5f}; @@ -574,7 +573,7 @@ int BM_face_point_inside_test(BMesh *bm, BMFace *f, const float co[3]) float onepluseps = 1.0f + (float)FLT_EPSILON * 150.0f; if (dot_v3v3(f->no, f->no) <= FLT_EPSILON * 10) - BM_face_normal_update(bm, f); + BM_face_normal_update(f); /* find best projection of face XY, XZ or YZ: barycentric weights of * the 2d projected coords are the same and faster to compute @@ -659,7 +658,7 @@ static int goodline(float const (*projectverts)[3], BMFace *f, * * \param use_beauty Currently only applies to quads, can be extended later on. */ -static BMLoop *find_ear(BMesh *UNUSED(bm), BMFace *f, float (*verts)[3], const int nvert, const int use_beauty) +static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int nvert, const int use_beauty) { BMLoop *bestear = NULL; @@ -779,7 +778,7 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], done = 0; while (!done && f->len > 3) { done = 1; - l_iter = find_ear(bm, f, projectverts, nvert, use_beauty); + l_iter = find_ear(f, projectverts, nvert, use_beauty); if (l_iter) { done = 0; /* v = l->v; */ /* UNUSED */ diff --git a/source/blender/bmesh/intern/bmesh_polygon.h b/source/blender/bmesh/intern/bmesh_polygon.h index 71387f18ce2..117a47d34f2 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.h +++ b/source/blender/bmesh/intern/bmesh_polygon.h @@ -27,22 +27,22 @@ * \ingroup bmesh */ -float BM_face_area_calc(BMesh *bm, BMFace *f); -float BM_face_perimeter_calc(BMesh *bm, BMFace *f); -void BM_face_center_bounds_calc(BMesh *bm, BMFace *f, float center[3]); -void BM_face_center_mean_calc(BMesh *bm, BMFace *f, float center[3]); +float BM_face_area_calc(BMFace *f); +float BM_face_perimeter_calc(BMFace *f); +void BM_face_center_bounds_calc(BMFace *f, float center[3]); +void BM_face_center_mean_calc(BMFace *f, float center[3]); -void BM_face_normal_update(BMesh *bm, BMFace *f); +void BM_face_normal_update(BMFace *f); void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3], float const (*vertexCos)[3]); -void BM_edge_normals_update(BMesh *bm, BMEdge *e); +void BM_edge_normals_update(BMEdge *e); -void BM_vert_normal_update(BMesh *bm, BMVert *v); -void BM_vert_normal_update_all(BMesh *bm, BMVert *v); +void BM_vert_normal_update(BMVert *v); +void BM_vert_normal_update_all(BMVert *v); void BM_face_normal_flip(BMesh *bm, BMFace *f); -int BM_face_point_inside_test(BMesh *bm, BMFace *f, const float co[3]); +int BM_face_point_inside_test(BMFace *f, const float co[3]); void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], const short newedge_oflag, const short newface_oflag, BMFace **newfaces, diff --git a/source/blender/bmesh/intern/bmesh_private.h b/source/blender/bmesh/intern/bmesh_private.h index 791c8d68880..f963425e1bd 100644 --- a/source/blender/bmesh/intern/bmesh_private.h +++ b/source/blender/bmesh/intern/bmesh_private.h @@ -37,13 +37,13 @@ */ /* returns positive nonzero on error */ -int bmesh_elem_check(BMesh *bm, void *element, const char htype); +int bmesh_elem_check(void *element, const char htype); -#define BM_CHECK_ELEMENT(bm, el) \ - if (bmesh_elem_check(bm, el, ((BMHeader *)el)->htype)) { \ +#define BM_CHECK_ELEMENT(el) \ + if (bmesh_elem_check(el, ((BMHeader *)el)->htype)) { \ printf("check_element failure, with code %i on line %i in file\n" \ " \"%s\"\n\n", \ - bmesh_elem_check(bm, el, ((BMHeader *)el)->htype), \ + bmesh_elem_check(el, ((BMHeader *)el)->htype), \ __LINE__, __FILE__); \ } diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index 1238038c67c..af614f78aff 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -962,7 +962,7 @@ int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface) * * \a earr and \a varr can be in any order, however they _must_ form a closed loop. */ -int BM_face_exists_multi(BMesh *bm, BMVert **varr, BMEdge **earr, int len) +int BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len) { BMFace *f; BMEdge *e; @@ -1068,7 +1068,7 @@ int BM_face_exists_multi(BMesh *bm, BMVert **varr, BMEdge **earr, int len) } /* same as 'BM_face_exists_multi' but built vert array from edges */ -int BM_face_exists_multi_edge(BMesh *bm, BMEdge **earr, int len) +int BM_face_exists_multi_edge(BMEdge **earr, int len) { BMVert **varr; BLI_array_fixedstack_declare(varr, BM_NGON_STACK_SIZE, len, __func__); @@ -1091,7 +1091,7 @@ int BM_face_exists_multi_edge(BMesh *bm, BMEdge **earr, int len) return FALSE; } - ok = BM_face_exists_multi(bm, varr, earr, len); + ok = BM_face_exists_multi(varr, earr, len); BLI_array_fixedstack_free(varr); diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h index 280fe843b1c..73d724c7bdd 100644 --- a/source/blender/bmesh/intern/bmesh_queries.h +++ b/source/blender/bmesh/intern/bmesh_queries.h @@ -72,8 +72,8 @@ int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_exi int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface); -int BM_face_exists_multi(BMesh *bm, BMVert **varr, BMEdge **earr, int len); -int BM_face_exists_multi_edge(BMesh *bm, BMEdge **earr, int len); +int BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len); +int BM_face_exists_multi_edge(BMEdge **earr, int len); int BM_face_share_edge_count(BMFace *f1, BMFace *f2); int BM_edge_share_face_count(BMEdge *e1, BMEdge *e2); diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c index 99c70cc7c13..46dd7606940 100644 --- a/source/blender/bmesh/operators/bmo_bevel.c +++ b/source/blender/bmesh/operators/bmo_bevel.c @@ -53,7 +53,7 @@ typedef struct EdgeTag { BMVert *newv1, *newv2; } EdgeTag; -static void calc_corner_co(BMesh *bm, BMLoop *l, const float fac, float r_co[3], +static void calc_corner_co(BMLoop *l, const float fac, float r_co[3], const short do_dist, const short do_even) { float no[3], l_vec_prev[3], l_vec_next[3], l_co_prev[3], l_co[3], l_co_next[3], co_ofs[3]; @@ -370,7 +370,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) if (BMO_elem_flag_test(bm, l->e, BEVEL_FLAG)) { if (BMO_elem_flag_test(bm, l->prev->e, BEVEL_FLAG)) { tag = tags + BM_elem_index_get(l); - calc_corner_co(bm, l, fac, co, do_dist, do_even); + calc_corner_co(l, fac, co, do_dist, do_even); tag->newv = BM_vert_create(bm, co, l->v); } else { diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index 9e09f71d123..d02bb14bebf 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -1043,7 +1043,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op) if ((use_fill_check == FALSE) || /* fairly expensive check - see if there are already faces filling this area */ - (BM_face_exists_multi_edge(bm, edges, i) == FALSE)) + (BM_face_exists_multi_edge(edges, i) == FALSE)) { f = BM_face_create_ngon(bm, v1, v2, edges, i, TRUE); if (f && !BMO_elem_flag_test(bm, f, ELE_ORIG)) { diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index 3e3dae11ab9..f0e8ad81d07 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -554,7 +554,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op) /* there may be some errors, we don't mind, just move on */ if (nf) { - BM_face_normal_update(bm, nf); + BM_face_normal_update(nf); } else { BMO_error_clear(bm); @@ -604,7 +604,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op) BMEdge *ne = BM_vert_collapse_edge(bm, v->e, v, TRUE); /* join edges */ if (ne && ne->l) { - BM_edge_normals_update(bm, ne); + BM_edge_normals_update(ne); } } } diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index 4124eafda74..73997c774af 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -537,7 +537,7 @@ static void calc_solidify_normals(BMesh *bm) if (BMO_elem_flag_test(bm, v, VERT_NONMAN)) { /* use standard normals for vertices connected to non-manifold edges */ - BM_vert_normal_update(bm, v); + BM_vert_normal_update(v); } else if (normalize_v3(v->no) == 0.0f && !BM_elem_flag_test(v, BM_ELEM_TAG)) { /* exceptional case, totally flat. use the normal diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index c8c36f94c0c..582039fc1a2 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -43,7 +43,7 @@ #define T2QJOIN 4 /* assumes edges are validated before reaching this poin */ -static float measure_facepair(BMesh *UNUSED(bm), BMVert *v1, BMVert *v2, +static float measure_facepair(BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4, float limit) { /* gives a 'weight' to a pair of triangles that join an edge to decide how good a join they would make */ @@ -291,7 +291,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) if (domat && f1->mat_nr != f2->mat_nr) continue; - measure = measure_facepair(bm, v1, v2, v3, v4, limit); + measure = measure_facepair(v1, v2, v3, v4, limit); if (measure < limit) { BLI_array_growone(jedges); diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index b5ca85ebe81..b3d4584107a 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -105,7 +105,7 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar float *co = NULL; int i, totlayer = CustomData_number_of_layers(&bm->vdata, CD_SHAPEKEY); - BM_vert_normal_update_all(bm, v); + BM_vert_normal_update_all(v); co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, CD_SHAPEKEY, params->origkey); copy_v3_v3(co, v->co); @@ -257,9 +257,9 @@ static void bm_subdivide_multicut(BMesh *bm, BMEdge *edge, const SubDParams *par BMO_elem_flag_enable(bm, eed, ELE_SPLIT); BMO_elem_flag_enable(bm, newe, SUBD_SPLIT); - BM_CHECK_ELEMENT(bm, v); - if (v->e) BM_CHECK_ELEMENT(bm, v->e); - if (v->e && v->e->l) BM_CHECK_ELEMENT(bm, v->e->l->f); + BM_CHECK_ELEMENT(v); + if (v->e) BM_CHECK_ELEMENT(v->e); + if (v->e && v->e->l) BM_CHECK_ELEMENT(v->e->l->f); } alter_co(bm, v1, &temp, params, 0, &ov1, &ov2); @@ -673,7 +673,7 @@ typedef struct SubDFaceData { BMFace *face; } SubDFaceData; -void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) +void bmo_esubd_exec(BMesh *bm, BMOperator *op) { BMOpSlot *einput; SubDPattern *pat; @@ -693,7 +693,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) int beauty, cornertype, singleedge, gridfill; int skey, seed, i, j, matched, a, b, numcuts, totesel; - BMO_slot_buffer_flag_enable(bmesh, op, "edges", BM_EDGE, SUBD_SPLIT); + BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, SUBD_SPLIT); numcuts = BMO_slot_int_get(op, "numcuts"); seed = BMO_slot_int_get(op, "seed"); @@ -739,16 +739,16 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) } /* add a temporary shapekey layer to store displacements on current geometry */ - BM_data_layer_add(bmesh, &bmesh->vdata, CD_SHAPEKEY); - skey = CustomData_number_of_layers(&bmesh->vdata, CD_SHAPEKEY) - 1; + BM_data_layer_add(bm, &bm->vdata, CD_SHAPEKEY); + skey = CustomData_number_of_layers(&bm->vdata, CD_SHAPEKEY) - 1; - BM_ITER_MESH (v, &viter, bmesh, BM_VERTS_OF_MESH) { - float *co = CustomData_bmesh_get_n(&bmesh->vdata, v->head.data, CD_SHAPEKEY, skey); + BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { + float *co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, CD_SHAPEKEY, skey); copy_v3_v3(co, v->co); } /* first go through and tag edges */ - BMO_slot_buffer_from_enabled_flag(bmesh, op, "edges", BM_EDGE, SUBD_SPLIT); + BMO_slot_buffer_from_enabled_flag(bm, op, "edges", BM_EDGE, SUBD_SPLIT); params.numcuts = numcuts; params.op = op; @@ -761,14 +761,14 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) params.off[1] = (float)BLI_drand() * 200.0f; params.off[2] = (float)BLI_drand() * 200.0f; - BMO_slot_map_to_flag(bmesh, op, "custompatterns", + BMO_slot_map_to_flag(bm, op, "custompatterns", BM_FACE, FACE_CUSTOMFILL); - BMO_slot_map_to_flag(bmesh, op, "edgepercents", + BMO_slot_map_to_flag(bm, op, "edgepercents", BM_EDGE, EDGE_PERCENT); - BM_ITER_MESH (face, &fiter, bmesh, BM_FACES_OF_MESH) { + BM_ITER_MESH (face, &fiter, bm, BM_FACES_OF_MESH) { BMEdge *e1 = NULL, *e2 = NULL; float vec1[3], vec2[3]; @@ -787,7 +787,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) edges[i] = nl->e; verts[i] = nl->v; - if (BMO_elem_flag_test(bmesh, edges[i], SUBD_SPLIT)) { + if (BMO_elem_flag_test(bm, edges[i], SUBD_SPLIT)) { if (!e1) e1 = edges[i]; else e2 = edges[i]; @@ -811,14 +811,14 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) } } - if (BMO_elem_flag_test(bmesh, face, FACE_CUSTOMFILL)) { - pat = BMO_slot_map_data_get(bmesh, op, + if (BMO_elem_flag_test(bm, face, FACE_CUSTOMFILL)) { + pat = BMO_slot_map_data_get(bm, op, "custompatterns", face); for (i = 0; i < pat->len; i++) { matched = 1; for (j = 0; j < pat->len; j++) { a = (j + i) % pat->len; - if ((!!BMO_elem_flag_test(bmesh, edges[a], SUBD_SPLIT)) != (!!pat->seledges[j])) { + if ((!!BMO_elem_flag_test(bm, edges[a], SUBD_SPLIT)) != (!!pat->seledges[j])) { matched = 0; break; } @@ -830,7 +830,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) facedata[b].start = verts[i]; facedata[b].face = face; facedata[b].totedgesel = totesel; - BMO_elem_flag_enable(bmesh, face, SUBD_SPLIT); + BMO_elem_flag_enable(bm, face, SUBD_SPLIT); break; } } @@ -850,7 +850,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) matched = 1; for (b = 0; b < pat->len; b++) { j = (b + a) % pat->len; - if ((!!BMO_elem_flag_test(bmesh, edges[j], SUBD_SPLIT)) != (!!pat->seledges[b])) { + if ((!!BMO_elem_flag_test(bm, edges[j], SUBD_SPLIT)) != (!!pat->seledges[b])) { matched = 0; break; } @@ -863,7 +863,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) BLI_array_growone(facedata); j = BLI_array_count(facedata) - 1; - BMO_elem_flag_enable(bmesh, face, SUBD_SPLIT); + BMO_elem_flag_enable(bm, face, SUBD_SPLIT); facedata[j].pat = pat; facedata[j].start = verts[a]; @@ -879,7 +879,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) BLI_array_growone(facedata); j = BLI_array_count(facedata) - 1; - BMO_elem_flag_enable(bmesh, face, SUBD_SPLIT); + BMO_elem_flag_enable(bm, face, SUBD_SPLIT); facedata[j].totedgesel = totesel; facedata[j].face = face; } @@ -890,12 +890,12 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) /* go through and split edges */ for (i = 0; i < einput->len; i++) { edge = ((BMEdge **)einput->data.p)[i]; - bm_subdivide_multicut(bmesh, edge, ¶ms, edge->v1, edge->v2); + bm_subdivide_multicut(bm, edge, ¶ms, edge->v1, edge->v2); } /* copy original-geometry displacements to current coordinates */ - BM_ITER_MESH (v, &viter, bmesh, BM_VERTS_OF_MESH) { - float *co = CustomData_bmesh_get_n(&bmesh->vdata, v->head.data, CD_SHAPEKEY, skey); + BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { + float *co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, CD_SHAPEKEY, skey); copy_v3_v3(v->co, co); } @@ -925,22 +925,22 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) /* find the boundary of one of the split edges */ for (a = 1; a < vlen; a++) { - if (!BMO_elem_flag_test(bmesh, loops[a - 1]->v, ELE_INNER) && - BMO_elem_flag_test(bmesh, loops[a]->v, ELE_INNER)) + if (!BMO_elem_flag_test(bm, loops[a - 1]->v, ELE_INNER) && + BMO_elem_flag_test(bm, loops[a]->v, ELE_INNER)) { break; } } - if (BMO_elem_flag_test(bmesh, loops[(a + numcuts + 1) % vlen]->v, ELE_INNER)) { + if (BMO_elem_flag_test(bm, loops[(a + numcuts + 1) % vlen]->v, ELE_INNER)) { b = (a + numcuts + 1) % vlen; } else { /* find the boundary of the other edge. */ for (j = 0; j < vlen; j++) { b = (j + a + numcuts + 1) % vlen; - if (!BMO_elem_flag_test(bmesh, loops[b == 0 ? vlen - 1 : b - 1]->v, ELE_INNER) && - BMO_elem_flag_test(bmesh, loops[b]->v, ELE_INNER)) + if (!BMO_elem_flag_test(bm, loops[b == 0 ? vlen - 1 : b - 1]->v, ELE_INNER) && + BMO_elem_flag_test(bm, loops[b]->v, ELE_INNER)) { break; } @@ -965,7 +965,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) for (j = 0; j < BLI_array_count(splits) / 2; j++) { if (splits[j * 2]) { /* BMFace *nf = */ /* UNUSED */ - BM_face_split(bmesh, face, splits[j * 2]->v, splits[j * 2 + 1]->v, &nl, NULL, FALSE); + BM_face_split(bm, face, splits[j * 2]->v, splits[j * 2 + 1]->v, &nl, NULL, FALSE); } } @@ -976,7 +976,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) } j = a = 0; - for (nl = BM_iter_new(&liter, bmesh, BM_LOOPS_OF_FACE, face); + for (nl = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, face); nl; nl = BM_iter_step(&liter)) { @@ -992,23 +992,23 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) } j = 0; - for (nl = BM_iter_new(&liter, bmesh, BM_LOOPS_OF_FACE, face); nl; nl = BM_iter_step(&liter)) { + for (nl = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, face); nl; nl = BM_iter_step(&liter)) { b = (j - a + face->len) % face->len; verts[b] = nl->v; j += 1; } - BM_CHECK_ELEMENT(bmesh, face); - pat->connectexec(bmesh, face, verts, ¶ms); + BM_CHECK_ELEMENT(face); + pat->connectexec(bm, face, verts, ¶ms); } /* copy original-geometry displacements to current coordinates */ - BM_ITER_MESH (v, &viter, bmesh, BM_VERTS_OF_MESH) { - float *co = CustomData_bmesh_get_n(&bmesh->vdata, v->head.data, CD_SHAPEKEY, skey); + BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { + float *co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, CD_SHAPEKEY, skey); copy_v3_v3(v->co, co); } - BM_data_layer_free_n(bmesh, &bmesh->vdata, CD_SHAPEKEY, skey); + BM_data_layer_free_n(bm, &bm->vdata, CD_SHAPEKEY, skey); if (facedata) BLI_array_free(facedata); if (edges) BLI_array_free(edges); @@ -1016,10 +1016,10 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) BLI_array_free(splits); BLI_array_free(loops); - BMO_slot_buffer_from_enabled_flag(bmesh, op, "outinner", BM_ALL, ELE_INNER); - BMO_slot_buffer_from_enabled_flag(bmesh, op, "outsplit", BM_ALL, ELE_SPLIT); + BMO_slot_buffer_from_enabled_flag(bm, op, "outinner", BM_ALL, ELE_INNER); + BMO_slot_buffer_from_enabled_flag(bm, op, "outsplit", BM_ALL, ELE_SPLIT); - BMO_slot_buffer_from_enabled_flag(bmesh, op, "geomout", BM_ALL, ELE_INNER|ELE_SPLIT|SUBD_SPLIT); + BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, ELE_INNER|ELE_SPLIT|SUBD_SPLIT); } /* editmesh-emulating function */ diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c index 30bb1d2913d..87aba98836d 100644 --- a/source/blender/bmesh/operators/bmo_utils.c +++ b/source/blender/bmesh/operators/bmo_utils.c @@ -135,7 +135,7 @@ void bmo_edgerotate_exec(BMesh *bm, BMOperator *op) /** * this ends up being called twice, could add option to not to call check in * #BM_edge_rotate to get some extra speed */ - if (BM_edge_rotate_check(bm, e)) { + if (BM_edge_rotate_check(e)) { BMFace *fa, *fb; if (BM_edge_face_pair(e, &fa, &fb)) { @@ -322,7 +322,7 @@ void bmo_righthandfaces_exec(BMesh *bm, BMOperator *op) if (!startf) startf = f; - BM_face_center_bounds_calc(bm, f, cent); + BM_face_center_bounds_calc(f, cent); if ((maxx_test = dot_v3v3(cent, cent)) > maxx) { maxx = maxx_test; @@ -332,7 +332,7 @@ void bmo_righthandfaces_exec(BMesh *bm, BMOperator *op) if (!startf) return; - BM_face_center_bounds_calc(bm, startf, cent); + BM_face_center_bounds_calc(startf, cent); /* make sure the starting face has the correct winding */ if (dot_v3v3(cent, startf->no) < 0.0f) { @@ -465,7 +465,7 @@ void bmo_vertexsmooth_exec(BMesh *bm, BMOperator *op) * * NOTE: This should probably go to bmesh_polygon.c */ -static float ngon_fake_area(BMesh *bm, BMFace *f) +static float ngon_fake_area(BMFace *f) { BMIter liter; BMLoop *l; @@ -473,7 +473,7 @@ static float ngon_fake_area(BMesh *bm, BMFace *f) float v[3], sv[3], c[3]; float area = 0.0f; - BM_face_center_mean_calc(bm, f, c); + BM_face_center_mean_calc(f, c); BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { if (num_verts == 0) { @@ -563,12 +563,12 @@ void bmo_similarfaces_exec(BMesh *bm, BMOperator *op) switch (type) { case SIMFACE_PERIMETER: /* set the perimeter */ - f_ext[i].perim = BM_face_perimeter_calc(bm, f_ext[i].f); + f_ext[i].perim = BM_face_perimeter_calc(f_ext[i].f); break; case SIMFACE_COPLANAR: /* compute the center of the polygon */ - BM_face_center_mean_calc(bm, f_ext[i].f, f_ext[i].c); + BM_face_center_mean_calc(f_ext[i].f, f_ext[i].c); /* normalize the polygon normal */ copy_v3_v3(t_no, f_ext[i].f->no); @@ -579,7 +579,7 @@ void bmo_similarfaces_exec(BMesh *bm, BMOperator *op) break; case SIMFACE_AREA: - f_ext[i].area = ngon_fake_area(bm, f_ext[i].f); + f_ext[i].area = ngon_fake_area(f_ext[i].f); break; case SIMFACE_IMAGE: @@ -664,27 +664,6 @@ void bmo_similarfaces_exec(BMesh *bm, BMOperator *op) #define EDGE_MARK 1 /* - * compute the angle of an edge (i.e. the angle between two faces) - */ -static float edge_angle(BMesh *bm, BMEdge *e) -{ - BMIter fiter; - BMFace *f, *f_prev = NULL; - - /* first edge faces, don't account for 3+ */ - - BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) { - if (f_prev == NULL) { - f_prev = f; - } - else { - return angle_v3v3(f_prev->no, f->no); - } - } - - return 0.0f; -} -/* * extra edge information */ typedef struct SimSel_EdgeExt { @@ -761,7 +740,7 @@ void bmo_similaredges_exec(BMesh *bm, BMOperator *op) case SIMEDGE_FACE_ANGLE: e_ext[i].faces = BM_edge_face_count(e_ext[i].e); if (e_ext[i].faces == 2) - e_ext[i].angle = edge_angle(bm, e_ext[i].e); + e_ext[i].angle = BM_edge_face_angle(e_ext[i].e); break; } } diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index 02ae75c5d9a..0d177f5ab18 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -740,7 +740,7 @@ static BMFace *BME_bevel_poly(BMesh *bm, BMFace *f, float value, int options, BM return NULL; } -static float BME_bevel_get_angle(BMesh *UNUSED(bm), BMEdge *e, BMVert *v) +static float BME_bevel_get_angle(BMEdge *e, BMVert *v) { BMVert *v1, *v2; BMLoop *l1, *l2; @@ -779,7 +779,7 @@ static float BME_bevel_get_angle(BMesh *UNUSED(bm), BMEdge *e, BMVert *v) return dot_v3v3(vec3, vec4); } -static float UNUSED_FUNCTION(BME_bevel_get_angle_vert)(BMesh *bm, BMVert *v) +static float UNUSED_FUNCTION(BME_bevel_get_angle_vert)(BMVert *v) { BMIter iter; BMLoop *l; @@ -902,14 +902,14 @@ static void bevel_init_edges(BMesh *bm, int options, float angle, BME_TransData_ } else if (options & BME_BEVEL_ANGLE) { /* dont set weight_v1/weight_v2 here, add direct */ - if (!BMO_elem_flag_test(bm, e->v1, BME_BEVEL_NONMAN) && BME_bevel_get_angle(bm, e, e->v1) < threshold) { + if (!BMO_elem_flag_test(bm, e->v1, BME_BEVEL_NONMAN) && BME_bevel_get_angle(e, e->v1) < threshold) { BMO_elem_flag_enable(bm, e, BME_BEVEL_BEVEL); BME_bevel_add_vweight(td, bm, e->v1, 1.0, 1.0, options); } else { BME_bevel_add_vweight(td, bm, e->v1, 0.0, 1.0, options); } - if (!BMO_elem_flag_test(bm, e->v2, BME_BEVEL_NONMAN) && BME_bevel_get_angle(bm, e, e->v2) < threshold) { + if (!BMO_elem_flag_test(bm, e->v2, BME_BEVEL_NONMAN) && BME_bevel_get_angle(e, e->v2) < threshold) { BMO_elem_flag_enable(bm, e, BME_BEVEL_BEVEL); BME_bevel_add_vweight(td, bm, e->v2, 1.0, 1.0, options); } diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 0ab9c5dd977..16b3e0654bd 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -136,7 +136,7 @@ void EDBM_selectmode_convert(struct BMEditMesh *em, short oldmode, short selectm void undo_push_mesh(struct bContext *C, const char *name); int EDBM_editselection_active_get(struct BMEditMesh *em, struct BMEditSelection *ese); -void EDBM_editselection_center(struct BMEditMesh *em, float *center, struct BMEditSelection *ese); +void EDBM_editselection_center(float *center, struct BMEditSelection *ese); void EDBM_editselection_plane(struct BMEditMesh *em, float *plane, struct BMEditSelection *ese); void EDBM_editselection_normal(float *normal, struct BMEditSelection *ese); int EDBM_vert_color_check(struct BMEditMesh *em); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 2a8de974b82..1f272e83023 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -556,7 +556,6 @@ static void knife_get_vert_faces(knifetool_opdata *kcd, KnifeVert *kfv, BMFace * knife_append_list(kcd, lst, facef); } else if (kfv->v) { - BMesh *bm = kcd->em->bm; BM_ITER_ELEM (f, &bmiter, kfv->v, BM_FACES_OF_VERT) { knife_append_list(kcd, lst, f); } @@ -569,7 +568,6 @@ static void knife_get_edge_faces(knifetool_opdata *kcd, KnifeEdge *kfe, ListBase BMFace *f; if (kfe->e) { - BMesh *bm = kcd->em->bm; BM_ITER_ELEM (f, &bmiter, kfe->e, BM_FACES_OF_EDGE) { knife_append_list(kcd, lst, f); } @@ -1972,7 +1970,7 @@ static void knifenet_fill_faces(knifetool_opdata *kcd) BMO_elem_flag_disable(bm, f2, DEL); BM_elem_index_set(f2, i); /* set_dirty! *//* note, not 100% sure this is dirty? need to check */ - BM_face_normal_update(bm, f2); + BM_face_normal_update(f2); if (dot_v3v3(f->no, f2->no) < 0.0f) { BM_face_normal_flip(bm, f2); } @@ -2395,9 +2393,9 @@ static int find_hole_chains(knifetool_opdata *kcd, ListBase *hole, BMFace *f, Li } } -static int knife_edge_in_face(knifetool_opdata *kcd, KnifeEdge *kfe, BMFace *f) +static int knife_edge_in_face(knifetool_opdata *UNUSED(kcd), KnifeEdge *kfe, BMFace *f) { - BMesh *bm = kcd->em->bm; + /* BMesh *bm = kcd->em->bm; */ /* UNUSED */ BMVert *v1, *v2; BMLoop *l1, *l2, *l; float mid[3]; @@ -2421,8 +2419,8 @@ static int knife_edge_in_face(knifetool_opdata *kcd, KnifeEdge *kfe, BMFace *f) } /* BM_face_point_inside_test uses best-axis projection so this isn't most accurate test... */ - v1inside = l1 ? 0 : BM_face_point_inside_test(bm, f, kfe->v1->co); - v2inside = l2 ? 0 : BM_face_point_inside_test(bm, f, kfe->v2->co); + v1inside = l1 ? 0 : BM_face_point_inside_test(f, kfe->v1->co); + v2inside = l2 ? 0 : BM_face_point_inside_test(f, kfe->v2->co); if ((l1 && v2inside) || (l2 && v1inside) || (v1inside && v2inside)) return TRUE; if (l1 && l2) { @@ -2431,7 +2429,7 @@ static int knife_edge_in_face(knifetool_opdata *kcd, KnifeEdge *kfe, BMFace *f) * but it is expensive and maybe a bit buggy, so use a simple * "is the midpoint in the face" test */ mid_v3_v3v3(mid, kfe->v1->co, kfe->v2->co); - return BM_face_point_inside_test(bm, f, mid); + return BM_face_point_inside_test(f, mid); } return FALSE; } diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 27e3e643be1..d05bf10e206 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -134,7 +134,7 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) /* given two opposite edges in a face, finds the ordering of their vertices so * that cut preview lines won't cross each other */ -static void edgering_find_order(BMEditMesh *em, BMEdge *lasteed, BMEdge *eed, +static void edgering_find_order(BMEdge *lasteed, BMEdge *eed, BMVert *lastv1, BMVert *v[2][2]) { BMIter liter; @@ -237,7 +237,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select) lastv1 = lasteed->v1; } - edgering_find_order(em, lasteed, eed, lastv1, v); + edgering_find_order(lasteed, eed, lastv1, v); lastv1 = v[0][0]; BLI_array_growitems(edges, previewlines); @@ -263,7 +263,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select) v[1][0] = v[0][0]; v[1][1] = v[0][1]; - edgering_find_order(em, lasteed, startedge, lastv1, v); + edgering_find_order(lasteed, startedge, lastv1, v); BLI_array_growitems(edges, previewlines); diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index 9ae816903f2..43e9b885037 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -154,7 +154,7 @@ static float edbm_rip_edge_side_measure(BMEdge *e, #define INVALID_UID INT_MIN /* mark, assign uid and step */ -static BMEdge *edbm_ripsel_edge_mark_step(BMesh *bm, BMVert *v, const int uid) +static BMEdge *edbm_ripsel_edge_mark_step(BMVert *v, const int uid) { BMIter iter; BMEdge *e; @@ -230,7 +230,7 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm) v_step = e_first->v1; uid_start = uid; - while ((e = edbm_ripsel_edge_mark_step(bm, v_step, uid))) { + while ((e = edbm_ripsel_edge_mark_step(v_step, uid))) { BM_elem_flag_disable(e, BM_ELEM_SMOOTH); v_step = BM_edge_other_vert((e_step = e), v_step); uid++; /* only different line */ @@ -247,7 +247,7 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm) /* initialize */ v_step = e_first->v1; - while ((e = edbm_ripsel_edge_mark_step(bm, v_step, uid))) { + while ((e = edbm_ripsel_edge_mark_step(v_step, uid))) { BM_elem_flag_disable(e, BM_ELEM_SMOOTH); v_step = BM_edge_other_vert((e_step = e), v_step); uid--; /* only different line */ @@ -283,7 +283,7 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm) /* - De-Select the worst rip-edge side -------------------------------- */ -static BMEdge *edbm_ripsel_edge_uid_step(BMesh *bm, BMEdge *e_orig, BMVert **v_prev) +static BMEdge *edbm_ripsel_edge_uid_step(BMEdge *e_orig, BMVert **v_prev) { BMIter eiter; BMEdge *e; @@ -299,11 +299,11 @@ static BMEdge *edbm_ripsel_edge_uid_step(BMesh *bm, BMEdge *e_orig, BMVert **v_p return NULL; } -static BMVert *edbm_ripsel_edloop_pair_start_vert(BMesh *bm, BMEdge *e) +static BMVert *edbm_ripsel_edloop_pair_start_vert(BMEdge *e) { /* try step in a direction, if it fails we know do go the other way */ BMVert *v_test = e->v1; - return (edbm_ripsel_edge_uid_step(bm, e, &v_test)) ? e->v1 : e->v2; + return (edbm_ripsel_edge_uid_step(e, &v_test)) ? e->v1 : e->v2; } static void edbm_ripsel_deselect_helper(BMesh *bm, EdgeLoopPair *eloop_pairs, @@ -319,19 +319,19 @@ static void edbm_ripsel_deselect_helper(BMesh *bm, EdgeLoopPair *eloop_pairs, float score_b = 0.0f; e = lp->l_a->e; - v_prev = edbm_ripsel_edloop_pair_start_vert(bm, e); - for (; e; e = edbm_ripsel_edge_uid_step(bm, e, &v_prev)) { + v_prev = edbm_ripsel_edloop_pair_start_vert(e); + for (; e; e = edbm_ripsel_edge_uid_step(e, &v_prev)) { score_a += edbm_rip_edge_side_measure(e, ar, projectMat, fmval); } e = lp->l_b->e; - v_prev = edbm_ripsel_edloop_pair_start_vert(bm, e); - for (; e; e = edbm_ripsel_edge_uid_step(bm, e, &v_prev)) { + v_prev = edbm_ripsel_edloop_pair_start_vert(e); + for (; e; e = edbm_ripsel_edge_uid_step(e, &v_prev)) { score_b += edbm_rip_edge_side_measure(e, ar, projectMat, fmval); } e = (score_a > score_b) ? lp->l_a->e : lp->l_b->e; - v_prev = edbm_ripsel_edloop_pair_start_vert(bm, e); - for (; e; e = edbm_ripsel_edge_uid_step(bm, e, &v_prev)) { + v_prev = edbm_ripsel_edloop_pair_start_vert(e); + for (; e; e = edbm_ripsel_edge_uid_step(e, &v_prev)) { BM_elem_select_set(bm, e, FALSE); } } diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 52547c120c0..d6aa3f48b85 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -2578,7 +2578,7 @@ void MESH_OT_region_to_loop(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -static int loop_find_region(BMEditMesh *em, BMLoop *l, int flag, +static int loop_find_region(BMLoop *l, int flag, SmallHash *fhash, BMFace ***region_out) { BLI_array_declare(region); @@ -2676,7 +2676,7 @@ static int loop_find_regions(BMEditMesh *em, int selbigger) if (BLI_smallhash_haskey(&visithash, (uintptr_t)l->f)) continue; - c = loop_find_region(em, l, BM_ELEM_SELECT, &visithash, ®ion_out); + c = loop_find_region(l, BM_ELEM_SELECT, &visithash, ®ion_out); if (!region || (selbigger ? c >= tot : c < tot)) { /* this region is the best seen so far */ diff --git a/source/blender/editors/mesh/editmesh_slide.c b/source/blender/editors/mesh/editmesh_slide.c index dd68cd30cf5..6534210601c 100644 --- a/source/blender/editors/mesh/editmesh_slide.c +++ b/source/blender/editors/mesh/editmesh_slide.c @@ -486,8 +486,6 @@ static int vtx_slide_set_frame(VertexSlideOp *vso) BLI_array_declare(vtx_frame); BLI_array_declare(edge_frame); BMIter iter; - BMEditMesh *em = BMEdit_FromObject(vso->obj); - BMesh *bm = em->bm; BMVert *sel_vtx = vso->start_vtx; int idx = 0; diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index b006f77200e..468f5699bce 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -1270,9 +1270,9 @@ void EDBM_update_generic(bContext *C, BMEditMesh *em, const short do_tessface) * need (at the moment) to wrap them, but on the other hand having these * wrapped avoids a confusing mess of mixing BM_ and EDBM_ namespaces. */ -void EDBM_editselection_center(BMEditMesh *em, float *center, BMEditSelection *ese) +void EDBM_editselection_center(float *center, BMEditSelection *ese) { - BM_editselection_center(em->bm, center, ese); + BM_editselection_center(center, ese); } void EDBM_editselection_normal(float *normal, BMEditSelection *ese) diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 7f2e42f18e9..7a1d9b8604f 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2910,7 +2910,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS BMIter liter; BMLoop *loop; - BM_face_center_bounds_calc(em->bm, efa, vmid); + BM_face_center_bounds_calc(efa, vmid); for (loop = BM_iter_new(&liter, em->bm, BM_LOOPS_OF_FACE, efa); loop; loop = BM_iter_step(&liter)) @@ -2984,7 +2984,7 @@ static void draw_em_indices(BMEditMesh *em) UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col); BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(f, BM_ELEM_SELECT)) { - BM_face_center_mean_calc(bm, f, pos); + BM_face_center_mean_calc(f, pos); sprintf(numstr, "%d", i); view3d_cached_text_draw_add(pos, numstr, 0, txt_flag, col); } diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 6dff792352b..f19c8891f96 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -994,7 +994,7 @@ static int snap_curs_to_active(bContext *C, wmOperator *UNUSED(op)) BMEditSelection ese; if (EDBM_editselection_active_get(me->edit_btmesh, &ese)) { - EDBM_editselection_center(me->edit_btmesh, curs, &ese); + EDBM_editselection_center(curs, &ese); } mul_m4_v3(obedit->obmat, curs); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 6c254dc4d19..0559237343a 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4313,7 +4313,7 @@ int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2])) } /* ******************** Edge Slide *************** */ -static BMEdge *get_other_edge(BMesh *bm, BMVert *v, BMEdge *e) +static BMEdge *get_other_edge(BMVert *v, BMEdge *e) { BMIter iter; BMEdge *e2; @@ -4326,7 +4326,7 @@ static BMEdge *get_other_edge(BMesh *bm, BMVert *v, BMEdge *e) return NULL; } -static BMLoop *get_next_loop(BMesh *UNUSED(bm), BMVert *v, BMLoop *l, +static BMLoop *get_next_loop(BMVert *v, BMLoop *l, BMEdge *olde, BMEdge *nexte, float vec[3]) { BMLoop *firstl; @@ -4419,7 +4419,7 @@ static int createSlideVerts(TransInfo *t) BLI_smallhash_init(&table); /*ensure valid selection*/ - BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(v, BM_ELEM_SELECT)) { numsel = 0; BM_ITER_ELEM (e, &iter2, v, BM_EDGES_OF_VERT) { @@ -4440,7 +4440,7 @@ static int createSlideVerts(TransInfo *t) } } - BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (BM_elem_flag_test(e, BM_ELEM_SELECT)) { if (!BM_edge_is_manifold(e)) { MEM_freeN(sld); @@ -4451,7 +4451,7 @@ static int createSlideVerts(TransInfo *t) } j = 0; - BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(v, BM_ELEM_SELECT)) { BM_elem_flag_enable(v, BM_ELEM_TAG); BLI_smallhash_insert(&table, (uintptr_t)v, SET_INT_IN_POINTER(j)); @@ -4473,7 +4473,7 @@ static int createSlideVerts(TransInfo *t) j = 0; while (1) { v = NULL; - BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(v, BM_ELEM_TAG)) break; @@ -4493,7 +4493,7 @@ static int createSlideVerts(TransInfo *t) /*first, rewind*/ numsel = 0; do { - e = get_other_edge(bm, v, e); + e = get_other_edge(v, e); if (!e) { e = v->e; break; @@ -4546,7 +4546,7 @@ static int createSlideVerts(TransInfo *t) v2=v, v = BM_edge_other_vert(e, v); e1 = e; - e = get_other_edge(bm, v, e); + e = get_other_edge(v, e); if (!e) { //v2=v, v = BM_edge_other_vert(l1->e, v); @@ -4571,8 +4571,8 @@ static int createSlideVerts(TransInfo *t) break; } - l1 = get_next_loop(bm, v, l1, e1, e, vec); - l2 = l2 ? get_next_loop(bm, v, l2, e1, e, vec2) : NULL; + l1 = get_next_loop(v, l1, e1, e, vec); + l2 = l2 ? get_next_loop(v, l2, e1, e, vec2) : NULL; j += 1; @@ -4591,7 +4591,7 @@ static int createSlideVerts(TransInfo *t) /* size = 50.0; */ /* UNUSED */ zero_v3(lastvec); zero_v3(dir); /* ee = le = NULL; */ /* UNUSED */ - BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (BM_elem_flag_test(e, BM_ELEM_SELECT)) { BMIter iter2; BMEdge *e2; @@ -4639,7 +4639,7 @@ static int createSlideVerts(TransInfo *t) } } - bmesh_edit_begin(em->bm, BMO_OP_FLAG_UNTAN_MULTIRES); + bmesh_edit_begin(bm, BMO_OP_FLAG_UNTAN_MULTIRES); /*create copies of faces for customdata projection*/ tempsv = sld->sv; @@ -4651,14 +4651,14 @@ static int createSlideVerts(TransInfo *t) BM_ITER_ELEM (f, &fiter, tempsv->v, BM_FACES_OF_VERT) { if (!BLI_smallhash_haskey(&sld->origfaces, (uintptr_t)f)) { - BMFace *copyf = BM_face_copy(em->bm, f, TRUE, TRUE); + BMFace *copyf = BM_face_copy(bm, f, TRUE, TRUE); - BM_elem_select_set(em->bm, copyf, FALSE); + BM_elem_select_set(bm, copyf, FALSE); BM_elem_flag_enable(copyf, BM_ELEM_HIDDEN); BM_ITER_ELEM (l, &liter, copyf, BM_LOOPS_OF_FACE) { - BM_elem_select_set(em->bm, l->v, FALSE); + BM_elem_select_set(bm, l->v, FALSE); BM_elem_flag_enable(l->v, BM_ELEM_HIDDEN); - BM_elem_select_set(em->bm, l->e, FALSE); + BM_elem_select_set(bm, l->e, FALSE); BM_elem_flag_enable(l->e, BM_ELEM_HIDDEN); } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 2b60ff353d7..ba720ea8087 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1953,7 +1953,7 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f } /* loop-in-a-loop I know, but we need it! (ton) */ - static void get_face_center(float cent_r[3], BMesh *bm, BMVert *eve) + static void get_face_center(float cent_r[3], BMVert *eve) { BMFace *efa; @@ -1961,13 +1961,13 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f BM_ITER_ELEM (efa, &iter, eve, BM_FACES_OF_VERT) { if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) { - BM_face_center_mean_calc(bm, efa, cent_r); + BM_face_center_mean_calc(efa, cent_r); break; } } } -static void get_edge_center(float cent_r[3], BMesh *bm, BMVert *eve) +static void get_edge_center(float cent_r[3], BMVert *eve) { BMEdge *eed; BMIter iter; @@ -1993,9 +1993,9 @@ static void VertsToTransData(TransInfo *t, TransData *td, BMEditMesh *em, BMVert if (t->around==V3D_LOCAL) { if (em->selectmode & SCE_SELECT_FACE) - get_face_center(td->center, em->bm, eve); + get_face_center(td->center, eve); else if (em->selectmode & SCE_SELECT_EDGE) - get_edge_center(td->center, em->bm, eve); + get_edge_center(td->center, eve); } copy_v3_v3(td->iloc, td->loc); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index eb04ad04aa7..a7f58373e41 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1524,7 +1524,7 @@ void calculateCenter(TransInfo *t) BMEditMesh *em = BMEdit_FromObject(t->obedit); if (EDBM_editselection_active_get(em, &ese)) { - EDBM_editselection_center(em, t->center, &ese); + EDBM_editselection_center(t->center, &ese); calculateCenter2D(t); break; } diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 180c631d39a..82e57cca705 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -301,7 +301,7 @@ int calc_manipulator_stats(const bContext *C) /* USE LAST SELECTE WITH ACTIVE */ if (v3d->around==V3D_ACTIVE && EDBM_editselection_active_get(em, &ese)) { - EDBM_editselection_center(em, vec, &ese); + EDBM_editselection_center(vec, &ese); calc_tw_center(scene, vec); totsel= 1; } diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 4bcfcdc76f1..f40e344deb7 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -200,7 +200,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len); - totarea += BM_face_area_calc(bm, efa); + totarea += BM_face_area_calc(efa); //totuvarea += tf_area(tf, efa->v4!=0); totuvarea += poly_uv_area(tf_uv, efa->len); @@ -232,7 +232,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe else { BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(efa, BM_ELEM_TAG)) { - area = BM_face_area_calc(bm, efa) / totarea; + area = BM_face_area_calc(efa) / totarea; BLI_array_empty(tf_uv); BLI_array_empty(tf_uvorig); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 006b2fcf564..7eb71ecc9d0 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3511,7 +3511,7 @@ static int mark_seam_exec(bContext *C, wmOperator *UNUSED(op)) BMIter iter, liter; - BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { + BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_ELEM (loop, &liter, efa, BM_LOOPS_OF_FACE) { if (uvedit_edge_selected(em, scene, loop)) { BM_elem_flag_enable(loop->e, BM_ELEM_SEAM); diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index 39b4ce06b9c..45f1cecb99d 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -1210,7 +1210,7 @@ static PyObject *bpy_bmvert_normal_update(BPy_BMVert *self) { BPY_BM_CHECK_OBJ(self); - BM_vert_normal_update(self->bm, self->v); + BM_vert_normal_update(self->v); Py_RETURN_NONE; } @@ -1325,7 +1325,7 @@ static PyObject *bpy_bmedge_normal_update(BPy_BMEdge *self) { BPY_BM_CHECK_OBJ(self); - BM_edge_normals_update(self->bm, self->e); + BM_edge_normals_update(self->e); Py_RETURN_NONE; } @@ -1426,7 +1426,7 @@ PyDoc_STRVAR(bpy_bmface_calc_area_doc, static PyObject *bpy_bmface_calc_area(BPy_BMFace *self) { BPY_BM_CHECK_OBJ(self); - return PyFloat_FromDouble(BM_face_area_calc(self->bm, self->f)); + return PyFloat_FromDouble(BM_face_area_calc(self->f)); } @@ -1441,7 +1441,7 @@ PyDoc_STRVAR(bpy_bmface_calc_perimeter_doc, static PyObject *bpy_bmface_calc_perimeter(BPy_BMFace *self) { BPY_BM_CHECK_OBJ(self); - return PyFloat_FromDouble(BM_face_perimeter_calc(self->bm, self->f)); + return PyFloat_FromDouble(BM_face_perimeter_calc(self->f)); } @@ -1458,7 +1458,7 @@ static PyObject *bpy_bmface_calc_center_mean(BPy_BMFace *self) float cent[3]; BPY_BM_CHECK_OBJ(self); - BM_face_center_mean_calc(self->bm, self->f, cent); + BM_face_center_mean_calc(self->f, cent); return Vector_CreatePyObject(cent, 3, Py_NEW, NULL); } @@ -1476,7 +1476,7 @@ static PyObject *bpy_bmface_calc_center_bounds(BPy_BMFace *self) float cent[3]; BPY_BM_CHECK_OBJ(self); - BM_face_center_bounds_calc(self->bm, self->f, cent); + BM_face_center_bounds_calc(self->f, cent); return Vector_CreatePyObject(cent, 3, Py_NEW, NULL); } @@ -1490,7 +1490,7 @@ static PyObject *bpy_bmface_normal_update(BPy_BMFace *self) { BPY_BM_CHECK_OBJ(self); - BM_face_normal_update(self->bm, self->f); + BM_face_normal_update(self->f); Py_RETURN_NONE; } |