- rewrote UV Stitch, (seperate from limit stitch now), does much less
work for same results. - UV Stitch with the V key was not working (as stated in the menu) - Rotate UV's and Colors now have an option for CCW (was in the menu but not implimented) - Draw face dot in UV when in face mode
This commit is contained in:
@@ -93,7 +93,8 @@ void mirrormenu_tface_uv(void);
|
||||
void mirror_tface_uv(char mirroraxis);
|
||||
void hide_tface_uv(int swap);
|
||||
void reveal_tface_uv(void);
|
||||
void stitch_uv_tface(int mode);
|
||||
void stitch_limit_uv_tface(void);
|
||||
void stitch_vert_uv_tface(void);
|
||||
void unlink_selection(void);
|
||||
void select_linked_tface_uv(int mode);
|
||||
void pin_tface_uv(int mode);
|
||||
|
@@ -445,10 +445,31 @@ static void drawcursor_sima(float xuser_asp, float yuser_asp)
|
||||
setlinestyle(0);
|
||||
}
|
||||
|
||||
// checks if we are selecting only faces
|
||||
static int draw_uvs_face_check(void)
|
||||
{
|
||||
if (G.sima==NULL)
|
||||
return 0;
|
||||
if (G.sima->flag & SI_SYNC_UVSEL && G.scene->selectmode == SCE_SELECT_FACE)
|
||||
return 1;
|
||||
if (G.sima->flag & SI_SELACTFACE)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tface_center(MTFace *tf, float cent[2], void * isquad)
|
||||
{
|
||||
|
||||
if (isquad) {
|
||||
cent[0] = (tf->uv[0][0] + tf->uv[1][0] + tf->uv[2][0] + tf->uv[3][0]) / 4.0;
|
||||
cent[1] = (tf->uv[0][1] + tf->uv[1][1] + tf->uv[2][1] + tf->uv[3][1]) / 4.0;
|
||||
} else {
|
||||
cent[0] = (tf->uv[0][0] + tf->uv[1][0] + tf->uv[2][0]) / 3.0;
|
||||
cent[1] = (tf->uv[0][1] + tf->uv[1][1] + tf->uv[2][1]) / 3.0;
|
||||
}
|
||||
}
|
||||
|
||||
/* draws uv's in the image space */
|
||||
|
||||
|
||||
|
||||
void draw_uvs_sima(void)
|
||||
{
|
||||
MTFace *tface,*activetface = NULL;
|
||||
@@ -457,10 +478,13 @@ void draw_uvs_sima(void)
|
||||
|
||||
char col1[4], col2[4];
|
||||
float pointsize;
|
||||
int drawface;
|
||||
|
||||
if (!G.obedit || !CustomData_has_layer(&em->fdata, CD_MTFACE))
|
||||
return;
|
||||
|
||||
drawface = draw_uvs_face_check();
|
||||
|
||||
calc_image_view(G.sima, 'f'); /* float */
|
||||
myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
|
||||
glLoadIdentity();
|
||||
@@ -686,74 +710,120 @@ void draw_uvs_sima(void)
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
/* unselected uv's */
|
||||
BIF_ThemeColor(TH_VERTEX);
|
||||
pointsize = BIF_GetThemeValuef(TH_VERTEX_SIZE);
|
||||
glPointSize(pointsize);
|
||||
|
||||
bglBegin(GL_POINTS);
|
||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||
if (drawface) {
|
||||
// draw UV face points
|
||||
float cent[2];
|
||||
|
||||
// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
|
||||
|
||||
/*this is a shortcut to do the same as above but a faster for drawing */
|
||||
if ((tface=(MTFace *)efa->tmp.p)) {
|
||||
/* unselected faces's */
|
||||
pointsize = BIF_GetThemeValuef(TH_FACEDOT_SIZE);
|
||||
// TODO - drawobject.c changes this value after - Investiagate!
|
||||
glPointSize(pointsize);
|
||||
|
||||
if(SIMA_UVSEL_CHECK(efa, tface, 0)); else bglVertex2fv(tface->uv[0]);
|
||||
if(SIMA_UVSEL_CHECK(efa, tface, 1)); else bglVertex2fv(tface->uv[1]);
|
||||
if(SIMA_UVSEL_CHECK(efa, tface, 2)); else bglVertex2fv(tface->uv[2]);
|
||||
if(efa->v4) {
|
||||
if(SIMA_UVSEL_CHECK(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
bglEnd();
|
||||
|
||||
/* pinned uv's */
|
||||
/* give odd pointsizes odd pin pointsizes */
|
||||
glPointSize(pointsize*2 + (((int)pointsize % 2)? (-1): 0));
|
||||
cpack(0xFF);
|
||||
|
||||
bglBegin(GL_POINTS);
|
||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||
// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
|
||||
|
||||
/*this is a shortcut to do the same as above but a faster for drawing */
|
||||
if ((tface=(MTFace *)efa->tmp.p)) {
|
||||
BIF_ThemeColor(TH_WIRE);
|
||||
bglBegin(GL_POINTS);
|
||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||
|
||||
if(tface->unwrap & TF_PIN1) bglVertex2fv(tface->uv[0]);
|
||||
if(tface->unwrap & TF_PIN2) bglVertex2fv(tface->uv[1]);
|
||||
if(tface->unwrap & TF_PIN3) bglVertex2fv(tface->uv[2]);
|
||||
if(efa->v4) {
|
||||
if(tface->unwrap & TF_PIN4) bglVertex2fv(tface->uv[3]);
|
||||
// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
|
||||
|
||||
/*this is a shortcut to do the same as above but a faster for drawing */
|
||||
if ((tface=(MTFace *)efa->tmp.p)) {
|
||||
if( ! SIMA_FACESEL_CHECK(efa, tface) ) {
|
||||
tface_center(tface, cent, (void *)efa->v4);
|
||||
bglVertex2fv(cent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bglEnd();
|
||||
|
||||
/* selected uv's */
|
||||
BIF_ThemeColor(TH_VERTEX_SELECT);
|
||||
glPointSize(pointsize);
|
||||
|
||||
bglBegin(GL_POINTS);
|
||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||
// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
|
||||
|
||||
/*this is a shortcut to do the same as above but a faster for drawing */
|
||||
if ((tface=(MTFace *)efa->tmp.p)) {
|
||||
|
||||
if(!SIMA_UVSEL_CHECK(efa, tface, 0)); else bglVertex2fv(tface->uv[0]);
|
||||
if(!SIMA_UVSEL_CHECK(efa, tface, 1)); else bglVertex2fv(tface->uv[1]);
|
||||
if(!SIMA_UVSEL_CHECK(efa, tface, 2)); else bglVertex2fv(tface->uv[2]);
|
||||
if(efa->v4) {
|
||||
if(!SIMA_UVSEL_CHECK(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
|
||||
bglEnd();
|
||||
/* selected faces's */
|
||||
BIF_ThemeColor(TH_FACE_DOT);
|
||||
bglBegin(GL_POINTS);
|
||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||
|
||||
// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
|
||||
|
||||
/*this is a shortcut to do the same as above but a faster for drawing */
|
||||
if ((tface=(MTFace *)efa->tmp.p)) {
|
||||
if( SIMA_FACESEL_CHECK(efa, tface) ) {
|
||||
tface_center(tface, cent, (void *)efa->v4);
|
||||
bglVertex2fv(cent);
|
||||
}
|
||||
}
|
||||
}
|
||||
bglEnd();
|
||||
} else {
|
||||
|
||||
/* unselected uv's */
|
||||
BIF_ThemeColor(TH_VERTEX);
|
||||
pointsize = BIF_GetThemeValuef(TH_VERTEX_SIZE);
|
||||
glPointSize(pointsize);
|
||||
|
||||
bglBegin(GL_POINTS);
|
||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||
|
||||
// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
|
||||
|
||||
/*this is a shortcut to do the same as above but a faster for drawing */
|
||||
if ((tface=(MTFace *)efa->tmp.p)) {
|
||||
|
||||
if(SIMA_UVSEL_CHECK(efa, tface, 0)); else bglVertex2fv(tface->uv[0]);
|
||||
if(SIMA_UVSEL_CHECK(efa, tface, 1)); else bglVertex2fv(tface->uv[1]);
|
||||
if(SIMA_UVSEL_CHECK(efa, tface, 2)); else bglVertex2fv(tface->uv[2]);
|
||||
if(efa->v4) {
|
||||
if(SIMA_UVSEL_CHECK(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
bglEnd();
|
||||
|
||||
/* pinned uv's */
|
||||
/* give odd pointsizes odd pin pointsizes */
|
||||
glPointSize(pointsize*2 + (((int)pointsize % 2)? (-1): 0));
|
||||
cpack(0xFF);
|
||||
|
||||
bglBegin(GL_POINTS);
|
||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||
// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
|
||||
|
||||
/*this is a shortcut to do the same as above but a faster for drawing */
|
||||
if ((tface=(MTFace *)efa->tmp.p)) {
|
||||
|
||||
if(tface->unwrap & TF_PIN1) bglVertex2fv(tface->uv[0]);
|
||||
if(tface->unwrap & TF_PIN2) bglVertex2fv(tface->uv[1]);
|
||||
if(tface->unwrap & TF_PIN3) bglVertex2fv(tface->uv[2]);
|
||||
if(efa->v4) {
|
||||
if(tface->unwrap & TF_PIN4) bglVertex2fv(tface->uv[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
bglEnd();
|
||||
|
||||
/* selected uv's */
|
||||
BIF_ThemeColor(TH_VERTEX_SELECT);
|
||||
glPointSize(pointsize);
|
||||
|
||||
bglBegin(GL_POINTS);
|
||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||
// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
|
||||
|
||||
/*this is a shortcut to do the same as above but a faster for drawing */
|
||||
if ((tface=(MTFace *)efa->tmp.p)) {
|
||||
|
||||
if(!SIMA_UVSEL_CHECK(efa, tface, 0)); else bglVertex2fv(tface->uv[0]);
|
||||
if(!SIMA_UVSEL_CHECK(efa, tface, 1)); else bglVertex2fv(tface->uv[1]);
|
||||
if(!SIMA_UVSEL_CHECK(efa, tface, 2)); else bglVertex2fv(tface->uv[2]);
|
||||
if(efa->v4) {
|
||||
if(!SIMA_UVSEL_CHECK(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
bglEnd();
|
||||
}
|
||||
bglEnd();
|
||||
glPointSize(1.0);
|
||||
}
|
||||
|
||||
|
@@ -6559,7 +6559,7 @@ void mesh_rotate_uvs(void)
|
||||
{
|
||||
EditMesh *em = G.editMesh;
|
||||
EditFace *efa;
|
||||
short change = 0;
|
||||
short change = 0, ccw;
|
||||
MTFace *tf;
|
||||
float u1, v1;
|
||||
|
||||
@@ -6568,28 +6568,49 @@ void mesh_rotate_uvs(void)
|
||||
return;
|
||||
}
|
||||
|
||||
ccw = (G.qual == LR_SHIFTKEY);
|
||||
|
||||
for(efa=em->faces.first; efa; efa=efa->next) {
|
||||
if (efa->f & SELECT) {
|
||||
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
u1= tf->uv[0][0];
|
||||
v1= tf->uv[0][1];
|
||||
|
||||
tf->uv[0][0]= tf->uv[1][0];
|
||||
tf->uv[0][1]= tf->uv[1][1];
|
||||
|
||||
tf->uv[1][0]= tf->uv[2][0];
|
||||
tf->uv[1][1]= tf->uv[2][1];
|
||||
|
||||
if(efa->v4) {
|
||||
tf->uv[2][0]= tf->uv[3][0];
|
||||
tf->uv[2][1]= tf->uv[3][1];
|
||||
|
||||
tf->uv[3][0]= u1;
|
||||
tf->uv[3][1]= v1;
|
||||
}
|
||||
else {
|
||||
tf->uv[2][0]= u1;
|
||||
tf->uv[2][1]= v1;
|
||||
if (ccw) {
|
||||
if(efa->v4) {
|
||||
tf->uv[0][0]= tf->uv[3][0];
|
||||
tf->uv[0][1]= tf->uv[3][1];
|
||||
|
||||
tf->uv[3][0]= tf->uv[2][0];
|
||||
tf->uv[3][1]= tf->uv[2][1];
|
||||
} else {
|
||||
tf->uv[0][0]= tf->uv[2][0];
|
||||
tf->uv[0][1]= tf->uv[2][1];
|
||||
}
|
||||
|
||||
tf->uv[2][0]= tf->uv[1][0];
|
||||
tf->uv[2][1]= tf->uv[1][1];
|
||||
|
||||
tf->uv[1][0]= u1;
|
||||
tf->uv[1][1]= v1;
|
||||
} else {
|
||||
tf->uv[0][0]= tf->uv[1][0];
|
||||
tf->uv[0][1]= tf->uv[1][1];
|
||||
|
||||
tf->uv[1][0]= tf->uv[2][0];
|
||||
tf->uv[1][1]= tf->uv[2][1];
|
||||
|
||||
if(efa->v4) {
|
||||
tf->uv[2][0]= tf->uv[3][0];
|
||||
tf->uv[2][1]= tf->uv[3][1];
|
||||
|
||||
tf->uv[3][0]= u1;
|
||||
tf->uv[3][1]= v1;
|
||||
}
|
||||
else {
|
||||
tf->uv[2][0]= u1;
|
||||
tf->uv[2][1]= v1;
|
||||
}
|
||||
}
|
||||
change = 1;
|
||||
}
|
||||
@@ -6657,27 +6678,40 @@ void mesh_rotate_colors(void)
|
||||
{
|
||||
EditMesh *em = G.editMesh;
|
||||
EditFace *efa;
|
||||
short change = 0;
|
||||
short change = 0, ccw;
|
||||
MCol tmpcol, *mcol;
|
||||
if (!EM_vertColorCheck()) {
|
||||
error("mesh has no color layers");
|
||||
return;
|
||||
}
|
||||
|
||||
ccw = (G.qual == LR_SHIFTKEY);
|
||||
|
||||
for(efa=em->faces.first; efa; efa=efa->next) {
|
||||
if (efa->f & SELECT) {
|
||||
mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
|
||||
tmpcol= mcol[0];
|
||||
|
||||
mcol[0]= mcol[1];
|
||||
mcol[1]= mcol[2];
|
||||
|
||||
if(efa->v4) {
|
||||
mcol[2]= mcol[3];
|
||||
mcol[3]= tmpcol;
|
||||
if (ccw) {
|
||||
if(efa->v4) {
|
||||
mcol[0]= mcol[3];
|
||||
mcol[3]= mcol[2];
|
||||
} else {
|
||||
mcol[0]= mcol[2];
|
||||
}
|
||||
mcol[2]= mcol[1];
|
||||
mcol[1]= tmpcol;
|
||||
} else {
|
||||
mcol[0]= mcol[1];
|
||||
mcol[1]= mcol[2];
|
||||
|
||||
if(efa->v4) {
|
||||
mcol[2]= mcol[3];
|
||||
mcol[3]= tmpcol;
|
||||
}
|
||||
else
|
||||
mcol[2]= tmpcol;
|
||||
}
|
||||
else
|
||||
mcol[2]= tmpcol;
|
||||
change = 1;
|
||||
}
|
||||
}
|
||||
|
@@ -308,16 +308,100 @@ void weld_align_tface_uv(char tool)
|
||||
object_uvs_changed(OBACT);
|
||||
}
|
||||
|
||||
// just for averaging UV's
|
||||
typedef struct UVVertAverage {
|
||||
float uv[2];
|
||||
int count;
|
||||
} UVVertAverage;
|
||||
|
||||
void stitch_vert_uv_tface(void)
|
||||
{
|
||||
EditMesh *em = G.editMesh;
|
||||
EditFace *efa;
|
||||
EditVert *eve;
|
||||
MTFace *tface;
|
||||
int count;
|
||||
UVVertAverage *uv_average, *uvav;
|
||||
|
||||
if( is_uv_tface_editing_allowed()==0 ) return;
|
||||
|
||||
// index and count verts
|
||||
for (count=0, eve=em->verts.first; eve; count++, eve= eve->next) {
|
||||
eve->tmp.l = count;
|
||||
}
|
||||
|
||||
uv_average = MEM_callocN(sizeof(UVVertAverage) * count, "Stitch");
|
||||
|
||||
// gather uv averages per vert
|
||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||
tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
if (SIMA_FACEDRAW_CHECK(efa, tface)) {
|
||||
if (SIMA_UVSEL_CHECK(efa, tface, 0)) {
|
||||
uvav = uv_average + efa->v1->tmp.l;
|
||||
uvav->count++;
|
||||
uvav->uv[0] += tface->uv[0][0];
|
||||
uvav->uv[1] += tface->uv[0][1];
|
||||
}
|
||||
if (SIMA_UVSEL_CHECK(efa, tface, 1)) {
|
||||
uvav = uv_average + efa->v2->tmp.l;
|
||||
uvav->count++;
|
||||
uvav->uv[0] += tface->uv[1][0];
|
||||
uvav->uv[1] += tface->uv[1][1];
|
||||
}
|
||||
if (SIMA_UVSEL_CHECK(efa, tface, 2)) {
|
||||
uvav = uv_average + efa->v3->tmp.l;
|
||||
uvav->count++;
|
||||
uvav->uv[0] += tface->uv[2][0];
|
||||
uvav->uv[1] += tface->uv[2][1];
|
||||
}
|
||||
if (efa->v4 && SIMA_UVSEL_CHECK(efa, tface, 3)) {
|
||||
uvav = uv_average + efa->v4->tmp.l;
|
||||
uvav->count++;
|
||||
uvav->uv[0] += tface->uv[3][0];
|
||||
uvav->uv[1] += tface->uv[3][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// apply uv welding
|
||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||
tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
if (SIMA_FACEDRAW_CHECK(efa, tface)) {
|
||||
if (SIMA_UVSEL_CHECK(efa, tface, 0)) {
|
||||
uvav = uv_average + efa->v1->tmp.l;
|
||||
tface->uv[0][0] = uvav->uv[0]/uvav->count;
|
||||
tface->uv[0][1] = uvav->uv[1]/uvav->count;
|
||||
}
|
||||
if (SIMA_UVSEL_CHECK(efa, tface, 1)) {
|
||||
uvav = uv_average + efa->v2->tmp.l;
|
||||
tface->uv[1][0] = uvav->uv[0]/uvav->count;
|
||||
tface->uv[1][1] = uvav->uv[1]/uvav->count;
|
||||
}
|
||||
if (SIMA_UVSEL_CHECK(efa, tface, 2)) {
|
||||
uvav = uv_average + efa->v3->tmp.l;
|
||||
tface->uv[2][0] = uvav->uv[0]/uvav->count;
|
||||
tface->uv[2][1] = uvav->uv[1]/uvav->count;
|
||||
}
|
||||
if (efa->v4 && SIMA_UVSEL_CHECK(efa, tface, 3)) {
|
||||
uvav = uv_average + efa->v4->tmp.l;
|
||||
tface->uv[3][0] = uvav->uv[0]/uvav->count;
|
||||
tface->uv[3][1] = uvav->uv[1]/uvav->count;
|
||||
}
|
||||
}
|
||||
}
|
||||
MEM_freeN(uv_average);
|
||||
object_uvs_changed(OBACT);
|
||||
}
|
||||
|
||||
void weld_align_menu_tface_uv(void)
|
||||
{
|
||||
short mode= 0;
|
||||
|
||||
if( is_uv_tface_editing_allowed()==0 ) return;
|
||||
|
||||
mode= pupmenu("Weld/Align%t|Weld%x1|Align X%x2|Align Y%x3|");
|
||||
mode= pupmenu("Weld/Align%t|Weld%x1|Align X%x2|Align Y%x3");
|
||||
|
||||
if(mode==-1) return;
|
||||
|
||||
if(mode==1) weld_align_tface_uv('w');
|
||||
else if(mode==2) weld_align_tface_uv('x');
|
||||
else if(mode==3) weld_align_tface_uv('y');
|
||||
@@ -1201,12 +1285,12 @@ void mouseco_to_cursor_sima(void)
|
||||
scrarea_queue_winredraw(curarea);
|
||||
}
|
||||
|
||||
void stitch_uv_tface(int mode)
|
||||
void stitch_limit_uv_tface(void)
|
||||
{
|
||||
MTFace *tf;
|
||||
int a, vtot;
|
||||
float newuv[2], limit[2];
|
||||
UvMapVert *vlist, *iterv, *v;
|
||||
UvMapVert *vlist, *iterv;
|
||||
EditMesh *em = G.editMesh;
|
||||
EditVert *ev;
|
||||
EditFace *efa;
|
||||
@@ -1222,11 +1306,9 @@ void stitch_uv_tface(int mode)
|
||||
}
|
||||
|
||||
limit[0]= limit[1]= 20.0;
|
||||
if(mode==1) {
|
||||
add_numbut(0, NUM|FLO, "Limit:", 0.1, 1000.0, &limit[0], NULL);
|
||||
if (!do_clever_numbuts("Stitch UVs", 1, REDRAW))
|
||||
return;
|
||||
}
|
||||
add_numbut(0, NUM|FLO, "Limit:", 0.1, 1000.0, &limit[0], NULL);
|
||||
if (!do_clever_numbuts("Stitch UVs", 1, REDRAW))
|
||||
return;
|
||||
|
||||
limit[0]= limit[1]= limit[0]/256.0;
|
||||
if(G.sima->image) {
|
||||
@@ -1244,20 +1326,20 @@ void stitch_uv_tface(int mode)
|
||||
if(vmap == NULL)
|
||||
return;
|
||||
|
||||
if(mode==0) {
|
||||
for(a=0, ev= em->verts.first; ev; a++, ev= ev->next) {
|
||||
v = get_uv_map_vert_EM(vmap, a);
|
||||
|
||||
if(v == NULL)
|
||||
continue;
|
||||
for(a=0, ev= em->verts.first; ev; a++, ev= ev->next) {
|
||||
vlist= get_uv_map_vert_EM(vmap, a);
|
||||
|
||||
while(vlist) {
|
||||
newuv[0]= 0; newuv[1]= 0;
|
||||
vtot= 0;
|
||||
|
||||
for(iterv=v; iterv; iterv=iterv->next) {
|
||||
for(iterv=vlist; iterv; iterv=iterv->next) {
|
||||
if((iterv != vlist) && iterv->separate)
|
||||
break;
|
||||
efa = EM_get_face_for_index(iterv->f);
|
||||
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
if (tf->flag & TF_SEL_MASK(iterv->tfindex)) {
|
||||
|
||||
if (tf[iterv->f].flag & TF_SEL_MASK(iterv->tfindex)) {
|
||||
newuv[0] += tf->uv[iterv->tfindex][0];
|
||||
newuv[1] += tf->uv[iterv->tfindex][1];
|
||||
vtot++;
|
||||
@@ -1267,7 +1349,9 @@ void stitch_uv_tface(int mode)
|
||||
if (vtot > 1) {
|
||||
newuv[0] /= vtot; newuv[1] /= vtot;
|
||||
|
||||
for(iterv=v; iterv; iterv=iterv->next) {
|
||||
for(iterv=vlist; iterv; iterv=iterv->next) {
|
||||
if((iterv != vlist) && iterv->separate)
|
||||
break;
|
||||
efa = EM_get_face_for_index(iterv->f);
|
||||
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
if (tf->flag & TF_SEL_MASK(iterv->tfindex)) {
|
||||
@@ -1276,44 +1360,7 @@ void stitch_uv_tface(int mode)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(mode==1) {
|
||||
for(a=0, ev= em->verts.first; ev; a++, ev= ev->next) {
|
||||
vlist= get_uv_map_vert_EM(vmap, a);
|
||||
|
||||
while(vlist) {
|
||||
newuv[0]= 0; newuv[1]= 0;
|
||||
vtot= 0;
|
||||
|
||||
for(iterv=vlist; iterv; iterv=iterv->next) {
|
||||
if((iterv != vlist) && iterv->separate)
|
||||
break;
|
||||
efa = EM_get_face_for_index(iterv->f);
|
||||
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
|
||||
if (tf[iterv->f].flag & TF_SEL_MASK(iterv->tfindex)) {
|
||||
newuv[0] += tf->uv[iterv->tfindex][0];
|
||||
newuv[1] += tf->uv[iterv->tfindex][1];
|
||||
vtot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (vtot > 1) {
|
||||
newuv[0] /= vtot; newuv[1] /= vtot;
|
||||
|
||||
for(iterv=vlist; iterv; iterv=iterv->next) {
|
||||
if((iterv != vlist) && iterv->separate)
|
||||
break;
|
||||
efa = EM_get_face_for_index(iterv->f);
|
||||
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
if (tf->flag & TF_SEL_MASK(iterv->tfindex)) {
|
||||
tf->uv[iterv->tfindex][0]= newuv[0];
|
||||
tf->uv[iterv->tfindex][1]= newuv[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
vlist= iterv;
|
||||
}
|
||||
vlist= iterv;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -970,10 +970,10 @@ static void do_image_uvsmenu(void *arg, int event)
|
||||
else G.sima->flag |= SI_CLIP_UV;
|
||||
break;
|
||||
case 3: /* Limit Stitch UVs */
|
||||
stitch_uv_tface(1);
|
||||
stitch_limit_uv_tface();
|
||||
break;
|
||||
case 4: /* Stitch UVs */
|
||||
stitch_uv_tface(0);
|
||||
stitch_vert_uv_tface();
|
||||
break;
|
||||
case 5: /* Proportional Edit (toggle) */
|
||||
if(G.scene->proportional)
|
||||
|
@@ -4901,10 +4901,10 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
}
|
||||
break;
|
||||
case VKEY:
|
||||
if(G.qual==LR_SHIFTKEY)
|
||||
stitch_uv_tface(0);
|
||||
if(G.qual == 0)
|
||||
stitch_vert_uv_tface();
|
||||
else if(G.qual==LR_SHIFTKEY)
|
||||
stitch_uv_tface(1);
|
||||
stitch_limit_uv_tface();
|
||||
else if(G.qual==LR_CTRLKEY)
|
||||
minimize_stretch_tface_uv();
|
||||
break;
|
||||
|
Reference in New Issue
Block a user