diff options
Diffstat (limited to 'source/blender/bmesh/operators')
-rw-r--r-- | source/blender/bmesh/operators/bmo_bevel.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_create.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_dissolve.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_extrude.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_join_triangles.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_subdivide.c | 82 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_utils.c | 39 |
7 files changed, 58 insertions, 79 deletions
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; } } |