[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45954] trunk/blender/source/blender/ editors/transform/transform.c: fix [#31080], edge slide UV correction wasnt working for UVs surrounding the end of the slide selection (one edge sliding on a grid for example).

Campbell Barton ideasman42 at gmail.com
Wed Apr 25 04:46:37 CEST 2012


Revision: 45954
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45954
Author:   campbellbarton
Date:     2012-04-25 02:46:32 +0000 (Wed, 25 Apr 2012)
Log Message:
-----------
fix [#31080], edge slide UV correction wasnt working for UVs surrounding the end of the slide selection (one edge sliding on a grid for example).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/transform/transform.c

Modified: trunk/blender/source/blender/editors/transform/transform.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.c	2012-04-25 01:25:21 UTC (rev 45953)
+++ trunk/blender/source/blender/editors/transform/transform.c	2012-04-25 02:46:32 UTC (rev 45954)
@@ -4720,6 +4720,10 @@
 		BMIter fiter;
 		BMFace *f;
 		
+
+		/* BMESH_TODO, this interpolates between vertex/loops which are not moved
+		 * (are only apart of a face attached to a slide vert), couldn't we iterate BM_LOOPS_OF_VERT
+		 * here and only iterpolate those? */
 		BM_ITER_ELEM (f, &fiter, sv->v, BM_FACES_OF_VERT) {
 			BMIter liter;
 			BMLoop *l;
@@ -4746,18 +4750,23 @@
 			/* project onto copied projection face */
 			BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
 				f_copy_flip = f_copy;
-				
+
 				if (BM_elem_flag_test(l->e, BM_ELEM_SELECT) || BM_elem_flag_test(l->prev->e, BM_ELEM_SELECT)) {
+					/* the loop is attached of the selected edges that are sliding */
 					BMLoop *l_ed_sel = l;
 					
 					if (!BM_elem_flag_test(l->e, BM_ELEM_SELECT))
 						l_ed_sel = l_ed_sel->prev;
 					
-					if (sld->perc < 0.0 && BM_vert_in_face(l_ed_sel->radial_next->f, sv->down)) {
-						f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l_ed_sel->radial_next->f);
+					if (sld->perc < 0.0f) {
+						if (BM_vert_in_face(l_ed_sel->radial_next->f, sv->down)) {
+							f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l_ed_sel->radial_next->f);
+						}
 					}
-					else if (sld->perc > 0.0 && BM_vert_in_face(l_ed_sel->radial_next->f, sv->up)) {
-						f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l_ed_sel->radial_next->f);
+					else if (sld->perc > 0.0f) {
+						if (BM_vert_in_face(l_ed_sel->radial_next->f, sv->up)) {
+							f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l_ed_sel->radial_next->f);
+						}
 					}
 
 					BLI_assert(f_copy_flip != NULL);
@@ -4765,6 +4774,44 @@
 						continue;  /* shouldn't happen, but protection */
 					}
 				}
+				else {
+					/* the loop is attached to only one vertex and not a selected edge,
+					 * this means we have to find a selected edges face going in the right direction
+					 * to copy from else we get bad distortion see: [#31080] */
+					BMIter eiter;
+					BMEdge *e_sel;
+
+					BM_ITER_ELEM (e_sel, &eiter, l->v, BM_EDGES_OF_VERT) {
+						if (BM_elem_flag_test(e_sel, BM_ELEM_SELECT)) {;
+							break;
+						}
+					}
+
+					if (e_sel) {
+						/* warning if the UV's are not contiguiys, this will copy from the _wrong_ UVs
+						 * in fact whenever the face being copied is not 'f_copy' this can happen,
+						 * we could be a lot smarter about this but would need to deal with every UV channel or
+						 * add a way to mask out lauers when calling #BM_loop_interp_from_face() */
+						if (sld->perc < 0.0f) {
+							if (BM_vert_in_face(e_sel->l->f, sv->down)) {
+								f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->f);
+							}
+							else if (BM_vert_in_face(e_sel->l->radial_next->f, sv->down)) {
+								f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->radial_next->f);
+							}
+
+						}
+						else if (sld->perc > 0.0f) {
+							if (BM_vert_in_face(e_sel->l->f, sv->up)) {
+								f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->f);
+							}
+							else if (BM_vert_in_face(e_sel->l->radial_next->f, sv->up)) {
+								f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->radial_next->f);
+							}
+						}
+					}
+
+				}
 				
 				/* only loop data, no vertex data since that contains shape keys,
 				 * and we do not want to mess up other shape keys */




More information about the Bf-blender-cvs mailing list