diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-02-02 01:04:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-02-02 01:23:44 +0300 |
commit | 64124ba904dcaac2bf029a55943282843b8a2603 (patch) | |
tree | 4474d3b19930c6d37325fc2c642ec624802448fd /source/blender/editors/mesh/editmesh_tools.c | |
parent | d655a8f16867d2d2a0bdc652128261e75ad894e9 (diff) |
BMesh: tool to ensure all faces are convex
Access from Mesh -> Cleanup
Diffstat (limited to 'source/blender/editors/mesh/editmesh_tools.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 1e301e09837..3a9e366fe37 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -964,6 +964,40 @@ void MESH_OT_vert_connect(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } +static int edbm_vert_connect_concave_exec(bContext *C, wmOperator *op) +{ + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BKE_editmesh_from_object(obedit); + + if (!EDBM_op_call_and_selectf( + em, op, + "faces.out", true, + "connect_verts_concave faces=%hf", + BM_ELEM_SELECT)) + { + return OPERATOR_CANCELLED; + } + + + EDBM_update_generic(em, true, true); + return OPERATOR_FINISHED; +} + +void MESH_OT_vert_connect_concave(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Split Concave Faces"; + ot->idname = "MESH_OT_vert_connect_concave"; + ot->description = "Makes all faces convex"; + + /* api callbacks */ + ot->exec = edbm_vert_connect_concave_exec; + ot->poll = ED_operator_editmesh; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + static int edbm_vert_connect_nonplaner_exec(bContext *C, wmOperator *op) { |