diff options
author | Joseph Eagar <joeedh@gmail.com> | 2009-03-09 12:52:32 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2009-03-09 12:52:32 +0300 |
commit | 5018318fe0619565707e50cb66b836bd25997912 (patch) | |
tree | b6c3e096ff7f96bc0a9b66804d0d4178642f67dc /source/blender/editors/mesh/editmesh_add.c | |
parent | 34e3e3587b182cd9efe655c2fc24f470dcfe3242 (diff) |
dissolve faces: errors-out on holes, preserves winding, and doesn't delete original face if no dissolving happened. the conversion from/to editmesh now counts selected elements properly.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_add.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_add.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 8651abac0a9..b32c733ad8c 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -669,15 +669,42 @@ static void addedgeface_mesh(EditMesh *em, wmOperator *op) EditFace *efa; short amount=0; + /*return if bmesh vert connect does anything.*/ if (em->selectmode & SCE_SELECT_VERTEX) { - /*return if bmesh vert connect does anything.*/ - if (BM_ConnectVerts(em, BM_SELECT)) return; + BMesh *bm = editmesh_to_bmesh(em); + BMOperator bmop; + int len, ok; + + BMO_InitOpf(bm, &bmop, "connectverts verts=%hv", BM_SELECT); + BMO_Exec_Op(bm, &bmop); + BMO_Finish_Op(bm, &bmop); + + ok = EDBM_Finish(bm, em, op, 1); + if (!ok) return OPERATOR_CANCELLED; + + len = BMO_GetSlot(&bmop, BM_CONVERTS_EDGEOUT)->len; + if (len) return; } + /*return if bmesh face dissolve finds stuff to + dissolve. this entire tool should be + bmeshafied eventually, but until then + hacks like this to integrate with it + are necassary.*/ if (em->selectmode & SCE_SELECT_FACE) { - /*return if bmesh face dissolve finds stuff to - dissolve.*/ - if (BM_DissolveFaces(em, BM_SELECT)) return; + BMesh *bm = editmesh_to_bmesh(em); + BMOperator bmop; + int len, ok; + + BMO_InitOpf(bm, &bmop, "dissolvefaces faces=%hf", BM_SELECT); + BMO_Exec_Op(bm, &bmop); + BMO_Finish_Op(bm, &bmop); + + ok = EDBM_Finish(bm, em, op, 1); + if (!ok) return OPERATOR_CANCELLED; + + len = BMO_GetSlot(&bmop, BMOP_DISFACES_REGIONOUT)->len; + if (len) return; } /* how many selected ? */ |