[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38545] branches/soc-2011-onion/source/ blender/editors/uvedit/uvedit_ops.c: smart stitch

Antony Riakiotakis kalast at gmail.com
Wed Jul 20 17:58:04 CEST 2011


Revision: 38545
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38545
Author:   psy-fi
Date:     2011-07-20 15:58:04 +0000 (Wed, 20 Jul 2011)
Log Message:
-----------
smart stitch
============================
-Island rotation stuff (still not functional) + small bug fix

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c

Modified: branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c	2011-07-20 15:56:35 UTC (rev 38544)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c	2011-07-20 15:58:04 UTC (rev 38545)
@@ -1127,6 +1127,8 @@
 	/* rotation can be used only for edges, for vertices there is no such notion */
 	float rotation;
 	float translation[2];
+	/* Used for rotation, the island will rotate around this point */
+	float medianPoint[2];
 	int numOfElements;
 	/* Flag to remember if island has been aded for preview */
 	char addedForPreview;
@@ -1379,7 +1381,7 @@
 						EditVert *vt = *(&(editFace->v1)+i);
 						/* ...we'll iterate through all shared UV's of the corresponding vertex */
 						el_iter = vmap->vert[vt->tmp.l];
-						/* Original vertex will be previewed, of course */
+						/* Original vertex will be previewed, of course, so increasing the preview count for original geometry */
 						preview->numOfOrig++;
 
 						/* First we need the UVMapVert that corresponds to our uv */
@@ -1653,7 +1655,7 @@
 								uv_average[index2].uv[0] += uv_average_tmp[1].uv[0];
 								uv_average[index2].uv[1] += uv_average_tmp[1].uv[1];
 								if(state->snapIslands){
-									island_stitch_data[commonVertMaps[stack_iter]->island].addedForPreview = 1;
+									island_stitch_data[commonVertMaps2[stack_iter]->island].addedForPreview = 1;
 								}
 								else {
 									stitch_update_face_preview_index(efa, preview);
@@ -1787,6 +1789,29 @@
 					preview->previewOrig[bufferIterator*4 + 1] = mt->uv[element->tfindex][1];
 					preview->previewOrig[bufferIterator*4 + 2] = mt->uv[(element->tfindex + 1)%nverts][0];
 					preview->previewOrig[bufferIterator*4 + 3] = mt->uv[(element->tfindex + 1)%nverts][1];
+
+					/* we will have to calculate the rotation of the edges here */
+					if(state->snapIslands && element->flag & STITCH_EDGE_STITCHABLE){
+						float uv1[2], uv2[2];
+
+						efa = element->face;
+						nverts = (efa->v4)? 4 : 3;
+						mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
+
+						/* grab original uv's*/
+						uv1[0] = mt->uv[(element->tfindex + 1)%nverts][0] - mt->uv[element->tfindex][0];
+						uv1[1] = mt->uv[(element->tfindex + 1)%nverts][1] - mt->uv[element->tfindex][1];
+
+						//uv2[0] = ;
+						//uv2[1] = ;
+
+						/* The idea here is to take the directions of the edges and find the rotation between final and initial
+						 * edge */
+						normalize_v2(uv1);
+						//normalize_v2(uv2);
+
+					}
+
 					if(element->flag & STITCH_EDGE_STITCHABLE){
 						preview->previewOrigColors[bufferIterator*2] = 0x0000FF00;
 						preview->previewOrigColors[bufferIterator*2 + 1] = 0x0000FF00;




More information about the Bf-blender-cvs mailing list