diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-22 11:53:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-22 11:53:11 +0400 |
commit | 7044d806399db4c24b3e9d04f64bd85951c599ba (patch) | |
tree | c9cca0612c04d947c5bb76a37e08482ec25f1ec6 | |
parent | 4c3bb77012024a3f14181eafe850b4d68bca1191 (diff) |
code cleanup: remove BMesh * args from query functions which don't need it
-rw-r--r-- | source/blender/bmesh/intern/bmesh_construct.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mods.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_queries.c | 20 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_queries.h | 18 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_walkers_impl.c | 19 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_dissolve.c | 8 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_extrude.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/tools/BME_bevel.c | 8 | ||||
-rw-r--r-- | source/blender/editors/mesh/bmesh_select.c | 2 | ||||
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types.c | 18 |
10 files changed, 50 insertions, 53 deletions
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index 097f4c7a9d7..aebad342f7e 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -966,7 +966,7 @@ short BM_edge_flag_to_mflag(BMEdge *eed) ((hflag & BM_ELEM_SEAM) ? ME_SEAM : 0) | ((hflag & BM_ELEM_SMOOTH) == 0 ? ME_SHARP : 0) | ((hflag & BM_ELEM_HIDDEN) ? ME_HIDE : 0) | - ((BM_edge_is_wire(NULL, eed)) ? ME_LOOSEEDGE : 0) | /* not typical */ + ((BM_edge_is_wire(eed)) ? ME_LOOSEEDGE : 0) | /* not typical */ (ME_EDGEDRAW | ME_EDGERENDER) ); } diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 792882751cd..da936079dc8 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -71,7 +71,7 @@ int BM_vert_dissolve(BMesh *bm, BMVert *v) BM_vert_kill(bm, v); /* will kill edges too */ return TRUE; } - else if (!BM_vert_is_manifold(bm, v)) { + else if (!BM_vert_is_manifold(v)) { if (!v->e) { BM_vert_kill(bm, v); return TRUE; @@ -108,7 +108,7 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v) BMEdge *e, *keepedge = NULL, *baseedge = NULL; int len = 0; - if (!BM_vert_is_manifold(bm, v)) { + if (!BM_vert_is_manifold(v)) { return FALSE; } diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index 93ea6d53139..8f1568119f8 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -389,7 +389,7 @@ int BM_vert_face_count(BMVert *v) * Tests whether or not the vertex is part of a wire edge. * (ie: has no faces attached to it) */ -int BM_vert_is_wire(BMesh *UNUSED(bm), BMVert *v) +int BM_vert_is_wire(BMVert *v) { BMEdge *curedge; @@ -413,7 +413,7 @@ int BM_vert_is_wire(BMesh *UNUSED(bm), BMVert *v) * Tests whether or not the edge is part of a wire. * (ie: has no faces attached to it) */ -int BM_edge_is_wire(BMesh *UNUSED(bm), BMEdge *e) +int BM_edge_is_wire(BMEdge *e) { return (e->l) ? FALSE : TRUE; } @@ -425,7 +425,7 @@ int BM_edge_is_wire(BMesh *UNUSED(bm), BMEdge *e) * 3: Is part of a non-manifold edge (edge with more than 2 faces) * 4: Is part of a wire edge */ -int BM_vert_is_manifold(BMesh *UNUSED(bm), BMVert *v) +int BM_vert_is_manifold(BMVert *v) { BMEdge *e, *oe; BMLoop *l; @@ -491,14 +491,14 @@ int BM_vert_is_manifold(BMesh *UNUSED(bm), BMVert *v) */ #if 1 /* fast path for checking manifold */ -int BM_edge_is_manifold(BMesh *UNUSED(bm), BMEdge *e) +int BM_edge_is_manifold(BMEdge *e) { const BMLoop *l = e->l; return (l && ((l->radial_next == l) || /* 1 face user */ (l->radial_next->radial_next == l))); /* 2 face users */ } #else -int BM_edge_is_manifold(BMesh *UNUSED(bm), BMEdge *e) +int BM_edge_is_manifold(BMEdge *e) { int count = BM_edge_face_count(e); if (count == 2 || count == 1) { @@ -662,7 +662,7 @@ void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2) * * \return angle in radians */ -float BM_loop_face_angle(BMesh *UNUSED(bm), BMLoop *l) +float BM_loop_face_angle(BMLoop *l) { return angle_v3v3v3(l->prev->v->co, l->v->co, @@ -678,7 +678,7 @@ float BM_loop_face_angle(BMesh *UNUSED(bm), BMLoop *l) * \param l The loop to calculate the normal at * \param r_normal Resulting normal */ -void BM_loop_face_normal(BMesh *UNUSED(bm), BMLoop *l, float r_normal[3]) +void BM_loop_face_normal(BMLoop *l, float r_normal[3]) { if (normal_tri_v3(r_normal, l->prev->v->co, @@ -702,7 +702,7 @@ void BM_loop_face_normal(BMesh *UNUSED(bm), BMLoop *l, float r_normal[3]) * \param l The loop to calculate the tangent at * \param r_tangent Resulting tangent */ -void BM_loop_face_tangent(BMesh *UNUSED(bm), BMLoop *l, float r_tangent[3]) +void BM_loop_face_tangent(BMLoop *l, float r_tangent[3]) { float v_prev[3]; float v_next[3]; @@ -736,7 +736,7 @@ void BM_loop_face_tangent(BMesh *UNUSED(bm), BMLoop *l, float r_tangent[3]) * * \return angle in radians */ -float BM_edge_face_angle(BMesh *UNUSED(bm), BMEdge *e) +float BM_edge_face_angle(BMEdge *e) { if (BM_edge_face_count(e) == 2) { BMLoop *l1 = e->l; @@ -755,7 +755,7 @@ float BM_edge_face_angle(BMesh *UNUSED(bm), BMEdge *e) * * \returns the angle in radians */ -float BM_vert_edge_angle(BMesh *UNUSED(bm), BMVert *v) +float BM_vert_edge_angle(BMVert *v) { BMEdge *e1, *e2; diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h index 4bccd869dd4..c2a718b49ce 100644 --- a/source/blender/bmesh/intern/bmesh_queries.h +++ b/source/blender/bmesh/intern/bmesh_queries.h @@ -49,19 +49,19 @@ int BM_vert_edge_count(BMVert *v); int BM_edge_face_count(BMEdge *e); int BM_vert_face_count(BMVert *v); -int BM_vert_is_wire(BMesh *bm, BMVert *v); -int BM_edge_is_wire(BMesh *bm, BMEdge *e); +int BM_vert_is_wire(BMVert *v); +int BM_edge_is_wire(BMEdge *e); -int BM_vert_is_manifold(BMesh *bm, BMVert *v); -int BM_edge_is_manifold(BMesh *bm, BMEdge *e); +int BM_vert_is_manifold(BMVert *v); +int BM_edge_is_manifold(BMEdge *e); int BM_edge_is_boundary(BMEdge *e); -float BM_loop_face_angle(BMesh *bm, BMLoop *l); -void BM_loop_face_normal(BMesh *bm, BMLoop *l, float r_normal[3]); -void BM_loop_face_tangent(BMesh *bm, BMLoop *l, float r_tangent[3]); +float BM_loop_face_angle(BMLoop *l); +void BM_loop_face_normal(BMLoop *l, float r_normal[3]); +void BM_loop_face_tangent(BMLoop *l, float r_tangent[3]); -float BM_edge_face_angle(BMesh *bm, BMEdge *e); -float BM_vert_edge_angle(BMesh *bm, BMVert *v); +float BM_edge_face_angle(BMEdge *e); +float BM_vert_edge_angle(BMVert *v); BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2); diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c index 4821ec5edd2..b361a0d051d 100644 --- a/source/blender/bmesh/intern/bmesh_walkers_impl.c +++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c @@ -258,7 +258,7 @@ static void *bmw_IslandboundWalker_step(BMWalker *walker) v = BM_edge_other_vert(e, iwalk->lastv); - if (!BM_vert_is_manifold(walker->bm, v)) { + if (!BM_vert_is_manifold(v)) { BMW_reset(walker); BMO_error_raise(walker->bm, NULL, BMERR_WALKER_FAILED, "Non-manifold vert " @@ -604,10 +604,8 @@ static int bmw_FaceLoopWalker_include_face(BMWalker *walker, BMLoop *l) /* Check whether the face loop can start from the given edge */ static int bmw_FaceLoopWalker_edge_begins_loop(BMWalker *walker, BMEdge *e) { - BMesh *bm = walker->bm; - /* There is no face loop starting from a wire edge */ - if (BM_edge_is_wire(bm, e)) { + if (BM_edge_is_wire(e)) { return FALSE; } @@ -620,7 +618,7 @@ static int bmw_FaceLoopWalker_edge_begins_loop(BMWalker *walker, BMEdge *e) } /* Don't start a face loop from non-manifold edges */ - if (!BM_edge_is_manifold(bm, e)) { + if (!BM_edge_is_manifold(e)) { return FALSE; } @@ -785,7 +783,6 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker) BMwEdgeringWalker *lwalk = BMW_current_state(walker); BMEdge *e; BMLoop *l = lwalk->l /* , *origl = lwalk->l */; - BMesh *bm = walker->bm; #ifdef BMW_EDGERING_NGON int i, len; #endif @@ -796,7 +793,7 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker) return lwalk->wireedge; e = l->e; - if (!BM_edge_is_manifold(bm, e)) { + if (!BM_edge_is_manifold(e)) { /* walker won't traverse to a non-manifold edge, but may * be started on one, and should not traverse *away* from * a non-manfold edge (non-manifold edges are never in an @@ -813,7 +810,7 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker) i -= 2; } - if ((len <= 0) || (len % 2 != 0) || !BM_edge_is_manifold(bm, l->e)) { + if ((len <= 0) || (len % 2 != 0) || !BM_edge_is_manifold(l->e)) { l = lwalk->l; i = len; while (i > 0) { @@ -822,7 +819,7 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker) } } /* only walk to manifold edge */ - if ((l->f->len % 2 == 0) && BM_edge_is_manifold(bm, l->e) && + if ((l->f->len % 2 == 0) && BM_edge_is_manifold(l->e) && !BLI_ghash_haskey(walker->visithash, l->e)) #else @@ -830,11 +827,11 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker) l = l->radial_next; l = l->next->next; - if ((l->f->len != 4) || !BM_edge_is_manifold(bm, l->e)) { + if ((l->f->len != 4) || !BM_edge_is_manifold(l->e)) { l = lwalk->l->next->next; } /* only walk to manifold edge */ - if ((l->f->len == 4) && BM_edge_is_manifold(bm, l->e) && + if ((l->f->len == 4) && BM_edge_is_manifold(l->e) && !BLI_ghash_haskey(walker->visithash, l->e)) #endif { diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index 1db07fde83d..4685b0a2ede 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -493,7 +493,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op) /* go through and split edge */ for (i = 0, tot_found = 0; i < einput->len; i++) { BMEdge *e = ((BMEdge **)einput->data.p)[i]; - const float angle = BM_edge_face_angle(bm, e); + const float angle = BM_edge_face_angle(e); if (angle < angle_limit) { weight_elems[i].ele = (BMHeader *)e; @@ -512,7 +512,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op) for (i = 0; i < tot_found; i++) { BMEdge *e = (BMEdge *)weight_elems[i].ele; /* check twice because cumulative effect could disolve over angle limit */ - if (BM_edge_face_angle(bm, e) < angle_limit) { + if (BM_edge_face_angle(e) < angle_limit) { BMFace *nf = BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e); /* join faces */ @@ -528,7 +528,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op) /* --- second verts --- */ for (i = 0, tot_found = 0; i < vinput->len; i++) { BMVert *v = ((BMVert **)vinput->data.p)[i]; - const float angle = BM_vert_edge_angle(bm, v); + const float angle = BM_vert_edge_angle(v); if (angle < angle_limit) { weight_elems[i].ele = (BMHeader *)v; @@ -547,7 +547,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op) for (i = 0; i < tot_found; i++) { BMVert *v = (BMVert *)weight_elems[i].ele; /* check twice because cumulative effect could disolve over angle limit */ - if (BM_vert_edge_angle(bm, v) < angle_limit) { + if (BM_vert_edge_angle(v) < angle_limit) { BM_vert_collapse_edge(bm, v->e, v, TRUE); /* join edges */ } } diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index 6e30b045987..32acd99a260 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -341,7 +341,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) for ( ; e; e = BMO_iter_step(&siter)) { /* this should always be wire, so this is mainly a speedup to avoid map lookup */ - if (BM_edge_is_wire(bm, e) && BMO_slot_map_contains(bm, op, "exclude", e)) { + if (BM_edge_is_wire(e) && BMO_slot_map_contains(bm, op, "exclude", e)) { /* The original edge was excluded, * this would result in a standalone wire edge - see [#30399] */ BM_edge_kill(bm, e); @@ -453,7 +453,7 @@ static void calc_solidify_normals(BMesh *bm) edge_face_count = NULL; /* don't re-use */ BM_ITER(v, &viter, bm, BM_VERTS_OF_MESH, NULL) { - if (!BM_vert_is_manifold(bm, v)) { + if (!BM_vert_is_manifold(v)) { BMO_elem_flag_enable(bm, v, VERT_NONMAN); continue; } diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index 82ab6edf5dc..139176e5276 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -151,7 +151,7 @@ static int BME_Bevel_Dissolve_Disk(BMesh *bm, BMVert *v) BMEdge *e, *elast; BMLoop *l1, *l2; - if (!BM_vert_is_manifold(bm, v)) { + if (!BM_vert_is_manifold(v)) { return 0; } @@ -888,13 +888,13 @@ static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_ind BMO_elem_flag_enable(bm, v, BME_BEVEL_ORIG); if(v->e) { BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 0, -1, -1, NULL); - if (!BM_vert_is_manifold(bm, v)) { + if (!BM_vert_is_manifold(v)) { BMO_elem_flag_enable(bm, v, BME_BEVEL_NONMAN); } /* test wire ver */ len = BM_vert_edge_count(v); - if (len == 2 && BM_vert_is_wire(bm, v)) + if (len == 2 && BM_vert_is_wire(v)) BMO_elem_flag_disable(bm, v, BME_BEVEL_NONMAN); } else { @@ -904,7 +904,7 @@ static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_ind BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { BMO_elem_flag_enable(bm, e, BME_BEVEL_ORIG); - if (!BM_edge_is_manifold(bm, e)) { + if (!BM_edge_is_manifold(e)) { BMO_elem_flag_enable(bm, e->v1, BME_BEVEL_NONMAN); BMO_elem_flag_enable(bm, e->v2, BME_BEVEL_NONMAN); BMO_elem_flag_enable(bm, e, BME_BEVEL_NONMAN); diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/bmesh_select.c index f1998eabbac..9f1528c062d 100644 --- a/source/blender/editors/mesh/bmesh_select.c +++ b/source/blender/editors/mesh/bmesh_select.c @@ -2359,7 +2359,7 @@ static int select_non_manifold_exec(bContext *C, wmOperator *op) } BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) { - if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN) && !BM_vert_is_manifold(em->bm, v)) { + if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN) && !BM_vert_is_manifold(v)) { BM_elem_select_set(em->bm, v, TRUE); } } diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index 3a60018df57..8600d6a10df 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -384,7 +384,7 @@ PyDoc_STRVAR(bpy_bmvert_is_manifold_doc, static PyObject *bpy_bmvert_is_manifold_get(BPy_BMVert *self) { BPY_BM_CHECK_OBJ(self); - return PyBool_FromLong(BM_vert_is_manifold(self->bm, self->v)); + return PyBool_FromLong(BM_vert_is_manifold(self->v)); } @@ -394,7 +394,7 @@ PyDoc_STRVAR(bpy_bmvert_is_wire_doc, static PyObject *bpy_bmvert_is_wire_get(BPy_BMVert *self) { BPY_BM_CHECK_OBJ(self); - return PyBool_FromLong(BM_vert_is_wire(self->bm, self->v)); + return PyBool_FromLong(BM_vert_is_wire(self->v)); } @@ -407,7 +407,7 @@ PyDoc_STRVAR(bpy_bmedge_is_manifold_doc, static PyObject *bpy_bmedge_is_manifold_get(BPy_BMEdge *self) { BPY_BM_CHECK_OBJ(self); - return PyBool_FromLong(BM_edge_is_manifold(self->bm, self->e)); + return PyBool_FromLong(BM_edge_is_manifold(self->e)); } @@ -417,7 +417,7 @@ PyDoc_STRVAR(bpy_bmedge_is_wire_doc, static PyObject *bpy_bmedge_is_wire_get(BPy_BMEdge *self) { BPY_BM_CHECK_OBJ(self); - return PyBool_FromLong(BM_edge_is_wire(self->bm, self->e)); + return PyBool_FromLong(BM_edge_is_wire(self->e)); } @@ -1160,7 +1160,7 @@ PyDoc_STRVAR(bpy_bmvert_calc_edge_angle_doc, static PyObject *bpy_bmvert_calc_edge_angle(BPy_BMVert *self) { BPY_BM_CHECK_OBJ(self); - return PyFloat_FromDouble(BM_vert_edge_angle(self->bm, self->v)); + return PyFloat_FromDouble(BM_vert_edge_angle(self->v)); } @@ -1203,7 +1203,7 @@ PyDoc_STRVAR(bpy_bmedge_calc_face_angle_doc, static PyObject *bpy_bmedge_calc_face_angle(BPy_BMEdge *self) { BPY_BM_CHECK_OBJ(self); - return PyFloat_FromDouble(BM_edge_face_angle(self->bm, self->e)); + return PyFloat_FromDouble(BM_edge_face_angle(self->e)); } @@ -1473,7 +1473,7 @@ PyDoc_STRVAR(bpy_bmloop_calc_angle_doc, static PyObject *bpy_bmloop_calc_angle(BPy_BMLoop *self) { BPY_BM_CHECK_OBJ(self); - return PyFloat_FromDouble(BM_loop_face_angle(self->bm, self->l)); + return PyFloat_FromDouble(BM_loop_face_angle(self->l)); } PyDoc_STRVAR(bpy_bmloop_calc_normal_doc, @@ -1489,7 +1489,7 @@ static PyObject *bpy_bmloop_calc_normal(BPy_BMLoop *self) { float vec[3]; BPY_BM_CHECK_OBJ(self); - BM_loop_face_normal(self->bm, self->l, vec); + BM_loop_face_normal(self->l, vec); return Vector_CreatePyObject(vec, 3, Py_NEW, NULL); } @@ -1506,7 +1506,7 @@ static PyObject *bpy_bmloop_calc_tangent(BPy_BMLoop *self) { float vec[3]; BPY_BM_CHECK_OBJ(self); - BM_loop_face_tangent(self->bm, self->l, vec); + BM_loop_face_tangent(self->l, vec); return Vector_CreatePyObject(vec, 3, Py_NEW, NULL); } |