Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2007-09-25 11:42:55 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-09-25 11:42:55 +0400
commitea32119d0b81260c5c58e66240d0c107c336f0b9 (patch)
treec499a39b2a0cca75ad2e1af8983627dd5a452cc0 /source/blender/src/editsima.c
parent7658066fe95677dfe5ff8aaff9f4f9458a5d01a9 (diff)
snap transform for UV editing, missing the draw circle at the moment.
Diffstat (limited to 'source/blender/src/editsima.c')
-rw-r--r--source/blender/src/editsima.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/source/blender/src/editsima.c b/source/blender/src/editsima.c
index 91220be6009..1b1c4c251d2 100644
--- a/source/blender/src/editsima.c
+++ b/source/blender/src/editsima.c
@@ -479,7 +479,7 @@ static int nearest_uv_between(MTFace *tf, int nverts, int id, short *mval, int *
return (c1*c2 >= 0.0f);
}
-static void find_nearest_uv(MTFace **nearesttf, EditFace **nearestefa, unsigned int *nearestv, int *nearestuv)
+void find_nearest_uv(MTFace **nearesttf, EditFace **nearestefa, unsigned int *nearestv, int *nearestuv)
{
EditMesh *em= G.editMesh;
EditFace *efa;
@@ -490,8 +490,14 @@ static void find_nearest_uv(MTFace **nearesttf, EditFace **nearestefa, unsigned
getmouseco_areawin(mval);
mindist= 0x7FFFFFF;
- *nearesttf= NULL;
- *nearestefa= NULL;
+ if (nearesttf) *nearesttf= NULL;
+ if (nearestefa) *nearestefa= NULL;
+
+ if (nearestv) {
+ EditVert *ev;
+ for (i=0, ev=em->verts.first; ev; ev = ev->next, i++)
+ ev->tmp.l = i;
+ }
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
@@ -509,16 +515,17 @@ static void find_nearest_uv(MTFace **nearesttf, EditFace **nearestefa, unsigned
if (!nearest_uv_between(tf, nverts, i, mval, uval))
continue;
- mindist= dist;
-
- *nearesttf= tf;
- *nearestefa= efa;
+ mindist= dist;
*nearestuv= i;
-
- if (i==0) *nearestv= efa->v1->tmp.l;
- else if (i==1) *nearestv= efa->v2->tmp.l;
- else if (i==2) *nearestv= efa->v3->tmp.l;
- else *nearestv= efa->v4->tmp.l;
+
+ if (nearesttf) *nearesttf= tf;
+ if (nearestefa) *nearestefa= efa;
+ if (nearestv) {
+ if (i==0) *nearestv= efa->v1->tmp.l;
+ else if (i==1) *nearestv= efa->v2->tmp.l;
+ else if (i==2) *nearestv= efa->v3->tmp.l;
+ else *nearestv= efa->v4->tmp.l;
+ }
}
}
}