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-05-31 07:56:54 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-05-31 09:41:20 +0400
commiteb57f65a32dc768c1532b28227b0c4788592682f (patch)
tree200dc1a1364e4a7777a558e011b4c2388d79bb1d /source/blender/editors/transform/transform.c
parentd504b325fbb287d004f2fbb6b29442be2ea460d0 (diff)
Fix EdgeSlide behavior with boundry edges
- would flip in opposite directions sometimes on the same loop - some vertices would get directions from adjacent vertices
Diffstat (limited to 'source/blender/editors/transform/transform.c')
-rw-r--r--source/blender/editors/transform/transform.c81
1 files changed, 53 insertions, 28 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index eae02c920c9..34e76ce5ece 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -5424,8 +5424,8 @@ static bool createEdgeSlideVerts(TransInfo *t)
while (1) {
float vec_a[3], vec_b[3];
BMLoop *l_a, *l_b;
+ BMLoop *l_a_prev, *l_b_prev;
BMVert *v_first;
-
/* If this succeeds call get_next_loop()
* which calculates the direction to slide based on clever checks.
*
@@ -5455,7 +5455,6 @@ static bool createEdgeSlideVerts(TransInfo *t)
e = v->e;
/*first, rewind*/
- numsel = 0;
do {
e = get_other_edge(v, e);
if (!e) {
@@ -5463,8 +5462,6 @@ static bool createEdgeSlideVerts(TransInfo *t)
break;
}
- numsel += 1;
-
if (!BM_elem_flag_test(BM_edge_other_vert(e, v), BM_ELEM_TAG))
break;
@@ -5513,6 +5510,9 @@ static bool createEdgeSlideVerts(TransInfo *t)
l_b = NULL;
}
+ l_a_prev = NULL;
+ l_b_prev = NULL;
+
/*iterate over the loop*/
v_first = v;
do {
@@ -5530,14 +5530,14 @@ static bool createEdgeSlideVerts(TransInfo *t)
copy_v3_v3(sv->v_co_orig, v->co);
sv->loop_nr = loop_nr;
- if (l_a) {
- BMLoop *l_tmp = BM_loop_other_edge_loop(l_a, v);
+ if (l_a || l_a_prev) {
+ BMLoop *l_tmp = BM_loop_other_edge_loop(l_a ? l_a : l_a_prev, v);
sv->v_a = BM_edge_other_vert(l_tmp->e, v);
copy_v3_v3(sv->dir_a, vec_a);
}
- if (l_b) {
- BMLoop *l_tmp = BM_loop_other_edge_loop(l_b, v);
+ if (l_b || l_b_prev) {
+ BMLoop *l_tmp = BM_loop_other_edge_loop(l_b ? l_b : l_b_prev, v);
sv->v_b = BM_edge_other_vert(l_tmp->e, v);
copy_v3_v3(sv->dir_b, vec_b);
}
@@ -5586,29 +5586,54 @@ static bool createEdgeSlideVerts(TransInfo *t)
l_a_ok_prev = (l_a != NULL);
l_b_ok_prev = (l_b != NULL);
- l_a = l_a ? get_next_loop(v, l_a, e_prev, e, vec_a) : NULL;
- l_b = l_b ? get_next_loop(v, l_b, e_prev, e, vec_b) : NULL;
-
- /* find the opposite loop if it was missing previously */
- if (l_a == NULL && l_b && (l_b->radial_next != l_b)) l_a = l_b->radial_next;
- else if (l_b == NULL && l_a && (l_a->radial_next != l_a)) l_b = l_a->radial_next;
-
- /* if there are non-contiguous faces, we can still recover the loops of the new edges faces */
- /* note!, the behavior in this case means edges may move in opposite directions,
- * this could be made to work more usefully. */
- if (!(l_a && l_b) && (e->l != NULL)) {
- if (l_a_ok_prev) {
- l_a = e->l;
- if (l_a->radial_next != l_a) {
- l_b = l_a->radial_next;
- }
+ l_a_prev = l_a;
+ l_b_prev = l_b;
+
+ if (l_a) {
+ l_a = get_next_loop(v, l_a, e_prev, e, vec_a);
+ }
+ else {
+ zero_v3(vec_a);
+ }
+
+ if (l_b) {
+ l_b = get_next_loop(v, l_b, e_prev, e, vec_b);
+ }
+ else {
+ zero_v3(vec_b);
+ }
+
+
+ if (l_a && l_b) {
+ /* pass */
+ }
+ else {
+ if (l_a || l_b) {
+ /* find the opposite loop if it was missing previously */
+ if (l_a == NULL && l_b && (l_b->radial_next != l_b)) l_a = l_b->radial_next;
+ else if (l_b == NULL && l_a && (l_a->radial_next != l_a)) l_b = l_a->radial_next;
}
- else if (l_b_ok_prev) {
- l_b = e->l;
- if (l_b->radial_next != l_b) {
- l_a = l_b->radial_next;
+ else if (e->l != NULL) {
+ /* if there are non-contiguous faces, we can still recover the loops of the new edges faces */
+ /* note!, the behavior in this case means edges may move in opposite directions,
+ * this could be made to work more usefully. */
+
+ if (l_a_ok_prev) {
+ l_a = e->l;
+ l_b = (l_a->radial_next != l_a) ? l_a->radial_next : NULL;
+ }
+ else if (l_b_ok_prev) {
+ l_b = e->l;
+ l_a = (l_b->radial_next != l_b) ? l_b->radial_next : NULL;
}
}
+
+ if (!l_a_ok_prev && l_a) {
+ get_next_loop(v, l_a, e, e_prev, vec_a);
+ }
+ if (!l_b_ok_prev && l_b) {
+ get_next_loop(v, l_b, e, e_prev, vec_b);
+ }
}
BM_elem_flag_disable(v, BM_ELEM_TAG);