[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37883] branches/soc-2011-onion/source/ blender/editors/uvedit/uvedit_ops.c: smart welding - bug squashed
Antony Riakiotakis
kalast at gmail.com
Tue Jun 28 04:09:45 CEST 2011
Revision: 37883
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37883
Author: psy-fi
Date: 2011-06-28 02:09:42 +0000 (Tue, 28 Jun 2011)
Log Message:
-----------
smart welding - bug squashed
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-28 01:08:06 UTC (rev 37882)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c 2011-06-28 02:09:42 UTC (rev 37883)
@@ -1283,6 +1283,9 @@
* this too many times on the fly */
commonVertMaps = MEM_mallocN(state->em->totface*sizeof(UvMapVert *), "commonVertMaps");
+ for(mapVert = vmap->buf, i = 0; i < state->vmap->numOfUVs; mapVert++, i++){
+ mapVert->flag = 0;
+ }
if(state->mode == VERT_STITCH){
/* Count number of points/faces so that we allocate appropriate buffer */
for(editFace = state->em->faces.first ; editFace; editFace=editFace->next){
@@ -1307,14 +1310,11 @@
/* First we need the UVMapVert that corresponds to our uv */
for(;mv_iter; mv_iter = mv_iter->next)
{
- UvMapVert *sep;
- if(mv_iter->separate)
- sep = mv_iter;
/* Here we assume face does not use the same vertex twice. */
if(faceArray[mv_iter->f] == editFace)
{
/* Assign first UV coincident */
- mapVert = sep;
+ mapVert = mv_iter;
averageIndex = mapVert - vmap->buf;
}
}
@@ -1381,11 +1381,11 @@
mv_iter->flag |= STITCH_STITCHABLE;
mv_iter->flag |= STITCH_PROCESSED;
- /* += because of a complex scenario involving */
- uv_average[averageIndex2].count = uv_average[averageIndex].count;
- uv_average[averageIndex2].uv[0] = uv_average[averageIndex].uv[0];
- uv_average[averageIndex2].uv[1] = uv_average[averageIndex].uv[1];
+ uv_average[averageIndex2].count += uv_average[averageIndex].count;
+ uv_average[averageIndex2].uv[0] += uv_average[averageIndex].uv[0];
+ uv_average[averageIndex2].uv[1] += uv_average[averageIndex].uv[1];
+
if(efa->tmp.l == -1)
{
if(efa->v4)
@@ -1403,12 +1403,12 @@
}
}
}
-
- MEM_freeN(commonVertMaps);
-
} else {
}
+
+ MEM_freeN(commonVertMaps);
+
if(!final)
{
/* Initialize the preview buffers */
@@ -1433,19 +1433,16 @@
for(mapVert = vmap->buf, i = 0; i < state->vmap->numOfUVs; mapVert++, i++){
if(mapVert->flag & STITCH_STITCHABLE){
float uv[2];
- int averageBufIndex;
efa = faceArray[mapVert->f];
mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
- averageBufIndex = mapVert - vmap->buf;
- uv[0] = uv_average[averageBufIndex].uv[0]/uv_average[averageBufIndex].count;
- uv[1] = uv_average[averageBufIndex].uv[1]/uv_average[averageBufIndex].count;
+ uv[0] = uv_average[i].uv[0]/uv_average[i].count;
+ uv[1] = uv_average[i].uv[1]/uv_average[i].count;
preview->previewPoints[bufferIterator*2] = mt->uv[mapVert->tfindex][0];
preview->previewPoints[bufferIterator*2 + 1] = mt->uv[mapVert->tfindex][1];
/* stitchable uv's will be green, non-stitchable red */
preview->previewPointColors[bufferIterator] = 0x0000FF00;
-
if(efa->v4){
preview->previewQuads[efa->tmp.l + 2*mapVert->tfindex] = uv[0];
preview->previewQuads[efa->tmp.l + 2*mapVert->tfindex + 1] = uv[1];
@@ -1476,14 +1473,12 @@
for(mapVert = vmap->buf, i = 0; i < state->vmap->numOfUVs; mapVert++, i++){
if(mapVert->flag & STITCH_STITCHABLE){
float uv[2];
- int averageBufIndex;
efa = faceArray[mapVert->f];
mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
- averageBufIndex = mapVert - vmap->buf;
- uv[0] = uv_average[averageBufIndex].uv[0]/uv_average[averageBufIndex].count;
- uv[1] = uv_average[averageBufIndex].uv[1]/uv_average[averageBufIndex].count;
+ uv[0] = uv_average[i].uv[0]/uv_average[i].count;
+ uv[1] = uv_average[i].uv[1]/uv_average[i].count;
mt->uv[mapVert->tfindex][0] = uv[0];
mt->uv[mapVert->tfindex][1] = uv[1];
More information about the Bf-blender-cvs
mailing list