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

Antony Riakiotakis kalast at gmail.com
Tue Jun 12 01:16:25 CEST 2012


Revision: 47767
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47767
Author:   psy-fi
Date:     2012-06-11 23:16:25 +0000 (Mon, 11 Jun 2012)
Log Message:
-----------
UV transform correction tool
============================
* change uv information struct to use loops instead of uvs and iterate
over this struct instead of over the loops. This change is needed
because now we sort the loops according to island

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

Modified: branches/soc-2012-bratwurst/source/blender/editors/transform/transform.h
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/transform/transform.h	2012-06-11 23:16:05 UTC (rev 47766)
+++ branches/soc-2012-bratwurst/source/blender/editors/transform/transform.h	2012-06-11 23:16:25 UTC (rev 47767)
@@ -224,7 +224,7 @@
 
 typedef struct UVTransCorrInfoUV {
 		float init_uv[2]; /* initial uv value */
-		float *uv; /* pointer to the corresponding luv->uv */
+		struct BMLoop *l; /* pointer to the corresponding luv->uv */
 		struct UVTransCorrInfoUV *next; /* next uv for same vertex */
 		int island_index; /* index of the per-vertex uv island */
 }UVTransCorrInfoUV;

Modified: branches/soc-2012-bratwurst/source/blender/editors/transform/transform_conversions.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/transform/transform_conversions.c	2012-06-11 23:16:05 UTC (rev 47766)
+++ branches/soc-2012-bratwurst/source/blender/editors/transform/transform_conversions.c	2012-06-11 23:16:25 UTC (rev 47767)
@@ -2141,7 +2141,7 @@
 						uvprev = *uvtcuv;
 
 						copy_v2_v2((*uvtcuv)->init_uv, luv->uv);
-						(*uvtcuv)->uv = luv->uv;
+						(*uvtcuv)->l = l;
 						(*uvtcuv)->next = NULL;
 						uvtcuv = &((*uvtcuv)->next);
 					}
@@ -2156,7 +2156,7 @@
 						while(uviter) {
 							UVTransCorrInfoUV *tmpuv = uviter->next;
 							float diff[2];
-							sub_v2_v2v2(diff, uviter->uv, uviter2->uv);
+							sub_v2_v2v2(diff, uviter->init_uv, uviter2->init_uv);
 							if(len_v2(diff) < STD_UV_CONNECT_LIMIT) {
 								uviter->island_index = island;
 

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 23:16:05 UTC (rev 47766)
+++ branches/soc-2012-bratwurst/source/blender/editors/transform/transform_generics.c	2012-06-11 23:16:25 UTC (rev 47767)
@@ -1423,6 +1423,7 @@
 	
 	td = t->data;
 	if(t->flag & T_IMAGE_PRESERVE_CALC) {
+		CustomData *data = &(BMEdit_FromObject(t->obedit)->bm->ldata);
 		int i;
 		for(i = 0; i < t->total; i++) {
 			BMVert *eve;
@@ -1433,7 +1434,9 @@
 			uvtcuv = t->uvtc->initial_uvs[BM_elem_index_get(eve)];
 
 			while(uvtcuv) {
-				copy_v2_v2(uvtcuv->uv, uvtcuv->init_uv);
+				MLoopUV *luv = CustomData_bmesh_get(data, uvtcuv->l->head.data, CD_MLOOPUV);
+
+				copy_v2_v2(luv->uv, uvtcuv->init_uv);
 				uvtcuv = uvtcuv->next;
 			}
 		}
@@ -1724,6 +1727,7 @@
 	/* iterate through loops of vert and calculate image space diff of uvs */
 	for (i = 0 ; i < t->total; i++) {
 		if(not_prop_edit || td[i].factor > 0.0) {
+
 			/* last island visited, if this changes without an optimal face found,
 			 * we flush the result */
 			int last_insland = 0;
@@ -1741,7 +1745,7 @@
 
 			uv_tot[0] = uv_tot[1] = 0.0;
 
-			BM_ITER_ELEM(l, &iter, v, BM_LOOPS_OF_VERT) {
+			for(uvtcuv = uvtc->initial_uvs[index]; uvtcuv; uvtcuv = uvtcuv->next) {
 				float angle1, angle2, angle_boundary;
 				float cross1[3], cross2[3], cross[3];
 				float normal[3], projv[3];
@@ -1752,7 +1756,7 @@
 				float edge_uv_init[2], edge_uv_init2[2];
 				float uvdiff[2], uvdiff2[2];
 				int index_next, index_prev;
-				BMLoop *l_next, *l_prev;
+				BMLoop *l_next, *l_prev, *l = uvtcuv->l;
 				MLoopUV *luv;
 
 				l_next =l->next;




More information about the Bf-blender-cvs mailing list