[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38539] branches/soc-2011-onion/source/ blender/editors: smart stitch commit #+infinity+-1
Antony Riakiotakis
kalast at gmail.com
Wed Jul 20 16:15:34 CEST 2011
Revision: 38539
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38539
Author: psy-fi
Date: 2011-07-20 14:15:34 +0000 (Wed, 20 Jul 2011)
Log Message:
-----------
smart stitch commit #+infinity+-1
============================
-Preview works corectly for vertex stitching though final calculation on operator finished is not performed yet
Modified Paths:
--------------
branches/soc-2011-onion/source/blender/editors/mesh/editmesh_lib.c
branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c
Modified: branches/soc-2011-onion/source/blender/editors/mesh/editmesh_lib.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/mesh/editmesh_lib.c 2011-07-20 13:34:28 UTC (rev 38538)
+++ branches/soc-2011-onion/source/blender/editors/mesh/editmesh_lib.c 2011-07-20 14:15:34 UTC (rev 38539)
@@ -2553,11 +2553,6 @@
}
}
-#if 1
- for(i = 0; i < totuv; i++){
- printf("island index %d\n", islandbuf[i].island);
- }
-#endif
MEM_freeN(vmap->buf);
vmap->buf = islandbuf;
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 13:34:28 UTC (rev 38538)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c 2011-07-20 14:15:34 UTC (rev 38539)
@@ -1251,7 +1251,7 @@
typedef struct IslandStitchData{
/* rotation can be used only for edges, for vertices there is no such notion */
float rotation;
- float translation;
+ float translation[2];
int numOfElements;
/* Flag to remember if island has been aded for preview */
char addedForPreview;
@@ -1574,8 +1574,6 @@
}
if(element->flag & STITCH_STITCHABLE &&
element2->flag & STITCH_STITCHABLE){
- UvElement *tmp_iter;
- int index_tmp;
/* update uv's on the update stack */
for(stack_iter = 0; stack_iter < stackSize1; stack_iter++){
@@ -1677,7 +1675,11 @@
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++;
+ }
preview->previewOrig[bufferIterator*2] = mt->uv[element->tfindex][0];
preview->previewOrig[bufferIterator*2 + 1] = mt->uv[element->tfindex][1];
/* stitchable uv's will be green, non-stitchable red */
@@ -1741,9 +1743,52 @@
bufferIterator++;
}
}
- element->flag = 0;
+ if(!state->snapIslands){
+ element->flag = 0;
+ }
}
+
+ /* Calculate */
+ if(state->snapIslands){
+ for(i = 0; i < state->vmap->numOfIslands; i++){
+ if(island_stitch_data[i].addedForPreview){
+ int previewIslandUVs = 0, j;
+
+ island_stitch_data[i].translation[0] /= island_stitch_data[i].numOfElements;
+ island_stitch_data[i].translation[1] /= island_stitch_data[i].numOfElements;
+
+ if(i == state->vmap->numOfIslands-1){
+ previewIslandUVs = state->vmap->numOfUVs - state->vmap->islandIndices[i];
+ }else{
+ previewIslandUVs = state->vmap->islandIndices[i+1] - state->vmap->islandIndices[i];
+ }
+
+ element = &state->vmap->buf[state->vmap->islandIndices[i]];
+ for(j = 0; j < previewIslandUVs; j++, element++){
+ /* stitchable uvs have already been processed, don't process */
+ if(!(element->flag & STITCH_STITCHABLE)){
+ efa = element->face;
+ mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
+
+ if(efa->v4){
+ preview->previewQuads[efa->tmp.l + 2*element->tfindex] += island_stitch_data[i].translation[0];
+ preview->previewQuads[efa->tmp.l + 2*element->tfindex + 1] += island_stitch_data[i].translation[1];
+ }
+ else {
+ preview->previewTris[efa->tmp.l + 2*element->tfindex] += island_stitch_data[i].translation[0];
+ preview->previewTris[efa->tmp.l + 2*element->tfindex + 1] += island_stitch_data[i].translation[1];
+ }
+
+ element->flag = 0;
+ }
+ }
+ }
+ }
+ }
}
+
+
+
if(final)
{
for(element = vmap->buf, i = 0; i < state->vmap->numOfUVs; element++, i++){
More information about the Bf-blender-cvs
mailing list