[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38541] branches/soc-2011-onion/source/ blender/editors/uvedit/uvedit_ops.c: smart stitch commit #+infinity+-3.14/( R*2)+Integrate(Exp(x)*2, 0, infinity)/2
Antony Riakiotakis
kalast at gmail.com
Wed Jul 20 16:56:41 CEST 2011
Revision: 38541
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38541
Author: psy-fi
Date: 2011-07-20 14:56:40 +0000 (Wed, 20 Jul 2011)
Log Message:
-----------
smart stitch commit #+infinity+-3.14/(R*2)+Integrate(Exp(x)*2, 0, infinity)/2
============================
-Island snapping for edge selection
-Todo is calculate rotation for edge snapping, coming soon
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 14:36:25 UTC (rev 38540)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c 2011-07-20 14:56:40 UTC (rev 38541)
@@ -1118,6 +1118,20 @@
/* ******************** stitch operator **************** */
+
+struct IslandStitchData;
+
+/* This is a straightforward implementation, count the uv's in the island that will move and take the mean displacement/rotation and apply it to all
+ * elements of the island except from the stitchable */
+typedef struct IslandStitchData{
+ /* rotation can be used only for edges, for vertices there is no such notion */
+ float rotation;
+ float translation[2];
+ int numOfElements;
+ /* Flag to remember if island has been aded for preview */
+ char addedForPreview;
+}IslandStitchData;
+
/* just for averaging UVs */
typedef struct UVVertAverage {
float uv[2];
@@ -1244,20 +1258,7 @@
}
}
-struct IslandStitchData;
-/* This is a straightforward implementation, count the uv's in the island that will move and take the mean displacement/rotation and apply it to all
- * elements of the island except from the stitchable */
-typedef struct IslandStitchData{
- /* rotation can be used only for edges, for vertices there is no such notion */
- float rotation;
- float translation[2];
- int numOfElements;
- /* Flag to remember if island has been aded for preview */
- char addedForPreview;
-}IslandStitchData;
-
-
/* Calculate snapping for islands */
static void stitch_calculate_island_snapping(StitchState *state, StitchPreviewer *preview, IslandStitchData *island_stitch_data, int final){
int i;
@@ -1665,6 +1666,7 @@
}
}
}
+ MEM_freeN(commonVertMaps);
if(state->snapIslands){
for(i = 0; i < state->vmap->numOfIslands; i++){
@@ -1684,10 +1686,6 @@
}
}
- MEM_freeN(commonVertMaps);
-
-
-
if(!final)
{
/* Initialize the preview buffers */
@@ -1753,6 +1751,7 @@
bufferIterator++;
}
}else{
+ /* Edge stitching case */
if(element->flag & STITCH_STITCHABLE){
float uv[2];
int nverts;
@@ -1762,6 +1761,13 @@
uv[0] = uv_average[i].uv[0]/uv_average[i].count;
uv[1] = uv_average[i].uv[1]/uv_average[i].count;
+
+ if(state->snapIslands){
+ island_stitch_data[element->island].translation[0] += uv[0] - mt->uv[element->tfindex][0];
+ island_stitch_data[element->island].translation[1] += uv[1] - mt->uv[element->tfindex][1];
+ island_stitch_data[element->island].numOfElements++;
+ }
+
if(efa->v4){
preview->previewQuads[efa->tmp.l + 2*element->tfindex] = uv[0];
preview->previewQuads[efa->tmp.l + 2*element->tfindex + 1] = uv[1];
More information about the Bf-blender-cvs
mailing list