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>2012-03-03 16:35:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-03 16:35:37 +0400
commit9c18ade898fb613321bf2eb73232a74de7186aab (patch)
tree802da6fd569ba897b9649659e4dab5f6da004f46 /source/blender/bmesh/operators/bmo_utils.c
parent9d49fa0e6373d78c794e8472ed3f527392dfabcd (diff)
bmesh edge rotate
* improve check to see if edge rotate can be done, was checking if both edges verts have an edge count of 2, which is really a meaningless test since the verts can have stray edges connected and the result wont work right. instead check if the next verts in both faces share a vertex. * add utility function BM_face_other_vert_loop() which gets the next loop in a face. * add convenience function BM_edge_face_pair() which returns 2 faces for edges that have exactly 2 face users. (saves ugly e->l->radial_next ... in code) and is more readable.
Diffstat (limited to 'source/blender/bmesh/operators/bmo_utils.c')
-rw-r--r--source/blender/bmesh/operators/bmo_utils.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
index b7418e428ed..64e530ca52a 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -125,16 +125,39 @@ void bmo_edgerotate_exec(BMesh *bm, BMOperator *op)
BMEdge *e, *e2;
int ccw = BMO_slot_bool_get(op, "ccw");
+#define EDGE_OUT 1
+#define FACE_TAINT 1
+
BMO_ITER(e, &siter, bm, op, "edges", BM_EDGE) {
- if (!(e2 = BM_edge_rotate(bm, e, ccw))) {
- BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Could not rotate edge");
- return;
- }
+ if (BM_edge_rotate_check(bm, e)) {
+ BMFace *fa, *fb;
+ if (BM_edge_face_pair(e, &fa, &fb)) {
+
+ /* check we're untouched */
+ if (BMO_elem_flag_test(bm, fa, FACE_TAINT) == FALSE &&
+ BMO_elem_flag_test(bm, fb, FACE_TAINT) == FALSE)
+ {
+
+ if (!(e2 = BM_edge_rotate(bm, e, ccw))) {
+ BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Could not rotate edge");
+ return;
+ }
- BMO_elem_flag_enable(bm, e2, 1);
+ BMO_elem_flag_enable(bm, e2, EDGE_OUT);
+
+ /* dont touch again */
+ BMO_elem_flag_enable(bm, fa, FACE_TAINT);
+ BMO_elem_flag_enable(bm, fb, FACE_TAINT);
+ }
+ }
+ }
}
- BMO_slot_buffer_from_flag(bm, op, "edgeout", 1, BM_EDGE);
+ BMO_slot_buffer_from_flag(bm, op, "edgeout", EDGE_OUT, BM_EDGE);
+
+#undef EDGE_OUT
+#undef FACE_TAINT
+
}
#define SEL_FLAG 1