[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45714] trunk/blender/source/blender/ editors/transform: Fix #30980: edge slide Correct UVs option not working.

Brecht Van Lommel brechtvanlommel at pandora.be
Tue Apr 17 16:24:04 CEST 2012


Revision: 45714
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45714
Author:   blendix
Date:     2012-04-17 14:24:04 +0000 (Tue, 17 Apr 2012)
Log Message:
-----------
Fix #30980: edge slide Correct UVs option not working.

Was a bmesh todo, main issue was with shape keys, now disabled any changes to
the shape key data layer, and disabled the option altogether when editing
non-basis shape keys.

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

Modified: trunk/blender/source/blender/editors/transform/transform.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.c	2012-04-17 13:07:13 UTC (rev 45713)
+++ trunk/blender/source/blender/editors/transform/transform.c	2012-04-17 14:24:04 UTC (rev 45714)
@@ -4697,16 +4697,18 @@
 	BMEditMesh *em = sld->em;
 	SmallHash visit;
 	int i;
-	
+
 	if (!em)
 		return;
 	
-	/* BMESH_TODO, (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT)
-	 * currently all vertex data is interpolated which is nice mostly
-	 * except for shape keys where you don't want to modify UVs for eg.
-	 * current BMesh code doesnt make it easy to pick which data we interpolate
-	 * - campbell */
+	if(!(t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT))
+		return;
 
+	/* don't do this at all for non-basis shape keys, too easy to
+	   accidentally break uv maps or vertex colors then */
+	if(em->bm->shapenr > 1)
+		return;
+
 	BLI_smallhash_init(&visit);
 	
 		for (i=0, tempsv=sld->sv; i<sld->totsv; i++, tempsv++) {
@@ -4717,14 +4719,14 @@
 			BMIter liter2;
 			BMFace *copyf, *copyf2;
 			BMLoop *l2;
-			int sel, hide /*, do_vdata */ /* UNUSED */;
+			int sel, hide;
 			
 			if (BLI_smallhash_haskey(&visit, (uintptr_t)f))
 				continue;
 			
 			BLI_smallhash_insert(&visit, (uintptr_t)f, NULL);
 			
-			/*the face attributes of the copied face will get
+			/* the face attributes of the copied face will get
 			 * copied over, so its necessary to save the selection
 			 * and hidden state*/
 			sel = BM_elem_flag_test(f, BM_ELEM_SELECT);
@@ -4732,16 +4734,13 @@
 			
 			copyf2 = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)f);
 			
-			/*project onto copied projection face*/
+			/* project onto copied projection face */
 			BM_ITER(l2, &liter2, em->bm, BM_LOOPS_OF_FACE, f) {
 				copyf = copyf2;
-				/* do_vdata = l2->v==tempsv->v; */ /* UNUSED */
 				
 				if (BM_elem_flag_test(l2->e, BM_ELEM_SELECT) || BM_elem_flag_test(l2->prev->e, BM_ELEM_SELECT)) {
 					BMLoop *l3 = l2;
 					
-					/* do_vdata = 1; */ /* UNUSED */
-					
 					if (!BM_elem_flag_test(l2->e, BM_ELEM_SELECT))
 						l3 = l3->prev;
 					
@@ -4755,10 +4754,9 @@
 						continue;  /* shouldn't happen, but protection */
 				}
 				
-				/* do not run interpolation of all layers for now because it's not actually what you'll always expect
-				 * and layers like shapekeys shouldn't be interpolated from here because oherwise they'll
-				 * propagate to basis keys and will propagate twice to related keys (sergey) */
-				// BM_loop_interp_from_face(em->bm, l2, copyf, do_vdata, FALSE);
+				/* only loop data, no vertex data since that contains shape keys,
+				 * and we do not want to mess up other shape keys */
+				BM_loop_interp_from_face(em->bm, l2, copyf, FALSE, FALSE);
 
 				if (final) {
 					BM_loop_interp_multires(em->bm, l2, copyf);	
@@ -4893,10 +4891,7 @@
 		}
 	}
 	
-	/* BMESH_TODO: simply not all layers should be interpolated from there
-	 * but it's quite complicated to set this up with current API.
-	 * details are in comments in projectSVData function */
-	// projectSVData(t, 0);
+	projectSVData(t, 0);
 	
 	return 1;
 }

Modified: trunk/blender/source/blender/editors/transform/transform_conversions.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_conversions.c	2012-04-17 13:07:13 UTC (rev 45713)
+++ trunk/blender/source/blender/editors/transform/transform_conversions.c	2012-04-17 14:24:04 UTC (rev 45714)
@@ -4892,10 +4892,6 @@
 				}
 				EDBM_automerge(t->scene, t->obedit, 1);
 			}
-#if 0
-			/* BMESH_TODO: simply nothing to cancel from here, but when interpolation of
-			 * some custom layers would be added this code would eb needed
-			 * some details are in comments in projectSVData (sergey) */
 			else {
 				if (t->mode == TFM_EDGE_SLIDE) {
 					SlideData *sld = t->customData;
@@ -4904,7 +4900,6 @@
 					projectSVData(t, FALSE);
 				}
 			}
-#endif
 		}
 	}
 	

Modified: trunk/blender/source/blender/editors/transform/transform_ops.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_ops.c	2012-04-17 13:07:13 UTC (rev 45713)
+++ trunk/blender/source/blender/editors/transform/transform_ops.c	2012-04-17 14:24:04 UTC (rev 45714)
@@ -500,12 +500,12 @@
 	
 	if (flags & P_OPTIONS)
 	{
-		RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Object data texture space", "");
+		RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Texture Space", "Edit Object data texture space");
 	}
 
 	if (flags & P_CORRECT_UV)
 	{
-		RNA_def_boolean(ot->srna, "correct_uv", 0, "Correct UV coords when transforming", "");
+		RNA_def_boolean(ot->srna, "correct_uv", 0, "Correct UVs", "Correct UV coordinates when transforming");
 	}
 
 	// Add confirm method all the time. At the end because it's not really that important and should be hidden only in log, not in keymap edit




More information about the Bf-blender-cvs mailing list