[Bf-blender-cvs] [53424ec] master: Fix T40422: EdgeSlide works incorrectly with boundry edges

Campbell Barton noreply at git.blender.org
Thu May 29 17:55:20 CEST 2014


Commit: 53424ec0ff664829ff4973a013f605d342838d21
Author: Campbell Barton
Date:   Fri May 30 01:49:36 2014 +1000
https://developer.blender.org/rB53424ec0ff664829ff4973a013f605d342838d21

Fix T40422: EdgeSlide works incorrectly with boundry edges

===================================================================

M	source/blender/editors/transform/transform.c

===================================================================

diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index cf9f89e..eae02c9 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -5426,6 +5426,16 @@ static bool createEdgeSlideVerts(TransInfo *t)
 		BMLoop *l_a, *l_b;
 		BMVert *v_first;
 
+		/* If this succeeds call get_next_loop()
+		 * which calculates the direction to slide based on clever checks.
+		 *
+		 * otherwise we simply use 'e_dir' as an edge-rail.
+		 * (which is better when the attached edge is a boundary, see: T40422)
+		 */
+#define EDGESLIDE_VERT_IS_INNER(v, e_dir) \
+		((BM_edge_is_boundary(e_dir) == false) && \
+		 (BM_vert_edge_count_nonwire(v) == 2))
+
 		v = NULL;
 		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
 			if (BM_elem_flag_test(v, BM_ELEM_TAG))
@@ -5474,10 +5484,12 @@ static bool createEdgeSlideVerts(TransInfo *t)
 			}
 			else {
 				BMLoop *l_tmp = BM_loop_other_edge_loop(l_a, v);
-				if (BM_vert_edge_count_nonwire(v) == 2)
+				if (EDGESLIDE_VERT_IS_INNER(v, l_tmp->e)) {
 					get_next_loop(v, l_a, e, l_tmp->e, vec_a);
-				else
+				}
+				else {
 					sub_v3_v3v3(vec_a, BM_edge_other_vert(l_tmp->e, v)->co, v->co);
+				}
 			}
 		}
 
@@ -5489,11 +5501,12 @@ static bool createEdgeSlideVerts(TransInfo *t)
 			}
 			else {
 				BMLoop *l_tmp = BM_loop_other_edge_loop(l_b, v);
-				if (BM_vert_edge_count_nonwire(v) == 2)
+				if (EDGESLIDE_VERT_IS_INNER(v, l_tmp->e)) {
 					get_next_loop(v, l_b, e, l_tmp->e, vec_b);
-				else
+				}
+				else {
 					sub_v3_v3v3(vec_b, BM_edge_other_vert(l_tmp->e, v)->co, v->co);
-
+				}
 			}
 		}
 		else {
@@ -5546,7 +5559,7 @@ static bool createEdgeSlideVerts(TransInfo *t)
 				if (l_a) {
 					BMLoop *l_tmp = BM_loop_other_edge_loop(l_a, v);
 					sv->v_a = BM_edge_other_vert(l_tmp->e, v);
-					if (BM_vert_edge_count_nonwire(v) == 2) {
+					if (EDGESLIDE_VERT_IS_INNER(v, l_tmp->e)) {
 						get_next_loop(v, l_a, e_prev, l_tmp->e, sv->dir_a);
 					}
 					else {
@@ -5557,7 +5570,7 @@ static bool createEdgeSlideVerts(TransInfo *t)
 				if (l_b) {
 					BMLoop *l_tmp = BM_loop_other_edge_loop(l_b, v);
 					sv->v_b = BM_edge_other_vert(l_tmp->e, v);
-					if (BM_vert_edge_count_nonwire(v) == 2) {
+					if (EDGESLIDE_VERT_IS_INNER(v, l_tmp->e)) {
 						get_next_loop(v, l_b, e_prev, l_tmp->e, sv->dir_b);
 					}
 					else {
@@ -5603,6 +5616,8 @@ static bool createEdgeSlideVerts(TransInfo *t)
 		} while ((e != v_first->e) && (l_a || l_b));
 
 		loop_nr++;
+
+#undef EDGESLIDE_VERT_IS_INNER
 	}
 
 	/* use for visibility checks */




More information about the Bf-blender-cvs mailing list