[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37971] branches/soc-2011-onion/source/ blender/editors/uvedit/uvedit_ops.c: smart stitch - yet a few bugs pinned to the wall, almost there
Antony Riakiotakis
kalast at gmail.com
Thu Jun 30 04:32:49 CEST 2011
Revision: 37971
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37971
Author: psy-fi
Date: 2011-06-30 02:32:47 +0000 (Thu, 30 Jun 2011)
Log Message:
-----------
smart stitch - yet a few bugs pinned to the wall, almost there
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-06-30 02:02:16 UTC (rev 37970)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c 2011-06-30 02:32:47 UTC (rev 37971)
@@ -1240,7 +1240,6 @@
EditFace *editFace, *efa;
//**faceArray;
EditVert *editVert;
- EditEdge *editEdge;
/* This holds uv's that must be updated if the initial uv is stitchable. */
UvElement **commonVertMaps;
@@ -1397,7 +1396,9 @@
if(mt->flag & TF_SEL_MASK(i) && mt->flag & TF_SEL_MASK((i+1)%vertsPerFace))
{
EditVert *v1, *v2;
- UvElement *el_iter, *element2;
+ /* The sep hold the first UVElement coincident with our elements. If edge
+ * is stitchable we must update all these. */
+ UvElement *el_iter, *element2, *el_sep1, *el_sep2, *iter_sep1, *iter_sep2;
float uv1[2][2];
int nverts, stack_iter;
int stackSize = 0;
@@ -1413,6 +1414,8 @@
/* Find the uv element that matches the current face */
for(el_iter = vmap->vert[v1->tmp.l]; el_iter; el_iter = el_iter->next){
+ if(el_iter->separate)
+ el_sep1 = el_iter;
efa = el_iter->face;
nverts = efa->v4 ? 4 : 3;
if(efa == editFace){
@@ -1420,6 +1423,8 @@
element = el_iter;
/* Find the uv element for the other uv too */
for(el_iter2 = vmap->vert[v2->tmp.l]; el_iter2; el_iter2 = el_iter2->next){
+ if(el_iter2->separate)
+ el_sep2 = el_iter;
if(el_iter2->face == efa){
element2 = el_iter2;
break;
@@ -1433,17 +1438,16 @@
index2 = element2 - vmap->buf;
element->flag |= STITCH_PROCESSED;
- element2->flag |= STITCH_PROCESSED;
element->flag |= STITCH_EDGE_PREVIEW;
preview->numOfOrig++;
- uv_average[index1].count++;
- uv_average[index2].count++;
+ uv_average_tmp[0].count++;
+ uv_average_tmp[1].count++;
- uv_average[index1].uv[0] = uv1[0][0] = mt->uv[element->tfindex][0];
- uv_average[index1].uv[1] = uv1[0][1] = mt->uv[element->tfindex][1];
- uv_average[index2].uv[0] = uv1[1][0] = mt->uv[(element2->tfindex)][0];
- uv_average[index2].uv[1] = uv1[1][1] = mt->uv[(element2->tfindex)][1];
+ uv_average_tmp[0].uv[0] = uv1[0][0] = mt->uv[element->tfindex][0];
+ uv_average_tmp[0].uv[1] = uv1[0][1] = mt->uv[element->tfindex][1];
+ uv_average_tmp[1].uv[0] = uv1[1][0] = mt->uv[(element2->tfindex)][0];
+ uv_average_tmp[1].uv[1] = uv1[1][1] = mt->uv[(element2->tfindex)][1];
/* Now iterate through all faces and find potential stitchable edges */
for(el_iter = vmap->vert[v1->tmp.l]; el_iter; el_iter = el_iter->next){
@@ -1452,9 +1456,11 @@
MTFace *tmptface;
efa = el_iter->face;
nverts = (efa->v4)? 4 : 3;
+ if(el_iter->separate)
+ iter_sep1 = el_iter;
/* Check to see if both vertices exist on the edge of the new face */
- if((vertCheck = (*(&efa->v1 + (element->tfindex + 1)%nverts) == v2))
- || (*(&efa->v1 + (element->tfindex + nverts - 1)%nverts) == v2)){
+ if((vertCheck = (*(&efa->v1 + (el_iter->tfindex + 1)%nverts) == v2))
+ || (*(&efa->v1 + (el_iter->tfindex + nverts - 1)%nverts) == v2)){
tmptface = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
@@ -1496,13 +1502,22 @@
/* We need the UvMapVert of the other uv too. */
for(el_iter2 = vmap->vert[v2->tmp.l]; el_iter2; el_iter2 = el_iter2->next){
+ if(el_iter2->separate)
+ iter_sep2 = el_iter;
if(el_iter2->face == efa)
break;
}
+ /* push coincident uv's to the stack to be updated */
+ /*for(el_iter2 = vmap->vert[v2->tmp.l]; el_iter2; el_iter2 = el_iter2->next){
+ if(el_iter2->separate && el_iter2 != iter_sep)
+ break;
+
+ }*/
commonVertMaps[stackSize] = el_iter;
- commonVertMaps2[stackSize++] = el_iter2;
+ commonVertMaps2[stackSize] = el_iter2;
+ stackSize++;
if(vertCheck)
{
/* convention is to use the vertex at the beginning of the edge. This avoids ambiguity
More information about the Bf-blender-cvs
mailing list