forked from bartvdbraak/blender
Final fix fo revision 14827
Fixing UV Quad Constraint when cancelling transform. Also, transdata conversion is a bit faster for all UV transforms. Patch by Cambo, reviewed and revised.
This commit is contained in:
parent
c56f484da8
commit
d1e1332e07
@ -2217,9 +2217,9 @@ static void UVsToTransData(TransData *td, TransData2D *td2d, float *uv, int sele
|
||||
td->flag |= TD_SELECTED;
|
||||
td->dist= 0.0;
|
||||
}
|
||||
else
|
||||
else {
|
||||
td->dist= MAXFLOAT;
|
||||
|
||||
}
|
||||
Mat3One(td->mtx);
|
||||
Mat3One(td->smtx);
|
||||
}
|
||||
@ -2231,6 +2231,7 @@ static void createTransUVs(TransInfo *t)
|
||||
MTFace *tf;
|
||||
int count=0, countsel=0;
|
||||
int propmode = t->flag & T_PROP_EDIT;
|
||||
int efa_s1,efa_s2,efa_s3,efa_s4;
|
||||
|
||||
EditMesh *em = G.editMesh;
|
||||
EditFace *efa;
|
||||
@ -2238,15 +2239,46 @@ static void createTransUVs(TransInfo *t)
|
||||
if(is_uv_tface_editing_allowed()==0) return;
|
||||
|
||||
/* count */
|
||||
if (G.sima->flag & SI_BE_SQUARE && !propmode) {
|
||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||
/* store face pointer for second loop, prevent second lookup */
|
||||
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
if (simaFaceDraw_Check(efa, tf)) {
|
||||
efa->tmp.p = tf;
|
||||
|
||||
efa_s1 = simaUVSel_Check(efa, tf, 0);
|
||||
efa_s2 = simaUVSel_Check(efa, tf, 1);
|
||||
efa_s3 = simaUVSel_Check(efa, tf, 2);
|
||||
if (efa->v4) {
|
||||
efa_s4 = simaUVSel_Check(efa, tf, 3);
|
||||
if ( efa_s1 || efa_s2 || efa_s3 || efa_s4 ) {
|
||||
countsel += 4; /* all corners of this quad need their edges moved. so we must store TD for each */
|
||||
}
|
||||
} else {
|
||||
/* tri's are delt with normally when SI_BE_SQUARE's enabled */
|
||||
if (efa_s1) countsel++;
|
||||
if (efa_s2) countsel++;
|
||||
if (efa_s3) countsel++;
|
||||
}
|
||||
} else {
|
||||
efa->tmp.p = NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
if (simaFaceDraw_Check(efa, tf)) {
|
||||
efa->tmp.p = tf;
|
||||
|
||||
if (simaUVSel_Check(efa, tf, 0)) countsel++;
|
||||
if (simaUVSel_Check(efa, tf, 1)) countsel++;
|
||||
if (simaUVSel_Check(efa, tf, 2)) countsel++;
|
||||
if (efa->v4 && simaUVSel_Check(efa, tf, 3)) countsel++;
|
||||
if(propmode)
|
||||
count += (efa->v4)? 4: 3;
|
||||
} else {
|
||||
efa->tmp.p = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2264,18 +2296,63 @@ static void createTransUVs(TransInfo *t)
|
||||
|
||||
td= t->data;
|
||||
td2d= t->data2d;
|
||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
if (simaFaceDraw_Check(efa, tf)) {
|
||||
if(propmode || simaUVSel_Check(efa, tf, 0))
|
||||
UVsToTransData(td++, td2d++, tf->uv[0], simaUVSel_Check(efa, tf, 0));
|
||||
if(propmode || simaUVSel_Check(efa, tf, 1))
|
||||
UVsToTransData(td++, td2d++, tf->uv[1], simaUVSel_Check(efa, tf, 1));
|
||||
if(propmode || simaUVSel_Check(efa, tf, 2))
|
||||
UVsToTransData(td++, td2d++, tf->uv[2], simaUVSel_Check(efa, tf, 2));
|
||||
|
||||
if(efa->v4 && (propmode || simaUVSel_Check(efa, tf, 3)))
|
||||
if (G.sima->flag & SI_BE_SQUARE && !propmode) {
|
||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||
tf=(MTFace *)efa->tmp.p;
|
||||
if (tf) {
|
||||
efa_s1 = simaUVSel_Check(efa, tf, 0);
|
||||
efa_s2 = simaUVSel_Check(efa, tf, 1);
|
||||
efa_s3 = simaUVSel_Check(efa, tf, 2);
|
||||
|
||||
if (efa->v4) {
|
||||
efa_s4 = simaUVSel_Check(efa, tf, 3);
|
||||
|
||||
if ( efa_s1 || efa_s2 || efa_s3 || efa_s4 ) {
|
||||
/* all corners of this quad need their edges moved. so we must store TD for each */
|
||||
|
||||
UVsToTransData(td, td2d, tf->uv[0], efa_s1);
|
||||
if (!efa_s1) td->flag |= TD_SKIP;
|
||||
td++; td2d++;
|
||||
|
||||
UVsToTransData(td, td2d, tf->uv[1], efa_s2);
|
||||
if (!efa_s2) td->flag |= TD_SKIP;
|
||||
td++; td2d++;
|
||||
|
||||
UVsToTransData(td, td2d, tf->uv[2], efa_s3);
|
||||
if (!efa_s3) td->flag |= TD_SKIP;
|
||||
td++; td2d++;
|
||||
|
||||
UVsToTransData(td, td2d, tf->uv[3], efa_s4);
|
||||
if (!efa_s4) td->flag |= TD_SKIP;
|
||||
td++; td2d++;
|
||||
}
|
||||
} else {
|
||||
/* tri's are delt with normally when SI_BE_SQUARE's enabled */
|
||||
if (efa_s1) UVsToTransData(td++, td2d++, tf->uv[0], 1);
|
||||
if (efa_s2) UVsToTransData(td++, td2d++, tf->uv[1], 1);
|
||||
if (efa_s3) UVsToTransData(td++, td2d++, tf->uv[2], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||
/*tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
if (simaFaceDraw_Check(efa, tf)) {*/
|
||||
if ((tf=(MTFace *)efa->tmp.p)) {
|
||||
if (propmode) {
|
||||
UVsToTransData(td++, td2d++, tf->uv[0], simaUVSel_Check(efa, tf, 0));
|
||||
UVsToTransData(td++, td2d++, tf->uv[1], simaUVSel_Check(efa, tf, 1));
|
||||
UVsToTransData(td++, td2d++, tf->uv[2], simaUVSel_Check(efa, tf, 2));
|
||||
if(efa->v4)
|
||||
UVsToTransData(td++, td2d++, tf->uv[3], simaUVSel_Check(efa, tf, 3));
|
||||
} else {
|
||||
if(simaUVSel_Check(efa, tf, 0)) UVsToTransData(td++, td2d++, tf->uv[0], 1);
|
||||
if(simaUVSel_Check(efa, tf, 1)) UVsToTransData(td++, td2d++, tf->uv[1], 1);
|
||||
if(simaUVSel_Check(efa, tf, 2)) UVsToTransData(td++, td2d++, tf->uv[2], 1);
|
||||
if(efa->v4 && simaUVSel_Check(efa, tf, 3)) UVsToTransData(td++, td2d++, tf->uv[3], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2307,8 +2384,7 @@ void flushTransUVs(TransInfo *t)
|
||||
}
|
||||
}
|
||||
|
||||
/* always call this, also for cancel (it transforms non-selected vertices...) */
|
||||
if((G.sima->flag & SI_BE_SQUARE) && (t->state != TRANS_CANCEL))
|
||||
if((G.sima->flag & SI_BE_SQUARE) && (t->flag & T_PROP_EDIT)==0 && (t->state != TRANS_CANCEL))
|
||||
be_square_tface_uv(em);
|
||||
|
||||
/* this is overkill if G.sima->lock is not set, but still needed */
|
||||
|
Loading…
Reference in New Issue
Block a user