diff options
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editface.c | 8 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_add.c | 20 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_loopcut.c | 8 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_select.c | 94 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 184 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_utils.c | 134 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_data.c | 6 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_intern.h | 40 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_navmesh.c | 12 | ||||
-rw-r--r-- | source/blender/editors/mesh/meshtools.c | 6 |
11 files changed, 268 insertions, 246 deletions
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 3fad6f6a2cb..d2446d1ad0e 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -879,7 +879,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to if (em) { if (skip_em_vert_array_init == FALSE) { - EDBM_init_index_arrays(em, 1, 0, 0); + EDBM_index_arrays_init(em, 1, 0, 0); } } @@ -904,8 +904,8 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to if ((a == totvert) || (topo_pairs[a - 1].hash != topo_pairs[a].hash)) { if (a - last == 2) { if (em) { - index_lookup[topo_pairs[a - 1].v_index] = (intptr_t)EDBM_get_vert_for_index(em, topo_pairs[a - 2].v_index); - index_lookup[topo_pairs[a - 2].v_index] = (intptr_t)EDBM_get_vert_for_index(em, topo_pairs[a - 1].v_index); + index_lookup[topo_pairs[a - 1].v_index] = (intptr_t)EDBM_vert_at_index(em, topo_pairs[a - 2].v_index); + index_lookup[topo_pairs[a - 2].v_index] = (intptr_t)EDBM_vert_at_index(em, topo_pairs[a - 1].v_index); } else { index_lookup[topo_pairs[a - 1].v_index] = topo_pairs[a - 2].v_index; @@ -917,7 +917,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to } if (em) { if (skip_em_vert_array_init == FALSE) { - EDBM_free_index_arrays(em); + EDBM_index_arrays_free(em); } } diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 0d40e8585c3..a464e40217a 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -51,6 +51,8 @@ #include "ED_screen.h" #include "ED_object.h" +#include "mesh_intern.h" + /* uses context to figure out transform for primitive */ /* returns standard diameter */ static float new_primitive_matrix(bContext *C, float *loc, float *rot, float primmat[][4]) @@ -137,7 +139,7 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", + if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_grid xsegments=%i ysegments=%i size=%f mat=%m4", 1, 1, dia, mat)) { return OPERATOR_CANCELLED; @@ -183,7 +185,7 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", "create_cube mat=%m4 size=%f", mat, 2.0f)) { + if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_cube mat=%m4 size=%f", mat, 2.0f)) { return OPERATOR_CANCELLED; } @@ -237,7 +239,7 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", + if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_circle segments=%i diameter=%f cap_ends=%b cap_tris=%b mat=%m4", RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"), cap_end, cap_tri, mat)) @@ -296,7 +298,7 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf( + if (!EDBM_op_call_and_selectf( em, op, "vertout", "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f mat=%m4", RNA_int_get(op->ptr, "vertices"), @@ -361,7 +363,7 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf( + if (!EDBM_op_call_and_selectf( em, op, "vertout", "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f mat=%m4", RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius1"), @@ -422,7 +424,7 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", + if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_grid xsegments=%i ysegments=%i size=%f mat=%m4", RNA_int_get(op->ptr, "x_subdivisions"), RNA_int_get(op->ptr, "y_subdivisions"), @@ -481,7 +483,7 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", "create_monkey mat=%m4", mat)) { + if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_monkey mat=%m4", mat)) { return OPERATOR_CANCELLED; } @@ -524,7 +526,7 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", + if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_uvsphere segments=%i revolutions=%i diameter=%f mat=%m4", RNA_int_get(op->ptr, "segments"), RNA_int_get(op->ptr, "ring_count"), RNA_float_get(op->ptr, "size"), mat)) @@ -580,7 +582,7 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf( + if (!EDBM_op_call_and_selectf( em, op, "vertout", "create_icosphere subdivisions=%i diameter=%f mat=%m4", RNA_int_get(op->ptr, "subdivisions"), diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index d1dc873aa08..0ef6e2b81a8 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1269,7 +1269,7 @@ static BMFace *knife_find_closest_face(knifetool_opdata *kcd, float co[3], float if (!f) { /* try to use backbuffer selection method if ray casting failed */ - f = EDBM_findnearestface(&kcd->vc, &dist); + f = EDBM_face_find_nearest(&kcd->vc, &dist); /* cheat for now; just put in the origin instead * of a true coordinate on the face. diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index eb28359c333..b151978c1f1 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -334,9 +334,9 @@ static void ringsel_finish(bContext *C, wmOperator *op) /* sets as active, useful for other tools */ if (em->selectmode & SCE_SELECT_VERTEX) - EDBM_store_selection(em, lcd->eed->v1); /* low priority TODO, get vertrex close to mouse */ + EDBM_editselection_store(em, &lcd->eed->v1->head); /* low priority TODO, get vertrex close to mouse */ if (em->selectmode & SCE_SELECT_EDGE) - EDBM_store_selection(em, lcd->eed); + EDBM_editselection_store(em, &lcd->eed->head); EDBM_selectmode_flush(lcd->em); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, lcd->ob->data); @@ -418,7 +418,7 @@ static int ringcut_invoke(bContext *C, wmOperator *op, wmEvent *evt) lcd->vc.mval[0] = evt->mval[0]; lcd->vc.mval[1] = evt->mval[1]; - edge = EDBM_findnearestedge(&lcd->vc, &dist); + edge = EDBM_edge_find_nearest(&lcd->vc, &dist); if (edge != lcd->eed) { lcd->eed = edge; ringsel_find_edge(lcd, 1); @@ -502,7 +502,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event) lcd->vc.mval[0] = event->mval[0]; lcd->vc.mval[1] = event->mval[1]; - edge = EDBM_findnearestedge(&lcd->vc, &dist); + edge = EDBM_edge_find_nearest(&lcd->vc, &dist); if (edge != lcd->eed) { lcd->eed = edge; diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index deca9228cdf..af1beba7841 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -83,7 +83,7 @@ void EDBM_select_mirrored(Object *UNUSED(obedit), BMEditMesh *em, int extend) } } - EDBM_CacheMirrorVerts(em, TRUE); + EDBM_verts_mirror_cache_begin(em, TRUE); if (!extend) EDBM_flag_disable_all(em, BM_ELEM_SELECT); @@ -92,13 +92,13 @@ void EDBM_select_mirrored(Object *UNUSED(obedit), BMEditMesh *em, int extend) if (!BM_elem_flag_test(v1, BM_ELEM_TAG) || BM_elem_flag_test(v1, BM_ELEM_HIDDEN)) continue; - v2 = EDBM_GetMirrorVert(em, v1); + v2 = EDBM_verts_mirror_get(em, v1); if (v2 && !BM_elem_flag_test(v2, BM_ELEM_HIDDEN)) { BM_elem_select_set(em->bm, v2, TRUE); } } - EDBM_EndMirrorCache(em); + EDBM_verts_mirror_cache_end(em); } void EDBM_automerge(Scene *scene, Object *obedit, int update) @@ -175,7 +175,7 @@ static void draw_triangulated(int mcords[][2], short tot) /* reads rect, and builds selection array for quick lookup */ /* returns if all is OK */ -int EDBM_init_backbuf_border(ViewContext *vc, short xmin, short ymin, short xmax, short ymax) +int EDBM_backbuf_border_init(ViewContext *vc, short xmin, short ymin, short xmax, short ymax) { struct ImBuf *buf; unsigned int *dr; @@ -204,7 +204,7 @@ int EDBM_init_backbuf_border(ViewContext *vc, short xmin, short ymin, short xmax return 1; } -int EDBM_check_backbuf(unsigned int index) +int EDBM_backbuf_check(unsigned int index) { if (selbuf == NULL) return 1; if (index > 0 && index <= bm_vertoffs) @@ -212,7 +212,7 @@ int EDBM_check_backbuf(unsigned int index) return 0; } -void EDBM_free_backbuf(void) +void EDBM_backbuf_free(void) { if (selbuf) MEM_freeN(selbuf); selbuf = NULL; @@ -224,7 +224,7 @@ void EDBM_free_backbuf(void) * - grab again and compare * returns 'OK' */ -int EDBM_mask_init_backbuf_border(ViewContext *vc, int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax) +int EDBM_backbuf_border_mask_init(ViewContext *vc, int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax) { unsigned int *dr, *drm; struct ImBuf *buf, *bufmask; @@ -285,7 +285,7 @@ int EDBM_mask_init_backbuf_border(ViewContext *vc, int mcords[][2], short tot, s } /* circle shaped sample area */ -int EDBM_init_backbuf_circle(ViewContext *vc, short xs, short ys, short rads) +int EDBM_backbuf_circle_init(ViewContext *vc, short xs, short ys, short rads) { struct ImBuf *buf; unsigned int *dr; @@ -376,7 +376,7 @@ static unsigned int findnearestvert__backbufIndextest(void *handle, unsigned int * if 0, unselected vertice are given the bias * strict: if 1, the vertice corresponding to the sel parameter are ignored and not just biased */ -BMVert *EDBM_findnearestvert(ViewContext *vc, int *dist, short sel, short strict) +BMVert *EDBM_vert_find_nearest(ViewContext *vc, int *dist, short sel, short strict) { if (vc->v3d->drawtype > OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) { int distance; @@ -494,7 +494,7 @@ static void findnearestedge__doClosest(void *userData, BMEdge *eed, int x0, int } } } -BMEdge *EDBM_findnearestedge(ViewContext *vc, int *dist) +BMEdge *EDBM_edge_find_nearest(ViewContext *vc, int *dist) { if (vc->v3d->drawtype > OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) { @@ -567,7 +567,7 @@ static void findnearestface__doClosest(void *userData, BMFace *efa, int x, int y } } -BMFace *EDBM_findnearestface(ViewContext *vc, int *dist) +BMFace *EDBM_face_find_nearest(ViewContext *vc, int *dist) { if (vc->v3d->drawtype > OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) { @@ -650,13 +650,13 @@ static int unified_findnearest(ViewContext *vc, BMVert **r_eve, BMEdge **r_eed, view3d_validate_backbuf(vc); if (em->selectmode & SCE_SELECT_VERTEX) - *r_eve = EDBM_findnearestvert(vc, &dist, BM_ELEM_SELECT, 0); + *r_eve = EDBM_vert_find_nearest(vc, &dist, BM_ELEM_SELECT, 0); if (em->selectmode & SCE_SELECT_FACE) - *r_efa = EDBM_findnearestface(vc, &dist); + *r_efa = EDBM_face_find_nearest(vc, &dist); dist -= 20; /* since edges select lines, we give dots advantage of 20 pix */ if (em->selectmode & SCE_SELECT_EDGE) - *r_eed = EDBM_findnearestedge(vc, &dist); + *r_eed = EDBM_edge_find_nearest(vc, &dist); /* return only one of 3 pointers, for frontbuffer redraws */ if (*r_eed) { @@ -707,7 +707,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) float thresh = RNA_float_get(op->ptr, "threshold"); /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "similarfaces faces=%hf type=%i thresh=%f", BM_ELEM_SELECT, type, thresh); + EDBM_op_init(em, &bmop, op, "similarfaces faces=%hf type=%i thresh=%f", BM_ELEM_SELECT, type, thresh); /* execute the operator */ BMO_op_exec(em->bm, &bmop); @@ -719,7 +719,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_ALL, BM_ELEM_SELECT, TRUE); /* finish the operator */ - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -745,7 +745,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op) float thresh = RNA_float_get(op->ptr, "threshold"); /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "similaredges edges=%he type=%i thresh=%f", BM_ELEM_SELECT, type, thresh); + EDBM_op_init(em, &bmop, op, "similaredges edges=%he type=%i thresh=%f", BM_ELEM_SELECT, type, thresh); /* execute the operator */ BMO_op_exec(em->bm, &bmop); @@ -758,7 +758,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op) EDBM_selectmode_flush(em); /* finish the operator */ - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -786,7 +786,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op) float thresh = RNA_float_get(op->ptr, "threshold"); /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "similarverts verts=%hv type=%i thresh=%f", BM_ELEM_SELECT, type, thresh); + EDBM_op_init(em, &bmop, op, "similarverts verts=%hv type=%i thresh=%f", BM_ELEM_SELECT, type, thresh); /* execute the operator */ BMO_op_exec(em->bm, &bmop); @@ -798,7 +798,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op) BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE); /* finish the operator */ - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -1008,7 +1008,7 @@ static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring) /* no afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad */ view3d_validate_backbuf(&vc); - eed = EDBM_findnearestedge(&vc, &dist); + eed = EDBM_edge_find_nearest(&vc, &dist); if (eed) { if (extend == 0) { EDBM_flag_disable_all(em, BM_ELEM_SELECT); @@ -1047,10 +1047,10 @@ static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring) /* TODO: would be nice if the edge vertex chosen here * was the one closer to the selection pointer, instead * of arbitrarily selecting the first one */ - EDBM_store_selection(em, eed->v1); + EDBM_editselection_store(em, &eed->v1->head); } else if (em->selectmode & SCE_SELECT_EDGE) { - EDBM_store_selection(em, eed); + EDBM_editselection_store(em, &eed->head); } /* TODO: would be nice if the nearest face that * belongs to the selected edge could be set to @@ -1136,13 +1136,13 @@ static float edgetag_cut_cost(BMEditMesh *UNUSED(em), BMEdge *e1, BMEdge *e2, BM static void edgetag_add_adjacent(BMEditMesh *em, SmallHash *visithash, Heap *heap, int mednum, int vertnum, int *nedges, int *edges, int *prevedge, float *cost) { - BMEdge *e1 = EDBM_get_edge_for_index(em, mednum); - BMVert *v = EDBM_get_vert_for_index(em, vertnum); + BMEdge *e1 = EDBM_edge_at_index(em, mednum); + BMVert *v = EDBM_vert_at_index(em, vertnum); int startadj, endadj = nedges[vertnum + 1]; for (startadj = nedges[vertnum]; startadj < endadj; startadj++) { int adjnum = edges[startadj]; - BMEdge *e2 = EDBM_get_edge_for_index(em, adjnum); + BMEdge *e2 = EDBM_edge_at_index(em, adjnum); float newcost; float cutcost; @@ -1280,7 +1280,7 @@ static int edgetag_shortest_path(Scene *scene, BMEditMesh *em, BMEdge *source, B for (i = 0; i < totvert; i++) { int start = nedges[i], end = nedges[i + 1], cur; for (cur = start; cur < end; cur++) { - BMEdge *e = EDBM_get_edge_for_index(em, edges[cur]); + BMEdge *e = EDBM_edge_at_index(em, edges[cur]); } } #endif @@ -1289,12 +1289,12 @@ static int edgetag_shortest_path(Scene *scene, BMEditMesh *em, BMEdge *source, B heap = BLI_heap_new(); BLI_heap_insert(heap, 0.0f, SET_INT_IN_POINTER(BM_elem_index_get(source))); cost[BM_elem_index_get(source)] = 0.0f; - EDBM_init_index_arrays(em, 1, 1, 0); + EDBM_index_arrays_init(em, 1, 1, 0); targetnum = BM_elem_index_get(target); while (!BLI_heap_empty(heap)) { mednum = GET_INT_FROM_POINTER(BLI_heap_popmin(heap)); - e = EDBM_get_edge_for_index(em, mednum); + e = EDBM_edge_at_index(em, mednum); if (mednum == targetnum) break; @@ -1315,7 +1315,7 @@ static int edgetag_shortest_path(Scene *scene, BMEditMesh *em, BMEdge *source, B * if it is, the tags will be cleared instead of set. */ mednum = targetnum; do { - e = EDBM_get_edge_for_index(em, mednum); + e = EDBM_edge_at_index(em, mednum); if (!edgetag_context_check(scene, em, e)) { allseams = 0; break; @@ -1326,7 +1326,7 @@ static int edgetag_shortest_path(Scene *scene, BMEditMesh *em, BMEdge *source, B /* Follow path back and source and add or remove tags */ mednum = targetnum; do { - e = EDBM_get_edge_for_index(em, mednum); + e = EDBM_edge_at_index(em, mednum); if (allseams) edgetag_context_set(em, scene, e, 0); else @@ -1335,7 +1335,7 @@ static int edgetag_shortest_path(Scene *scene, BMEditMesh *em, BMEdge *source, B } while (mednum != -1); } - EDBM_free_index_arrays(em); + EDBM_index_arrays_free(em); MEM_freeN(nedges); MEM_freeN(edges); MEM_freeN(prevedge); @@ -1361,7 +1361,7 @@ static void mouse_mesh_shortest_path(bContext *C, int mval[2]) vc.mval[1] = mval[1]; em = vc.em; - e = EDBM_findnearestedge(&vc, &dist); + e = EDBM_edge_find_nearest(&vc, &dist); if (e) { Mesh *me = vc.obedit->data; int path = 0; @@ -1374,7 +1374,7 @@ static void mouse_mesh_shortest_path(bContext *C, int mval[2]) e_act = (BMEdge *)ese->ele; if (e_act != e) { if (edgetag_shortest_path(vc.scene, em, e_act, e)) { - EDBM_remove_selection(em, e_act); + EDBM_editselection_remove(em, &e_act->head); path = 1; } } @@ -1389,9 +1389,9 @@ static void mouse_mesh_shortest_path(bContext *C, int mval[2]) /* even if this is selected it may not be in the selection list */ if (edgetag_context_check(vc.scene, em, e) == 0) - EDBM_remove_selection(em, e); + EDBM_editselection_remove(em, &e->head); else - EDBM_store_selection(em, e); + EDBM_editselection_store(em, &e->head); /* force drawmode for mesh */ switch (CTX_data_tool_settings(C)->edge_mode) { @@ -1467,31 +1467,31 @@ int mouse_mesh(bContext *C, const int mval[2], short extend) BM_active_face_set(vc.em->bm, efa); if (!BM_elem_flag_test(efa, BM_ELEM_SELECT)) { - EDBM_store_selection(vc.em, efa); + EDBM_editselection_store(vc.em, &efa->head); BM_elem_select_set(vc.em->bm, efa, TRUE); } else if (extend) { - EDBM_remove_selection(vc.em, efa); + EDBM_editselection_remove(vc.em, &efa->head); BM_elem_select_set(vc.em->bm, efa, FALSE); } } else if (eed) { if (!BM_elem_flag_test(eed, BM_ELEM_SELECT)) { - EDBM_store_selection(vc.em, eed); + EDBM_editselection_store(vc.em, &eed->head); BM_elem_select_set(vc.em->bm, eed, TRUE); } else if (extend) { - EDBM_remove_selection(vc.em, eed); + EDBM_editselection_remove(vc.em, &eed->head); BM_elem_select_set(vc.em->bm, eed, FALSE); } } else if (eve) { if (!BM_elem_flag_test(eve, BM_ELEM_SELECT)) { - EDBM_store_selection(vc.em, eve); + EDBM_editselection_store(vc.em, &eve->head); BM_elem_select_set(vc.em->bm, eve, TRUE); } else if (extend) { - EDBM_remove_selection(vc.em, eve); + EDBM_editselection_remove(vc.em, &eve->head); BM_elem_select_set(vc.em->bm, eve, FALSE); } } @@ -1513,7 +1513,7 @@ int mouse_mesh(bContext *C, const int mval[2], short extend) return 0; } -static void EDBM_strip_selections(BMEditMesh *em) +static void edbm_strip_selections(BMEditMesh *em) { BMEditSelection *ese, *nextese; @@ -1554,7 +1554,7 @@ void EDBM_selectmode_set(BMEditMesh *em) em->bm->selectmode = em->selectmode; - EDBM_strip_selections(em); /* strip BMEditSelections from em->selected that are not relevant to new mode */ + edbm_strip_selections(em); /* strip BMEditSelections from em->selected that are not relevant to new mode */ if (em->selectmode & SCE_SELECT_VERTEX) { EDBM_select_flush(em); @@ -1588,7 +1588,7 @@ void EDBM_selectmode_set(BMEditMesh *em) } } -void EDBM_convertsel(BMEditMesh *em, short oldmode, short selectmode) +void EDBM_selectmode_convert(BMEditMesh *em, short oldmode, short selectmode) { BMEdge *eed; BMFace *efa; @@ -2127,7 +2127,7 @@ static void deselect_nth_active(BMEditMesh *em, BMVert **r_eve, BMEdge **r_eed, } } -static int EM_deselect_nth(BMEditMesh *em, int nth, int offset) +static int edbm_deselect_nth(BMEditMesh *em, int nth, int offset) { BMVert *v; BMEdge *e; @@ -2160,7 +2160,7 @@ static int edbm_select_nth_exec(bContext *C, wmOperator *op) offset = MIN2(nth, offset); - if (EM_deselect_nth(em, nth, offset) == 0) { + if (edbm_deselect_nth(em, nth, offset) == 0) { BKE_report(op->reports, RPT_ERROR, "Mesh has no active vert/edge/face"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 3e809f1241b..ba1f2924ad9 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -183,7 +183,7 @@ static short edbm_extrude_face_indiv(BMEditMesh *em, wmOperator *op, const char BMLoop *l; BMOperator bmop; - EDBM_InitOpf(em, &bmop, op, "extrude_face_indiv faces=%hf", hflag); + EDBM_op_init(em, &bmop, op, "extrude_face_indiv faces=%hf", hflag); /* deselect original verts */ EDBM_flag_disable_all(em, BM_ELEM_SELECT); @@ -199,7 +199,7 @@ static short edbm_extrude_face_indiv(BMEditMesh *em, wmOperator *op, const char } } - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return 0; } @@ -211,7 +211,7 @@ static short edbm_extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char { BMOperator bmop; - EDBM_InitOpf(em, &bmop, op, "extrude_edge_only edges=%he", hflag); + EDBM_op_init(em, &bmop, op, "extrude_edge_only edges=%he", hflag); /* deselect original verts */ EDBM_flag_disable_all(em, BM_ELEM_SELECT); @@ -219,7 +219,7 @@ static short edbm_extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char BMO_op_exec(em->bm, &bmop); BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_VERT | BM_EDGE, BM_ELEM_SELECT, TRUE); - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return 0; } @@ -231,7 +231,7 @@ static short edbm_extrude_verts_indiv(BMEditMesh *em, wmOperator *op, const char { BMOperator bmop; - EDBM_InitOpf(em, &bmop, op, "extrude_vert_indiv verts=%hv", hflag); + EDBM_op_init(em, &bmop, op, "extrude_vert_indiv verts=%hv", hflag); /* deselect original verts */ BMO_slot_buffer_hflag_disable(em->bm, &bmop, "verts", BM_VERT, BM_ELEM_SELECT, TRUE); @@ -239,7 +239,7 @@ static short edbm_extrude_verts_indiv(BMEditMesh *em, wmOperator *op, const char BMO_op_exec(em->bm, &bmop); BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_VERT, BM_ELEM_SELECT, TRUE); - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return 0; } @@ -404,7 +404,7 @@ static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op) //translateflag(em, SELECT, dvec); } - EDBM_RecalcNormals(em); + EDBM_mesh_normals_update(em); EDBM_update_generic(C, em, TRUE); @@ -525,7 +525,7 @@ static int edbm_extrude_region_exec(bContext *C, wmOperator *op) /* This normally happens when pushing undo but modal operators * like this one don't push undo data until after modal mode is * done.*/ - EDBM_RecalcNormals(em); + EDBM_mesh_normals_update(em); EDBM_update_generic(C, em, TRUE); @@ -832,7 +832,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent } if (rot_src) { - EDBM_CallOpf(vc.em, op, "rotate verts=%hv cent=%v mat=%m3", + EDBM_op_callf(vc.em, op, "rotate verts=%hv cent=%v mat=%m3", BM_ELEM_SELECT, cent, mat); /* also project the source, for retopo workflow */ @@ -841,9 +841,9 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent } edbm_extrude_edge(vc.obedit, vc.em, BM_ELEM_SELECT, nor); - EDBM_CallOpf(vc.em, op, "rotate verts=%hv cent=%v mat=%m3", + EDBM_op_callf(vc.em, op, "rotate verts=%hv cent=%v mat=%m3", BM_ELEM_SELECT, cent, mat); - EDBM_CallOpf(vc.em, op, "translate verts=%hv vec=%v", + EDBM_op_callf(vc.em, op, "translate verts=%hv vec=%v", BM_ELEM_SELECT, min); } else { @@ -857,14 +857,14 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); mul_m4_v3(vc.obedit->imat, min); // back in object space - EDBM_InitOpf(vc.em, &bmop, op, "makevert co=%v", min); + EDBM_op_init(vc.em, &bmop, op, "makevert co=%v", min); BMO_op_exec(vc.em->bm, &bmop); BMO_ITER(v1, &oiter, vc.em->bm, &bmop, "newvertout", BM_VERT) { BM_elem_select_set(vc.em->bm, v1, TRUE); } - if (!EDBM_FinishOp(vc.em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(vc.em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } } @@ -875,7 +875,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent /* This normally happens when pushing undo but modal operators * like this one don't push undo data until after modal mode is * done. */ - EDBM_RecalcNormals(vc.em); + EDBM_mesh_normals_update(vc.em); EDBM_update_generic(C, vc.em, TRUE); @@ -918,24 +918,24 @@ static int edbm_delete_exec(bContext *C, wmOperator *op) BMEditMesh *bem = BMEdit_FromObject(obedit); if (type == 0) { - if (!EDBM_CallOpf(bem, op, "del geom=%hv context=%i", BM_ELEM_SELECT, DEL_VERTS)) /* Erase Vertices */ + if (!EDBM_op_callf(bem, op, "del geom=%hv context=%i", BM_ELEM_SELECT, DEL_VERTS)) /* Erase Vertices */ return OPERATOR_CANCELLED; } else if (type == 1) { - if (!EDBM_CallOpf(bem, op, "del geom=%he context=%i", BM_ELEM_SELECT, DEL_EDGES)) /* Erase Edges */ + if (!EDBM_op_callf(bem, op, "del geom=%he context=%i", BM_ELEM_SELECT, DEL_EDGES)) /* Erase Edges */ return OPERATOR_CANCELLED; } else if (type == 2) { - if (!EDBM_CallOpf(bem, op, "del geom=%hf context=%i", BM_ELEM_SELECT, DEL_FACES)) /* Erase Faces */ + if (!EDBM_op_callf(bem, op, "del geom=%hf context=%i", BM_ELEM_SELECT, DEL_FACES)) /* Erase Faces */ return OPERATOR_CANCELLED; } else if (type == 3) { - if (!EDBM_CallOpf(bem, op, "del geom=%hef context=%i", BM_ELEM_SELECT, DEL_EDGESFACES)) /* Edges and Faces */ + if (!EDBM_op_callf(bem, op, "del geom=%hef context=%i", BM_ELEM_SELECT, DEL_EDGESFACES)) /* Edges and Faces */ return OPERATOR_CANCELLED; } else if (type == 4) { //"Erase Only Faces"; - if (!EDBM_CallOpf(bem, op, "del geom=%hf context=%i", + if (!EDBM_op_callf(bem, op, "del geom=%hf context=%i", BM_ELEM_SELECT, DEL_ONLYFACES)) return OPERATOR_CANCELLED; } @@ -972,7 +972,7 @@ static int edbm_collapse_edge_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - if (!EDBM_CallOpf(em, op, "collapse edges=%he", BM_ELEM_SELECT)) + if (!EDBM_op_callf(em, op, "collapse edges=%he", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; EDBM_update_generic(C, em, TRUE); @@ -1000,7 +1000,7 @@ static int edbm_collapse_edge_loop_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - if (!EDBM_CallOpf(em, op, "dissolve_edge_loop edges=%he", BM_ELEM_SELECT)) + if (!EDBM_op_callf(em, op, "dissolve_edge_loop edges=%he", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; EDBM_update_generic(C, em, TRUE); @@ -1029,13 +1029,13 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - if (!EDBM_InitOpf(em, &bmop, op, "contextual_create geom=%hfev", BM_ELEM_SELECT)) + if (!EDBM_op_init(em, &bmop, op, "contextual_create geom=%hfev", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; BMO_op_exec(em->bm, &bmop); BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE); - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -1177,12 +1177,12 @@ static int edbm_vert_connect(bContext *C, wmOperator *op) BMOperator bmop; int len = 0; - if (!EDBM_InitOpf(em, &bmop, op, "connectverts verts=%hv", BM_ELEM_SELECT)) { + if (!EDBM_op_init(em, &bmop, op, "connectverts verts=%hv", BM_ELEM_SELECT)) { return OPERATOR_CANCELLED; } BMO_op_exec(bm, &bmop); len = BMO_slot_get(&bmop, "edgeout")->len; - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -1213,12 +1213,12 @@ static int edbm_edge_split_exec(bContext *C, wmOperator *op) BMOperator bmop; int len = 0; - if (!EDBM_InitOpf(em, &bmop, op, "edgesplit edges=%he", BM_ELEM_SELECT)) { + if (!EDBM_op_init(em, &bmop, op, "edgesplit edges=%he", BM_ELEM_SELECT)) { return OPERATOR_CANCELLED; } BMO_op_exec(bm, &bmop); len = BMO_slot_get(&bmop, "edgeout")->len; - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -1249,14 +1249,14 @@ static int edbm_duplicate_exec(bContext *C, wmOperator *op) BMEditMesh *em = BMEdit_FromObject(ob); BMOperator bmop; - EDBM_InitOpf(em, &bmop, op, "dupe geom=%hvef", BM_ELEM_SELECT); + EDBM_op_init(em, &bmop, op, "dupe geom=%hvef", BM_ELEM_SELECT); BMO_op_exec(em->bm, &bmop); EDBM_flag_disable_all(em, BM_ELEM_SELECT); BMO_slot_buffer_hflag_enable(em->bm, &bmop, "newout", BM_ALL, BM_ELEM_SELECT, TRUE); - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -1296,7 +1296,7 @@ static int edbm_flip_normals_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - if (!EDBM_CallOpf(em, op, "reversefaces faces=%hf", BM_ELEM_SELECT)) + if (!EDBM_op_callf(em, op, "reversefaces faces=%hf", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; EDBM_update_generic(C, em, TRUE); @@ -1363,7 +1363,7 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - EDBM_InitOpf(em, &bmop, op, "edgerotate edges=%he ccw=%b", BM_ELEM_TAG, do_ccw); + EDBM_op_init(em, &bmop, op, "edgerotate edges=%he ccw=%b", BM_ELEM_TAG, do_ccw); /* avoids leaving old verts selected which can be a problem running multiple times, * since this means the edges become selected around the face which then attempt to rotate */ @@ -1375,7 +1375,7 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op) BMO_slot_buffer_hflag_enable(em->bm, &bmop, "edgeout", BM_EDGE, BM_ELEM_SELECT, TRUE); EDBM_selectmode_flush(em); - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -1408,7 +1408,7 @@ static int edbm_hide_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - EDBM_hide_mesh(em, RNA_boolean_get(op->ptr, "unselected")); + EDBM_mesh_hide(em, RNA_boolean_get(op->ptr, "unselected")); EDBM_update_generic(C, em, TRUE); @@ -1438,7 +1438,7 @@ static int edbm_reveal_exec(bContext *C, wmOperator *UNUSED(op)) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - EDBM_reveal_mesh(em); + EDBM_mesh_reveal(em); EDBM_update_generic(C, em, TRUE); @@ -1467,11 +1467,11 @@ static int edbm_normals_make_consistent_exec(bContext *C, wmOperator *op) /* doflip has to do with bmesh_rationalize_normals, it's an internal * thing */ - if (!EDBM_CallOpf(em, op, "righthandfaces faces=%hf do_flip=%b", BM_ELEM_SELECT, TRUE)) + if (!EDBM_op_callf(em, op, "righthandfaces faces=%hf do_flip=%b", BM_ELEM_SELECT, TRUE)) return OPERATOR_CANCELLED; if (RNA_boolean_get(op->ptr, "inside")) - EDBM_CallOpf(em, op, "reversefaces faces=%hf", BM_ELEM_SELECT); + EDBM_op_callf(em, op, "reversefaces faces=%hf", BM_ELEM_SELECT); EDBM_update_generic(C, em, TRUE); @@ -1508,7 +1508,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op) /* mirror before smooth */ if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) { - EDBM_CacheMirrorVerts(em, TRUE); + EDBM_verts_mirror_cache_begin(em, TRUE); } /* if there is a mirror modifier with clipping, flag the verts that @@ -1536,7 +1536,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op) repeat = 1; for (i = 0; i < repeat; i++) { - if (!EDBM_CallOpf(em, op, + if (!EDBM_op_callf(em, op, "vertexsmooth verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clipdist=%f", BM_ELEM_SELECT, mirrx, mirry, mirrz, clipdist)) { @@ -1546,8 +1546,8 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op) /* apply mirror */ if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) { - EDBM_ApplyMirrorCache(em, BM_ELEM_SELECT, 0); - EDBM_EndMirrorCache(em); + EDBM_verts_mirror_apply(em, BM_ELEM_SELECT, 0); + EDBM_verts_mirror_cache_end(em); } EDBM_update_generic(C, em, TRUE); @@ -1655,13 +1655,13 @@ static int edbm_rotate_uvs_exec(bContext *C, wmOperator *op) int dir = RNA_enum_get(op->ptr, "direction"); /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "face_rotateuvs faces=%hf dir=%i", BM_ELEM_SELECT, dir); + EDBM_op_init(em, &bmop, op, "face_rotateuvs faces=%hf dir=%i", BM_ELEM_SELECT, dir); /* execute the operator */ BMO_op_exec(em->bm, &bmop); /* finish the operator */ - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -1678,13 +1678,13 @@ static int edbm_reverse_uvs_exec(bContext *C, wmOperator *op) BMOperator bmop; /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "face_reverseuvs faces=%hf", BM_ELEM_SELECT); + EDBM_op_init(em, &bmop, op, "face_reverseuvs faces=%hf", BM_ELEM_SELECT); /* execute the operator */ BMO_op_exec(em->bm, &bmop); /* finish the operator */ - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -1704,13 +1704,13 @@ static int edbm_rotate_colors_exec(bContext *C, wmOperator *op) int dir = RNA_enum_get(op->ptr, "direction"); /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "face_rotatecolors faces=%hf dir=%i", BM_ELEM_SELECT, dir); + EDBM_op_init(em, &bmop, op, "face_rotatecolors faces=%hf dir=%i", BM_ELEM_SELECT, dir); /* execute the operator */ BMO_op_exec(em->bm, &bmop); /* finish the operator */ - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -1729,13 +1729,13 @@ static int edbm_reverse_colors_exec(bContext *C, wmOperator *op) BMOperator bmop; /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "face_reversecolors faces=%hf", BM_ELEM_SELECT); + EDBM_op_init(em, &bmop, op, "face_reversecolors faces=%hf", BM_ELEM_SELECT); /* execute the operator */ BMO_op_exec(em->bm, &bmop); /* finish the operator */ - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -1834,11 +1834,11 @@ static int merge_firstlast(BMEditMesh *em, int first, int uvmerge, wmOperator *w return OPERATOR_CANCELLED; if (uvmerge) { - if (!EDBM_CallOpf(em, wmop, "pointmerge_facedata verts=%hv snapv=%e", BM_ELEM_SELECT, mergevert)) + if (!EDBM_op_callf(em, wmop, "pointmerge_facedata verts=%hv snapv=%e", BM_ELEM_SELECT, mergevert)) return OPERATOR_CANCELLED; } - if (!EDBM_CallOpf(em, wmop, "pointmerge verts=%hv mergeco=%v", BM_ELEM_SELECT, mergevert->co)) + if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv mergeco=%v", BM_ELEM_SELECT, mergevert->co)) return OPERATOR_CANCELLED; return OPERATOR_FINISHED; @@ -1879,11 +1879,11 @@ static int merge_target(BMEditMesh *em, Scene *scene, View3D *v3d, Object *ob, return OPERATOR_CANCELLED; if (uvmerge) { - if (!EDBM_CallOpf(em, wmop, "vert_average_facedata verts=%hv", BM_ELEM_SELECT)) + if (!EDBM_op_callf(em, wmop, "vert_average_facedata verts=%hv", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; } - if (!EDBM_CallOpf(em, wmop, "pointmerge verts=%hv mergeco=%v", BM_ELEM_SELECT, co)) + if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv mergeco=%v", BM_ELEM_SELECT, co)) return OPERATOR_CANCELLED; return OPERATOR_FINISHED; @@ -1912,7 +1912,7 @@ static int edbm_merge_exec(bContext *C, wmOperator *op) break; case 5: status = 1; - if (!EDBM_CallOpf(em, op, "collapse edges=%he", BM_ELEM_SELECT)) + if (!EDBM_op_callf(em, op, "collapse edges=%he", BM_ELEM_SELECT)) status = 0; break; } @@ -2003,17 +2003,17 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op) BMOperator bmop; int count; - EDBM_InitOpf(em, &bmop, op, "finddoubles verts=%hv dist=%f", BM_ELEM_SELECT, RNA_float_get(op->ptr, "mergedist")); + EDBM_op_init(em, &bmop, op, "finddoubles verts=%hv dist=%f", BM_ELEM_SELECT, RNA_float_get(op->ptr, "mergedist")); BMO_op_exec(em->bm, &bmop); count = BMO_slot_map_count(em->bm, &bmop, "targetmapout"); - if (!EDBM_CallOpf(em, op, "weldverts targetmap=%s", &bmop, "targetmapout")) { + if (!EDBM_op_callf(em, op, "weldverts targetmap=%s", &bmop, "targetmapout")) { BMO_op_finish(em->bm, &bmop); return OPERATOR_CANCELLED; } - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -2079,7 +2079,7 @@ static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "vertexshortestpath startv=%e endv=%e type=%i", sv->ele, ev->ele, type); + EDBM_op_init(em, &bmop, op, "vertexshortestpath startv=%e endv=%e type=%i", sv->ele, ev->ele, type); /* execute the operator */ BMO_op_exec(em->bm, &bmop); @@ -2091,7 +2091,7 @@ static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op) BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE); /* finish the operator */ - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -2182,7 +2182,7 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) singlesel = TRUE; /* find selected vert - same some time and check history first */ - if (EDBM_get_actSelection(em, &ese) && ese.htype == BM_VERT) { + if (EDBM_editselection_active_get(em, &ese) && ese.htype == BM_VERT) { v = (BMVert *)ese.ele; } else { @@ -2262,7 +2262,7 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) } } - if (!EDBM_InitOpf(em, &bmop, op, "edgesplit edges=%he verts=%hv use_verts=%b", + if (!EDBM_op_init(em, &bmop, op, "edgesplit edges=%he verts=%hv use_verts=%b", BM_ELEM_TAG, BM_ELEM_SELECT, TRUE)) { return OPERATOR_CANCELLED; } @@ -2361,7 +2361,7 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) BLI_assert(singlesel ? (bm->totvertsel > 0) : (bm->totedgesel > 0)); - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -2649,7 +2649,7 @@ static int edbm_solidify_exec(bContext *C, wmOperator *op) float thickness = RNA_float_get(op->ptr, "thickness"); - if (!EDBM_InitOpf(em, &bmop, op, "solidify geom=%hf thickness=%f", BM_ELEM_SELECT, thickness)) { + if (!EDBM_op_init(em, &bmop, op, "solidify geom=%hf thickness=%f", BM_ELEM_SELECT, thickness)) { return OPERATOR_CANCELLED; } @@ -2664,7 +2664,7 @@ static int edbm_solidify_exec(bContext *C, wmOperator *op) /* select the newly generated faces */ BMO_slot_buffer_hflag_enable(bm, &bmop, "geomout", BM_FACE, BM_ELEM_SELECT, TRUE); - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -2946,7 +2946,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) BLI_ghash_insert(gh, bv, scr); } - if (!EDBM_InitOpf(em, &bmop, op, "esubd")) { + if (!EDBM_op_init(em, &bmop, op, "esubd")) { return OPERATOR_CANCELLED; } @@ -2986,7 +2986,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) BMO_slot_float_set(&bmop, "radius", 0); BMO_op_exec(bm, &bmop); - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -3052,8 +3052,8 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO ED_base_object_select(basenew, BA_DESELECT); - EDBM_CallOpf(em, wmop, "dupe geom=%hvef dest=%p", BM_ELEM_SELECT, bm_new); - EDBM_CallOpf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_FACES); + EDBM_op_callf(em, wmop, "dupe geom=%hvef dest=%p", BM_ELEM_SELECT, bm_new); + EDBM_op_callf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_FACES); /* clean up any loose edges */ BM_ITER(e, &iter, em->bm, BM_EDGES_OF_MESH, NULL) { @@ -3064,7 +3064,7 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO BM_elem_select_set(em->bm, e, FALSE); } } - EDBM_CallOpf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_EDGES); + EDBM_op_callf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_EDGES); /* clean up any loose verts */ BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) { @@ -3076,7 +3076,7 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO } } - EDBM_CallOpf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_VERTS); + EDBM_op_callf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_VERTS); BM_mesh_normals_update(bm_new, TRUE); BMO_op_callf(bm_new, "bmesh_to_mesh mesh=%p object=%p notessellation=%b", @@ -3226,7 +3226,7 @@ static int edbm_fill_exec(bContext *C, wmOperator *op) BMEditMesh *em = BMEdit_FromObject(obedit); BMOperator bmop; - if (!EDBM_InitOpf(em, &bmop, op, "triangle_fill edges=%he", BM_ELEM_SELECT)) { + if (!EDBM_op_init(em, &bmop, op, "triangle_fill edges=%he", BM_ELEM_SELECT)) { return OPERATOR_CANCELLED; } @@ -3235,7 +3235,7 @@ static int edbm_fill_exec(bContext *C, wmOperator *op) /* select new geometry */ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_FACE | BM_EDGE, BM_ELEM_SELECT, TRUE); - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -3264,7 +3264,7 @@ static int edbm_beautify_fill_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - if (!EDBM_CallOpf(em, op, "beautify_fill faces=%hf", BM_ELEM_SELECT)) + if (!EDBM_op_callf(em, op, "beautify_fill faces=%hf", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; EDBM_update_generic(C, em, TRUE); @@ -3294,7 +3294,7 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op) BMEditMesh *em = BMEdit_FromObject(obedit); int use_beauty = RNA_boolean_get(op->ptr, "use_beauty"); - if (!EDBM_CallOpf(em, op, "triangulate faces=%hf use_beauty=%b", BM_ELEM_SELECT, use_beauty)) + if (!EDBM_op_callf(em, op, "triangulate faces=%hf use_beauty=%b", BM_ELEM_SELECT, use_beauty)) return OPERATOR_CANCELLED; EDBM_update_generic(C, em, TRUE); @@ -3330,7 +3330,7 @@ static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op) dovcols = RNA_boolean_get(op->ptr, "vcols"); domaterials = RNA_boolean_get(op->ptr, "materials"); - if (!EDBM_CallOpf(em, op, + if (!EDBM_op_callf(em, op, "join_triangles faces=%hf limit=%f cmp_sharp=%b cmp_uvs=%b cmp_vcols=%b cmp_materials=%b", BM_ELEM_SELECT, limit, dosharp, douvs, dovcols, domaterials)) { @@ -3375,15 +3375,15 @@ static int edbm_dissolve_exec(bContext *C, wmOperator *op) int use_verts = RNA_boolean_get(op->ptr, "use_verts"); if (em->selectmode & SCE_SELECT_FACE) { - if (!EDBM_CallOpf(em, op, "dissolve_faces faces=%hf use_verts=%b", BM_ELEM_SELECT, use_verts)) + if (!EDBM_op_callf(em, op, "dissolve_faces faces=%hf use_verts=%b", BM_ELEM_SELECT, use_verts)) return OPERATOR_CANCELLED; } else if (em->selectmode & SCE_SELECT_EDGE) { - if (!EDBM_CallOpf(em, op, "dissolve_edges edges=%he use_verts=%b", BM_ELEM_SELECT, use_verts)) + if (!EDBM_op_callf(em, op, "dissolve_edges edges=%he use_verts=%b", BM_ELEM_SELECT, use_verts)) return OPERATOR_CANCELLED; } else if (em->selectmode & SCE_SELECT_VERTEX) { - if (!EDBM_CallOpf(em, op, "dissolve_verts verts=%hv", BM_ELEM_SELECT)) + if (!EDBM_op_callf(em, op, "dissolve_verts verts=%hv", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; } @@ -3417,7 +3417,7 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op) BMEditMesh *em = BMEdit_FromObject(obedit); float angle_limit = RNA_float_get(op->ptr, "angle_limit"); - if (!EDBM_CallOpf(em, op, + if (!EDBM_op_callf(em, op, "dissolve_limit edges=%he verts=%hv angle_limit=%f", BM_ELEM_SELECT, BM_ELEM_SELECT, angle_limit)) { @@ -3456,16 +3456,16 @@ static int edbm_split_exec(bContext *C, wmOperator *op) BMEditMesh *em = BMEdit_FromObject(ob); BMOperator bmop; - EDBM_InitOpf(em, &bmop, op, "split geom=%hvef use_only_faces=%b", BM_ELEM_SELECT, FALSE); + EDBM_op_init(em, &bmop, op, "split geom=%hvef use_only_faces=%b", BM_ELEM_SELECT, FALSE); BMO_op_exec(em->bm, &bmop); BM_mesh_elem_flag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT); BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ALL, BM_ELEM_SELECT, TRUE); - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } /* Geometry has changed, need to recalc normals and looptris */ - EDBM_RecalcNormals(em); + EDBM_mesh_normals_update(em); EDBM_update_generic(C, em, TRUE); @@ -3512,7 +3512,7 @@ static int edbm_spin_exec(bContext *C, wmOperator *op) mul_m3_v3(imat, cent); mul_m3_v3(imat, axis); - if (!EDBM_InitOpf(em, &spinop, op, + if (!EDBM_op_init(em, &spinop, op, "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i ang=%f do_dupli=%b", BM_ELEM_SELECT, cent, axis, d, steps, degr, dupli)) { @@ -3521,7 +3521,7 @@ static int edbm_spin_exec(bContext *C, wmOperator *op) BMO_op_exec(bm, &spinop); EDBM_flag_disable_all(em, BM_ELEM_SELECT); BMO_slot_buffer_hflag_enable(bm, &spinop, "lastout", BM_ALL, BM_ELEM_SELECT, TRUE); - if (!EDBM_FinishOp(em, &spinop, op, TRUE)) { + if (!EDBM_op_finish(em, &spinop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -3635,7 +3635,7 @@ static int edbm_screw_exec(bContext *C, wmOperator *op) if (dot_v3v3(nor, dvec) > 0.000f) negate_v3(dvec); - if (!EDBM_InitOpf(em, &spinop, op, + if (!EDBM_op_init(em, &spinop, op, "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i ang=%f do_dupli=%b", BM_ELEM_SELECT, cent, axis, dvec, turns * steps, 360.0f * turns, FALSE)) { @@ -3644,7 +3644,7 @@ static int edbm_screw_exec(bContext *C, wmOperator *op) BMO_op_exec(bm, &spinop); EDBM_flag_disable_all(em, BM_ELEM_SELECT); BMO_slot_buffer_hflag_enable(bm, &spinop, "lastout", BM_ALL, BM_ELEM_SELECT, TRUE); - if (!EDBM_FinishOp(em, &spinop, op, TRUE)) { + if (!EDBM_op_finish(em, &spinop, op, TRUE)) { return OPERATOR_CANCELLED; } @@ -4265,7 +4265,7 @@ static int edbm_noise_exec(bContext *C, wmOperator *op) } } - EDBM_RecalcNormals(em); + EDBM_mesh_normals_update(em); EDBM_update_generic(C, em, TRUE); @@ -4337,7 +4337,7 @@ static int edbm_bevel_exec(bContext *C, wmOperator *op) for (i = 0; i < recursion; i++) { float fac = w[recursion - i - 1] * factor; - if (!EDBM_InitOpf(em, &bmop, op, + if (!EDBM_op_init(em, &bmop, op, "bevel geom=%hev percent=%f lengthlayer=%i use_lengths=%b use_even=%b use_dist=%b", BM_ELEM_SELECT, fac, li, TRUE, use_even, use_dist)) { @@ -4345,7 +4345,7 @@ static int edbm_bevel_exec(bContext *C, wmOperator *op) } BMO_op_exec(em->bm, &bmop); - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) + if (!EDBM_op_finish(em, &bmop, op, TRUE)) return OPERATOR_CANCELLED; } @@ -4353,7 +4353,7 @@ static int edbm_bevel_exec(bContext *C, wmOperator *op) MEM_freeN(w); - EDBM_RecalcNormals(em); + EDBM_mesh_normals_update(em); EDBM_update_generic(C, em, TRUE); @@ -4387,7 +4387,7 @@ static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - if (!EDBM_CallOpf(em, op, "bridge_loops edges=%he", BM_ELEM_SELECT)) + if (!EDBM_op_callf(em, op, "bridge_loops edges=%he", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; EDBM_update_generic(C, em, TRUE); @@ -4425,7 +4425,7 @@ static int edbm_inset_exec(bContext *C, wmOperator *op) const float thickness = RNA_float_get(op->ptr, "thickness"); const int use_outset = RNA_boolean_get(op->ptr, "use_outset"); - EDBM_InitOpf(em, &bmop, op, + EDBM_op_init(em, &bmop, op, "inset faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b thickness=%f use_outset=%b", BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, thickness, use_outset); @@ -4436,7 +4436,7 @@ static int edbm_inset_exec(bContext *C, wmOperator *op) BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE); - if (!EDBM_FinishOp(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { return OPERATOR_CANCELLED; } else { diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 5d2bb359d3c..22420c50e2f 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -56,12 +56,14 @@ #include "bmesh.h" -void EDBM_RecalcNormals(BMEditMesh *em) +#include "mesh_intern.h" + +void EDBM_mesh_normals_update(BMEditMesh *em) { BM_mesh_normals_update(em->bm, TRUE); } -void EDBM_ClearMesh(BMEditMesh *em) +void EDBM_mesh_clear(BMEditMesh *em) { /* clear bmesh */ BM_mesh_clear(em->bm); @@ -111,7 +113,7 @@ void EDBM_stats_update(BMEditMesh *em) } } -int EDBM_InitOpf(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const char *fmt, ...) +int EDBM_op_init(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const char *fmt, ...) { BMesh *bm = em->bm; va_list list; @@ -135,7 +137,7 @@ int EDBM_InitOpf(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const char *f /* returns 0 on error, 1 on success. executes and finishes a bmesh operator */ -int EDBM_FinishOp(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const int report) +int EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const int report) { const char *errmsg; @@ -170,7 +172,7 @@ int EDBM_FinishOp(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const int re return 1; } -int EDBM_CallOpf(BMEditMesh *em, wmOperator *op, const char *fmt, ...) +int EDBM_op_callf(BMEditMesh *em, wmOperator *op, const char *fmt, ...) { BMesh *bm = em->bm; BMOperator bmop; @@ -191,10 +193,10 @@ int EDBM_CallOpf(BMEditMesh *em, wmOperator *op, const char *fmt, ...) BMO_op_exec(bm, &bmop); va_end(list); - return EDBM_FinishOp(em, &bmop, op, TRUE); + return EDBM_op_finish(em, &bmop, op, TRUE); } -int EDBM_CallAndSelectOpf(BMEditMesh *em, wmOperator *op, const char *selectslot, const char *fmt, ...) +int EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *selectslot, const char *fmt, ...) { BMesh *bm = em->bm; BMOperator bmop; @@ -219,10 +221,10 @@ int EDBM_CallAndSelectOpf(BMEditMesh *em, wmOperator *op, const char *selectslot BMO_slot_buffer_hflag_enable(em->bm, &bmop, selectslot, BM_ALL, BM_ELEM_SELECT, TRUE); va_end(list); - return EDBM_FinishOp(em, &bmop, op, TRUE); + return EDBM_op_finish(em, &bmop, op, TRUE); } -int EDBM_CallOpfSilent(BMEditMesh *em, const char *fmt, ...) +int EDBM_op_call_silentf(BMEditMesh *em, const char *fmt, ...) { BMesh *bm = em->bm; BMOperator bmop; @@ -242,7 +244,7 @@ int EDBM_CallOpfSilent(BMEditMesh *em, const char *fmt, ...) BMO_op_exec(bm, &bmop); va_end(list); - return EDBM_FinishOp(em, &bmop, NULL, FALSE); + return EDBM_op_finish(em, &bmop, NULL, FALSE); } void EDBM_selectmode_to_scene(bContext *C) @@ -260,7 +262,7 @@ void EDBM_selectmode_to_scene(bContext *C) WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, scene); } -void EDBM_MakeEditBMesh(ToolSettings *ts, Scene *UNUSED(scene), Object *ob) +void EDBM_mesh_make(ToolSettings *ts, Scene *UNUSED(scene), Object *ob) { Mesh *me = ob->data; BMesh *bm; @@ -290,7 +292,7 @@ void EDBM_MakeEditBMesh(ToolSettings *ts, Scene *UNUSED(scene), Object *ob) me->edit_btmesh->ob = ob; } -void EDBM_LoadEditBMesh(Scene *scene, Object *ob) +void EDBM_mesh_load(Scene *scene, Object *ob) { Mesh *me = ob->data; BMesh *bm = me->edit_btmesh->bm; @@ -303,14 +305,14 @@ void EDBM_LoadEditBMesh(Scene *scene, Object *ob) } -void EDBM_FreeEditBMesh(BMEditMesh *tm) +void EDBM_mesh_free(BMEditMesh *tm) { BMEdit_Free(tm); } -void EDBM_init_index_arrays(BMEditMesh *tm, int forvert, int foredge, int forface) +void EDBM_index_arrays_init(BMEditMesh *tm, int forvert, int foredge, int forface) { - EDBM_free_index_arrays(tm); + EDBM_index_arrays_free(tm); if (forvert) { BMIter iter; @@ -352,7 +354,7 @@ void EDBM_init_index_arrays(BMEditMesh *tm, int forvert, int foredge, int forfac } } -void EDBM_free_index_arrays(BMEditMesh *tm) +void EDBM_index_arrays_free(BMEditMesh *tm) { if (tm->vert_index) { MEM_freeN(tm->vert_index); @@ -370,17 +372,17 @@ void EDBM_free_index_arrays(BMEditMesh *tm) } } -BMVert *EDBM_get_vert_for_index(BMEditMesh *tm, int index) +BMVert *EDBM_vert_at_index(BMEditMesh *tm, int index) { return tm->vert_index && index < tm->bm->totvert ? tm->vert_index[index] : NULL; } -BMEdge *EDBM_get_edge_for_index(BMEditMesh *tm, int index) +BMEdge *EDBM_edge_at_index(BMEditMesh *tm, int index) { return tm->edge_index && index < tm->bm->totedge ? tm->edge_index[index] : NULL; } -BMFace *EDBM_get_face_for_index(BMEditMesh *tm, int index) +BMFace *EDBM_face_at_index(BMEditMesh *tm, int index) { return (tm->face_index && index < tm->bm->totface && index >= 0) ? tm->face_index[index] : NULL; } @@ -444,7 +446,7 @@ void EDBM_select_less(BMEditMesh *em) EDBM_selectmode_flush(em); } -int EDBM_get_actSelection(BMEditMesh *em, BMEditSelection *ese) +int EDBM_editselection_active_get(BMEditMesh *em, BMEditSelection *ese) { BMEditSelection *ese_last = em->bm->selected.last; BMFace *efa = BM_active_face_get(em->bm, FALSE); @@ -577,7 +579,7 @@ void undo_push_mesh(bContext *C, const char *name) } /* write comment here */ -UvVertMap *EDBM_make_uv_vert_map(BMEditMesh *em, int selected, int do_face_idx_array, float *limit) +UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx_array, float *limit) { BMVert *ev; BMFace *efa; @@ -592,7 +594,7 @@ UvVertMap *EDBM_make_uv_vert_map(BMEditMesh *em, int selected, int do_face_idx_a int totverts, i, totuv; if (do_face_idx_array) - EDBM_init_index_arrays(em, 0, 0, 1); + EDBM_index_arrays_init(em, 0, 0, 1); BM_mesh_elem_index_ensure(em->bm, BM_VERT); @@ -607,13 +609,13 @@ UvVertMap *EDBM_make_uv_vert_map(BMEditMesh *em, int selected, int do_face_idx_a if (totuv == 0) { if (do_face_idx_array) - EDBM_free_index_arrays(em); + EDBM_index_arrays_free(em); return NULL; } vmap = (UvVertMap *)MEM_callocN(sizeof(*vmap), "UvVertMap"); if (!vmap) { if (do_face_idx_array) - EDBM_free_index_arrays(em); + EDBM_index_arrays_free(em); return NULL; } @@ -623,7 +625,7 @@ UvVertMap *EDBM_make_uv_vert_map(BMEditMesh *em, int selected, int do_face_idx_a if (!vmap->vert || !vmap->buf) { free_uv_vert_map(vmap); if (do_face_idx_array) - EDBM_free_index_arrays(em); + EDBM_index_arrays_free(em); return NULL; } @@ -660,7 +662,7 @@ UvVertMap *EDBM_make_uv_vert_map(BMEditMesh *em, int selected, int do_face_idx_a v->next = newvlist; newvlist = v; - efa = EDBM_get_face_for_index(em, v->f); + efa = EDBM_face_at_index(em, v->f); /* tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */ l = BM_iter_at_index(em->bm, BM_LOOPS_OF_FACE, efa, v->tfindex); @@ -672,7 +674,7 @@ UvVertMap *EDBM_make_uv_vert_map(BMEditMesh *em, int selected, int do_face_idx_a while (iterv) { next = iterv->next; - efa = EDBM_get_face_for_index(em, iterv->f); + efa = EDBM_face_at_index(em, iterv->f); /* tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */ l = BM_iter_at_index(em->bm, BM_LOOPS_OF_FACE, efa, iterv->tfindex); @@ -702,13 +704,13 @@ UvVertMap *EDBM_make_uv_vert_map(BMEditMesh *em, int selected, int do_face_idx_a } if (do_face_idx_array) - EDBM_free_index_arrays(em); + EDBM_index_arrays_free(em); return vmap; } -UvMapVert *EDBM_get_uv_map_vert(UvVertMap *vmap, unsigned int v) +UvMapVert *EDBM_uv_vert_map_at_index(UvVertMap *vmap, unsigned int v) { return vmap->vert[v]; } @@ -717,7 +719,7 @@ UvMapVert *EDBM_get_uv_map_vert(UvVertMap *vmap, unsigned int v) /* A specialized vert map used by stitch operator */ -UvElementMap *EDBM_make_uv_element_map(BMEditMesh *em, int selected, int do_islands) +UvElementMap *EDBM_uv_element_map_create(BMEditMesh *em, int selected, int do_islands) { BMVert *ev; BMFace *efa; @@ -767,7 +769,7 @@ UvElementMap *EDBM_make_uv_element_map(BMEditMesh *em, int selected, int do_isla buf = element_map->buf = (UvElement *)MEM_callocN(sizeof(*element_map->buf) * totuv, "UvElement"); if (!element_map->vert || !element_map->buf) { - EDBM_free_uv_element_map(element_map); + EDBM_uv_element_map_free(element_map); MEM_freeN(island_number); return NULL; } @@ -906,7 +908,7 @@ UvElementMap *EDBM_make_uv_element_map(BMEditMesh *em, int selected, int do_isla MEM_freeN(islandbuf); MEM_freeN(stack); MEM_freeN(map); - EDBM_free_uv_element_map(element_map); + EDBM_uv_element_map_free(element_map); MEM_freeN(island_number); } @@ -936,13 +938,7 @@ UvElementMap *EDBM_make_uv_element_map(BMEditMesh *em, int selected, int do_isla return element_map; } - -UvMapVert *EM_get_uv_map_vert(UvVertMap *vmap, unsigned int v) -{ - return vmap->vert[v]; -} - -void EDBM_free_uv_vert_map(UvVertMap *vmap) +void EDBM_uv_vert_map_free(UvVertMap *vmap) { if (vmap) { if (vmap->vert) MEM_freeN(vmap->vert); @@ -951,7 +947,7 @@ void EDBM_free_uv_vert_map(UvVertMap *vmap) } } -void EDBM_free_uv_element_map(UvElementMap *element_map) +void EDBM_uv_element_map_free(UvElementMap *element_map) { if (element_map) { if (element_map->vert) MEM_freeN(element_map->vert); @@ -963,11 +959,11 @@ void EDBM_free_uv_element_map(UvElementMap *element_map) /* last_sel, use em->act_face otherwise get the last selected face in the editselections * at the moment, last_sel is mainly useful for making sure the space image dosnt flicker */ -MTexPoly *EDBM_get_active_mtexpoly(BMEditMesh *em, BMFace **r_act_efa, int sloppy) +MTexPoly *EDBM_mtexpoly_active_get(BMEditMesh *em, BMFace **r_act_efa, int sloppy) { BMFace *efa = NULL; - if (!EDBM_texFaceCheck(em)) + if (!EDBM_mtexpoly_check(em)) return NULL; efa = BM_active_face_get(em->bm, sloppy); @@ -982,14 +978,14 @@ MTexPoly *EDBM_get_active_mtexpoly(BMEditMesh *em, BMFace **r_act_efa, int slopp } /* can we edit UV's for this mesh?*/ -int EDBM_texFaceCheck(BMEditMesh *em) +int EDBM_mtexpoly_check(BMEditMesh *em) { /* some of these checks could be a touch overkill */ return em && em->bm->totface && CustomData_has_layer(&em->bm->pdata, CD_MTEXPOLY) && CustomData_has_layer(&em->bm->ldata, CD_MLOOPUV); } -int EDBM_vertColorCheck(BMEditMesh *em) +int EDBM_vert_color_check(BMEditMesh *em) { /* some of these checks could be a touch overkill */ return em && em->bm->totface && CustomData_has_layer(&em->bm->ldata, CD_MLOOPCOL); @@ -1001,11 +997,31 @@ static BMVert *cache_mirr_intptr_as_bmvert(intptr_t *index_lookup, int index) return (eve_i == -1) ? NULL : (BMVert *)eve_i; } +/** + * [note: I've decided to use ideasman's code for non-editmode stuff, but since + * it has a big "not for editmode!" disclaimer, I'm going to keep what I have here + * - joeedh] + * + * x-mirror editing api. usage: + * + * EDBM_verts_mirror_cache_begin(em); + * ... + * ... + * BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) { + * mirrorv = EDBM_verts_mirror_get(em, v); + * } + * ... + * ... + * EDBM_verts_mirror_cache_end(em); + * + * \note why do we only allow x axis mirror editing? + */ + /* BM_SEARCH_MAXDIST is too big, copied from 2.6x MOC_THRESH, should become a * preference */ #define BM_SEARCH_MAXDIST_MIRR 0.00002f #define BM_CD_LAYER_ID "__mirror_index" -void EDBM_CacheMirrorVerts(BMEditMesh *em, const short use_select) +void EDBM_verts_mirror_cache_begin(BMEditMesh *em, const short use_select) { Mesh *me = em->me; BMesh *bm = em->bm; @@ -1022,7 +1038,7 @@ void EDBM_CacheMirrorVerts(BMEditMesh *em, const short use_select) } if (!em->vert_index) { - EDBM_init_index_arrays(em, 1, 0, 0); + EDBM_index_arrays_init(em, 1, 0, 0); em->mirr_free_arrays = 1; } @@ -1084,7 +1100,7 @@ void EDBM_CacheMirrorVerts(BMEditMesh *em, const short use_select) em->mirror_cdlayer = li; } -BMVert *EDBM_GetMirrorVert(BMEditMesh *em, BMVert *v) +BMVert *EDBM_verts_mirror_get(BMEditMesh *em, BMVert *v) { int *mirr = CustomData_bmesh_get_layer_n(&em->bm->vdata, v->head.data, em->mirror_cdlayer); @@ -1093,7 +1109,7 @@ BMVert *EDBM_GetMirrorVert(BMEditMesh *em, BMVert *v) if (mirr && *mirr >= 0 && *mirr < em->bm->totvert) { if (!em->vert_index) { printf("err: should only be called between " - "EDBM_CacheMirrorVerts and EDBM_EndMirrorCache"); + "EDBM_verts_mirror_cache_begin and EDBM_verts_mirror_cache_end"); return NULL; } @@ -1103,7 +1119,7 @@ BMVert *EDBM_GetMirrorVert(BMEditMesh *em, BMVert *v) return NULL; } -void EDBM_ClearMirrorVert(BMEditMesh *em, BMVert *v) +void EDBM_verts_mirror_cache_clear(BMEditMesh *em, BMVert *v) { int *mirr = CustomData_bmesh_get_layer_n(&em->bm->vdata, v->head.data, em->mirror_cdlayer); @@ -1114,7 +1130,7 @@ void EDBM_ClearMirrorVert(BMEditMesh *em, BMVert *v) } } -void EDBM_EndMirrorCache(BMEditMesh *em) +void EDBM_verts_mirror_cache_end(BMEditMesh *em) { if (em->mirr_free_arrays) { MEM_freeN(em->vert_index); @@ -1124,7 +1140,7 @@ void EDBM_EndMirrorCache(BMEditMesh *em) em->mirror_cdlayer = -1; } -void EDBM_ApplyMirrorCache(BMEditMesh *em, const int sel_from, const int sel_to) +void EDBM_verts_mirror_apply(BMEditMesh *em, const int sel_from, const int sel_to) { BMIter iter; BMVert *v; @@ -1133,7 +1149,7 @@ void EDBM_ApplyMirrorCache(BMEditMesh *em, const int sel_from, const int sel_to) BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) { if (BM_elem_flag_test(v, BM_ELEM_SELECT) == sel_from) { - BMVert *mirr = EDBM_GetMirrorVert(em, v); + BMVert *mirr = EDBM_verts_mirror_get(em, v); if (mirr) { if (BM_elem_flag_test(mirr, BM_ELEM_SELECT) == sel_to) { copy_v3_v3(mirr->co, v->co); @@ -1146,7 +1162,7 @@ void EDBM_ApplyMirrorCache(BMEditMesh *em, const int sel_from, const int sel_to) /* swap is 0 or 1, if 1 it hides not selected */ -void EDBM_hide_mesh(BMEditMesh *em, int swap) +void EDBM_mesh_hide(BMEditMesh *em, int swap) { BMIter iter; BMElem *ele; @@ -1178,7 +1194,7 @@ void EDBM_hide_mesh(BMEditMesh *em, int swap) } -void EDBM_reveal_mesh(BMEditMesh *em) +void EDBM_mesh_reveal(BMEditMesh *em) { const char iter_types[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, @@ -1257,17 +1273,17 @@ void EDBM_editselection_plane(BMEditMesh *em, float *plane, BMEditSelection *ese BM_editselection_plane(em->bm, plane, ese); } -void EDBM_remove_selection(BMEditMesh *em, BMElem *ele) +void EDBM_editselection_remove(BMEditMesh *em, BMHeader *ele) { - BM_select_history_remove(em->bm, ele); + BM_select_history_remove(em->bm, (BMElem *)ele); } -void EDBM_store_selection(BMEditMesh *em, BMElem *ele) +void EDBM_editselection_store(BMEditMesh *em, BMHeader *ele) { - BM_select_history_store(em->bm, ele); + BM_select_history_store(em->bm, (BMElem *)ele); } -void EDBM_validate_selections(BMEditMesh *em) +void EDBM_editselection_validate(BMEditMesh *em) { BM_select_history_validate(em->bm); } diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index fe3fe698626..2ea5ac800ce 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -604,7 +604,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event) obedit = base->object; me = obedit->data; if (me->edit_btmesh == NULL) { - EDBM_MakeEditBMesh(scene->toolsettings, scene, obedit); + EDBM_mesh_make(scene->toolsettings, scene, obedit); exitmode = 1; } if (me->edit_btmesh == NULL) @@ -613,8 +613,8 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event) ED_uvedit_assign_image(bmain, scene, obedit, ima, NULL); if (exitmode) { - EDBM_LoadEditBMesh(scene, obedit); - EDBM_FreeEditBMesh(me->edit_btmesh); + EDBM_mesh_load(scene, obedit); + EDBM_mesh_free(me->edit_btmesh); MEM_freeN(me->edit_btmesh); me->edit_btmesh = NULL; diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 4f94294e6c6..59d7b24f7b8 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -35,18 +35,19 @@ #ifndef __MESH_INTERN_H__ #define __MESH_INTERN_H__ -struct bContext; -struct wmOperatorType; -struct ViewContext; -struct BMEditMesh; -struct BMesh; struct BMEdge; +struct BMEditMesh; struct BMFace; +struct BMHeader; struct BMOperator; -struct wmOperator; -struct wmKeyMap; -struct wmKeyConfig; +struct BMesh; struct EnumPropertyItem; +struct ViewContext; +struct bContext; +struct wmKeyConfig; +struct wmKeyMap; +struct wmOperator; +struct wmOperatorType; /* ******************** bmeshutils.c */ @@ -57,26 +58,29 @@ struct EnumPropertyItem; */ /*calls a bmesh op, reporting errors to the user, etc*/ -int EDBM_CallOpf(struct BMEditMesh *em, struct wmOperator *op, const char *fmt, ...); +int EDBM_op_callf(struct BMEditMesh *em, struct wmOperator *op, const char *fmt, ...); + +int EDBM_op_call_and_selectf(struct BMEditMesh *em, struct wmOperator *op, + const char *selectslot, const char *fmt, ...); /* same as above, but doesn't report errors.*/ -int EDBM_CallOpfSilent(struct BMEditMesh *em, const char *fmt, ...); +int EDBM_op_call_silentf(struct BMEditMesh *em, const char *fmt, ...); -/* these next two functions are the split version of EDBM_CallOpf, so you can +/* these next two functions are the split version of EDBM_op_callf, so you can * do stuff with a bmesh operator, after initializing it but before executing * it. * * execute the operator with BM_Exec_Op */ -int EDBM_InitOpf(struct BMEditMesh *em, struct BMOperator *bmop, - struct wmOperator *op, const char *fmt, ...); +int EDBM_op_init(struct BMEditMesh *em, struct BMOperator *bmop, + struct wmOperator *op, const char *fmt, ...); /*cleans up after a bmesh operator*/ -int EDBM_FinishOp(struct BMEditMesh *em, struct BMOperator *bmop, - struct wmOperator *op, const int report); +int EDBM_op_finish(struct BMEditMesh *em, struct BMOperator *bmop, + struct wmOperator *op, const int report); void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag); -void EDBM_store_selection(struct BMEditMesh *em, void *data); -void EDBM_validate_selections(struct BMEditMesh *em); -void EDBM_remove_selection(struct BMEditMesh *em, void *data); +void EDBM_editselection_store(struct BMEditMesh *em, struct BMHeader *ele); +void EDBM_editselection_validate(struct BMEditMesh *em); +void EDBM_editselection_remove(struct BMEditMesh *em, struct BMHeader *ele); void EDBM_stats_update(struct BMEditMesh *em); /* TODO, move to math_geometry.c */ diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index c95a81d5a37..f1b0a82b654 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -326,7 +326,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, if (!createob) { /* clear */ - EDBM_ClearMesh(em); + EDBM_mesh_clear(em); } /* create verts for polygon mesh */ @@ -373,7 +373,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, BM_vert_create(em->bm, co, NULL); } - EDBM_init_index_arrays(em, 1, 0, 0); + EDBM_index_arrays_init(em, 1, 0, 0); /* create faces */ for (j = 0; j < trinum; j++) { @@ -388,9 +388,9 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, face[k] = uniquevbase + tri[k] - nv; /* unique vertex */ } newFace = BM_face_create_quad_tri(em->bm, - EDBM_get_vert_for_index(em, face[0]), - EDBM_get_vert_for_index(em, face[2]), - EDBM_get_vert_for_index(em, face[1]), NULL, + EDBM_vert_at_index(em, face[0]), + EDBM_vert_at_index(em, face[2]), + EDBM_vert_at_index(em, face[1]), NULL, NULL, FALSE); /* set navigation polygon idx to the custom layer */ @@ -398,7 +398,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, *polygonIdx = i + 1; /* add 1 to avoid zero idx */ } - EDBM_free_index_arrays(em); + EDBM_index_arrays_free(em); } recast_destroyPolyMesh(pmesh); diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 3dfc66bce25..f6fd4b45288 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -542,9 +542,9 @@ int join_mesh_exec(bContext *C, wmOperator *op) ED_object_exit_editmode(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO); #else /* toggle editmode using lower level functions so this can be called from python */ - EDBM_MakeEditBMesh(scene->toolsettings, scene, ob); - EDBM_LoadEditBMesh(scene, ob); - EDBM_FreeEditBMesh(me->edit_btmesh); + EDBM_mesh_make(scene->toolsettings, scene, ob); + EDBM_mesh_load(scene, ob); + EDBM_mesh_free(me->edit_btmesh); MEM_freeN(me->edit_btmesh); me->edit_btmesh = NULL; DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA); |