[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47751] branches/soc-2012-bratwurst/source /blender/editors/transform/transform_generics.c: UV transform correction tool

Antony Riakiotakis kalast at gmail.com
Mon Jun 11 20:41:00 CEST 2012


Revision: 47751
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47751
Author:   psy-fi
Date:     2012-06-11 18:40:55 +0000 (Mon, 11 Jun 2012)
Log Message:
-----------
UV transform correction tool
=============================
* Fix transformations to choose correct face, also comment some annoying
debug code. With this commit the tool should work very well for interior
vertices. Coming next: seam support. Final tweak will be done to support
exterior vertex moving.

Modified Paths:
--------------
    branches/soc-2012-bratwurst/source/blender/editors/transform/transform_generics.c

Modified: branches/soc-2012-bratwurst/source/blender/editors/transform/transform_generics.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/transform/transform_generics.c	2012-06-11 18:16:26 UTC (rev 47750)
+++ branches/soc-2012-bratwurst/source/blender/editors/transform/transform_generics.c	2012-06-11 18:40:55 UTC (rev 47751)
@@ -1785,10 +1785,9 @@
 				negate_v3_v3(neg_edge_prev, edge_vec_init2);
 				cross_v3_v3v3(cross2, l->f->no, neg_edge_prev);
 
-				add_v3_v3(cross, cross2);
-				negate_v3(cross);
+				add_v3_v3v3(cross, cross2, cross1);
 
-				/* now get angles */
+				/* now get angles and use sine law to calculate translation across uv axes */
 				angle1 = acos(dot_v3v3(projv, edge_vec_init)/(len_v3(projv)*len_v3(edge_vec_init)));
 				angle_boundary = acos(dot_v3v3(edge_vec_init, edge_vec_init2)/(len_v3(edge_vec_init)*len_v3(edge_vec_init2)));
 
@@ -1814,14 +1813,15 @@
 				mul_v2_v2fl(uvdiff2, edge_uv_init2, edge_len_final2/edge_len_init2);
 
 				/* fonud optimal direction */
-				if((dot_v3v3(cross1, projv) > 0.0) && (angle_boundary < (angle1 + angle2 + 0.1))) {
-					BMIter iter2;
-					BMLoop *ltmp;
+				if((dot_v3v3(cross, projv) > 0.0) && !(angle_boundary < (angle1 + angle2 - 0.01))) {
+					//BMIter iter2;
+					//BMLoop *ltmp;
 					optimal_found = TRUE;
 					uv_tot[0] = uv_tot[1] = 0.0;
 					add_v2_v2(uv_tot, uvdiff);
 					add_v2_v2(uv_tot, uvdiff2);
 
+#ifdef DEBUG
 					print_v3("normal 1\n", l->f->no);
 					print_v3("coord 1", edge_vec_init);
 					print_v3("cross product 1\n", cross1);
@@ -1830,15 +1830,7 @@
 					print_v3("cross total\n", cross);
 					print_v3("diff vector\n", projv);
 					printf("angle1 : %f, angle2 : %f, angle_boundary : %f\n", angle1, angle2, angle_boundary);
-
-					BM_ITER_ELEM(ltmp, &iter2, v, BM_LOOPS_OF_VERT) {
-						ltmp->next->v->co[2] = uvtc->init_vec[BM_elem_index_get(ltmp->next->v)][2];
-						ltmp->prev->v->co[2] = uvtc->init_vec[BM_elem_index_get(ltmp->prev->v)][2];
-					}
-
-					l_next->v->co[2] = uvtc->init_vec[index_next][2] + 0.05;
-					l_prev->v->co[2] = uvtc->init_vec[index_prev][2] + 0.05;
-
+#endif
 					break;
 				}
 




More information about the Bf-blender-cvs mailing list