Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-07-23 21:26:24 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-07-23 21:29:17 +0400
commit1f55044617d167e81bc56cc359a1adf886045447 (patch)
tree38101dd59aafffc078157765ef41e3be4ef0ddca /source/blender/bmesh/operators
parent554829dc9e4c9f5d55ec4a9b95c50a9b40a33e3b (diff)
Editmesh: Add option to tear boundary vertices when dissolving
Diffstat (limited to 'source/blender/bmesh/operators')
-rw-r--r--source/blender/bmesh/operators/bmo_dissolve.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index 209ca30ddc3..84d3cda4866 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -51,6 +51,7 @@
#define VERT_MARK_PAIR 4
#define VERT_TAG 2
#define VERT_ISGC 8
+#define VERT_MARK_TEAR 16
@@ -85,7 +86,7 @@ static bool UNUSED_FUNCTION(check_hole_in_region) (BMesh *bm, BMFace *f)
return true;
}
-static void bm_face_split(BMesh *bm, const short oflag)
+static void bm_face_split(BMesh *bm, const short oflag, bool use_edge_delete)
{
BMIter iter;
BMVert *v;
@@ -104,6 +105,12 @@ static void bm_face_split(BMesh *bm, const short oflag)
}
}
}
+ /* remove surrounding edges & faces */
+ if (use_edge_delete) {
+ while (v->e) {
+ BM_edge_kill(bm, v->e);
+ }
+ }
}
}
}
@@ -268,7 +275,7 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
}
}
- bm_face_split(bm, VERT_TAG);
+ bm_face_split(bm, VERT_TAG, false);
}
if (use_verts) {
@@ -345,13 +352,30 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
BMFace *act_face = bm->act_face;
const bool use_face_split = BMO_slot_bool_get(op->slots_in, "use_face_split");
+ const bool use_boundary_tear = BMO_slot_bool_get(op->slots_in, "use_boundary_tear");
BMO_ITER (v, &oiter, op->slots_in, "verts", BM_VERT) {
BMO_elem_flag_enable(bm, v, VERT_MARK | VERT_ISGC);
}
if (use_face_split) {
- bm_face_split(bm, VERT_MARK);
+ bm_face_split(bm, VERT_MARK, false);
+ }
+
+ if (use_boundary_tear) {
+ BMO_ITER (v, &oiter, op->slots_in, "verts", BM_VERT) {
+ if (!BM_vert_is_edge_pair(v)) {
+ BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
+ if (BM_edge_is_boundary(e)) {
+ BMO_elem_flag_enable(bm, v, VERT_MARK_TEAR);
+ break;
+ }
+ }
+ }
+ }
+ if (!use_face_split) {
+ bm_face_split(bm, VERT_MARK_TEAR, true);
+ }
}
BMO_ITER (v, &oiter, op->slots_in, "verts", BM_VERT) {