[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56366] trunk/blender/source/blender/ editors/transform/transform.c: fix for bug with edge-slide doing UV correction when the faces connected to one of the sliding edges dont have contiguous UV 's (or vcols etc).

Campbell Barton ideasman42 at gmail.com
Sun Apr 28 19:44:28 CEST 2013


Revision: 56366
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56366
Author:   campbellbarton
Date:     2013-04-28 17:44:28 +0000 (Sun, 28 Apr 2013)
Log Message:
-----------
fix for bug with edge-slide doing UV correction when the faces connected to one of the sliding edges dont have contiguous UV's (or vcols etc).
resolve by using faces adjacent to the ones directly connected to the edge that sliding.

This isnt a prefect solution but it resolves the common case where an edge slides along a UV seam.

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	2013-04-28 17:34:23 UTC (rev 56365)
+++ trunk/blender/source/blender/editors/transform/transform.c	2013-04-28 17:44:28 UTC (rev 56366)
@@ -5671,25 +5671,66 @@
 					 * 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() */
+
+					/*
+					 *        +    +----------------+
+					 *         \   |                |
+					 * (this) l_adj|                |
+					 *           \ |                |
+					 *            \|      e_sel     |
+					 *  +----------+----------------+  <- the edge we are sliding.
+					 *            /|sv->v           |
+					 *           / |                |
+					 *   (or) l_adj|                |
+					 *         /   |                |
+					 *        +    +----------------+
+					 * (above)
+					 * 'other connected loops', attached to sv->v slide faces.
+					 *
+					 * NOTE: The faces connected to the edge may not have contiguous UV's
+					 *       so step around the loops to find l_adj.
+					 *       However if the 'other loops' are not cotiguous it will still give problems.
+					 *
+					 *       A full solution to this would have to store
+					 *       per-customdata-layer map of which loops are contiguous
+					 *       and take this into account when interpolating.
+					 *
+					 * NOTE: If l_adj's edge isnt manifold then use then
+					 *       interpolate the loop from its own face.
+					 *       Can happen when 'other connected loops' are disconnected from the face-fan.
+					 */
+
+					BMLoop *l_adj = NULL;
 					if (sld->perc < 0.0f) {
 						if (BM_vert_in_face(e_sel->l->f, sv->v_b)) {
-							f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->f);
+							l_adj = e_sel->l;
 						}
 						else if (BM_vert_in_face(e_sel->l->radial_next->f, sv->v_b)) {
-							f_copy_flip = BLI_smallhash_lookup(&sld->origfaces,
-							                                   (uintptr_t)e_sel->l->radial_next->f);
+							l_adj = e_sel->l->radial_next;
 						}
-
 					}
 					else if (sld->perc > 0.0f) {
 						if (BM_vert_in_face(e_sel->l->f, sv->v_a)) {
-							f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->f);
+							l_adj = e_sel->l;
 						}
 						else if (BM_vert_in_face(e_sel->l->radial_next->f, sv->v_a)) {
-							f_copy_flip = BLI_smallhash_lookup(&sld->origfaces,
-							                                   (uintptr_t)e_sel->l->radial_next->f);
+							l_adj = e_sel->l->radial_next;
 						}
 					}
+
+					/* step across to the face */
+					if (l_adj) {
+						l_adj = BM_loop_other_edge_loop(l_adj, sv->v);
+						if (!BM_edge_is_boundary(l_adj->e)) {
+							l_adj = l_adj->radial_next;
+						}
+						else {
+							/* disconnected face-fan, fallback to self */
+							l_adj = l;
+						}
+
+						f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l_adj->f);
+					}
 				}
 			}
 




More information about the Bf-blender-cvs mailing list