2D Cursor in UV window
this can be placed by the moused and used for transforming around. still need numeric location input but no room left in the image panel.
This commit is contained in:
@@ -49,6 +49,7 @@ int minmax_tface_uv(float *min, float *max);
|
|||||||
void transform_width_height_tface_uv(int *width, int *height);
|
void transform_width_height_tface_uv(int *width, int *height);
|
||||||
void transform_aspect_ratio_tface_uv(float *aspx, float *aspy);
|
void transform_aspect_ratio_tface_uv(float *aspx, float *aspy);
|
||||||
|
|
||||||
|
void mouseco_to_cursor_sima(void);
|
||||||
void borderselect_sima(short whichuvs);
|
void borderselect_sima(short whichuvs);
|
||||||
void mouseco_to_curtile(void);
|
void mouseco_to_curtile(void);
|
||||||
void mouse_select_sima(void);
|
void mouse_select_sima(void);
|
||||||
|
|||||||
@@ -422,6 +422,7 @@ void calculateCenterBound(TransInfo *t);
|
|||||||
void calculateCenterMedian(TransInfo *t);
|
void calculateCenterMedian(TransInfo *t);
|
||||||
void calculateCenterCursor(TransInfo *t);
|
void calculateCenterCursor(TransInfo *t);
|
||||||
|
|
||||||
|
void calculateCenterCursor2D(TransInfo *t);
|
||||||
void calculatePropRatio(TransInfo *t);
|
void calculatePropRatio(TransInfo *t);
|
||||||
|
|
||||||
void getViewVector(float coord[3], float vec[3]);
|
void getViewVector(float coord[3], float vec[3]);
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ typedef struct View2D {
|
|||||||
short keepaspect, keepzoom;
|
short keepaspect, keepzoom;
|
||||||
short oldwinx, oldwiny;
|
short oldwinx, oldwiny;
|
||||||
int flag;
|
int flag;
|
||||||
|
|
||||||
|
float cursor[2]; /* only used in the UV view for now*/
|
||||||
|
short around;
|
||||||
|
char pad[6];
|
||||||
} View2D;
|
} View2D;
|
||||||
|
|
||||||
/* v2d->keepzoom */
|
/* v2d->keepzoom */
|
||||||
|
|||||||
@@ -367,218 +367,262 @@ void uvco_to_areaco_noclip(float *vec, int *mval)
|
|||||||
mval[1]= y;
|
mval[1]= y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void drawcursor_sima(void)
|
||||||
|
{
|
||||||
|
int wi, hi;
|
||||||
|
float w, h;
|
||||||
|
|
||||||
|
transform_width_height_tface_uv(&wi, &hi);
|
||||||
|
w = (((float)wi)/256.0f)*G.sima->zoom;
|
||||||
|
h = (((float)hi)/256.0f)*G.sima->zoom;
|
||||||
|
|
||||||
|
cpack(0xFFFFFF);
|
||||||
|
glTranslatef(G.v2d->cursor[0], G.v2d->cursor[1], 0.0f);
|
||||||
|
fdrawline(-0.05/w, 0, 0, 0.05/h);
|
||||||
|
fdrawline(0, 0.05/h, 0.05/w, 0);
|
||||||
|
fdrawline(0.05/w, 0, 0, -0.05/h);
|
||||||
|
fdrawline(0, -0.05/h, -0.05/w, 0);
|
||||||
|
|
||||||
|
setlinestyle(4);
|
||||||
|
cpack(0xFF);
|
||||||
|
fdrawline(-0.05/w, 0, 0, 0.05/h);
|
||||||
|
fdrawline(0, 0.05/h, 0.05/w, 0);
|
||||||
|
fdrawline(0.05/w, 0, 0, -0.05/h);
|
||||||
|
fdrawline(0, -0.05/h, -0.05/w, 0);
|
||||||
|
|
||||||
|
|
||||||
|
setlinestyle(0);
|
||||||
|
cpack(0x0);
|
||||||
|
fdrawline(-0.020/w, 0, -0.1/w, 0);
|
||||||
|
fdrawline(0.1/w, 0, .020/w, 0);
|
||||||
|
fdrawline(0, -0.020/h, 0, -0.1/h);
|
||||||
|
fdrawline(0, 0.1/h, 0, 0.020/h);
|
||||||
|
|
||||||
|
setlinestyle(1);
|
||||||
|
cpack(0xFFFFFF);
|
||||||
|
fdrawline(-0.020/w, 0, -0.1/w, 0);
|
||||||
|
fdrawline(0.1/w, 0, .020/w, 0);
|
||||||
|
fdrawline(0, -0.020/h, 0, -0.1/h);
|
||||||
|
fdrawline(0, 0.1/h, 0, 0.020/h);
|
||||||
|
|
||||||
|
glTranslatef(-G.v2d->cursor[0], -G.v2d->cursor[1], 0.0f);
|
||||||
|
setlinestyle(0);
|
||||||
|
}
|
||||||
|
|
||||||
void draw_tfaces(void)
|
void draw_tfaces(void)
|
||||||
{
|
{
|
||||||
MTFace *tface,*activetface = NULL;
|
MTFace *tface,*activetface = NULL;
|
||||||
EditMesh *em = G.editMesh;
|
EditMesh *em = G.editMesh;
|
||||||
EditFace *efa;
|
EditFace *efa;
|
||||||
|
|
||||||
/*int a;*/
|
|
||||||
char col1[4], col2[4];
|
char col1[4], col2[4];
|
||||||
float pointsize= BIF_GetThemeValuef(TH_VERTEX_SIZE);
|
float pointsize= BIF_GetThemeValuef(TH_VERTEX_SIZE);
|
||||||
|
|
||||||
if (G.obedit) {
|
if (!G.obedit || !CustomData_has_layer(&em->fdata, CD_MTFACE))
|
||||||
if (CustomData_has_layer(&em->fdata, CD_MTFACE)) {
|
return;
|
||||||
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();
|
|
||||||
|
|
||||||
/* draw shadow mesh */
|
|
||||||
if ((G.sima->flag & SI_DRAWSHADOW) && (G.obedit==OBACT)) { /* TODO - editmesh */
|
|
||||||
DerivedMesh *dm;
|
|
||||||
|
|
||||||
/* draw final mesh with modifiers applied */
|
calc_image_view(G.sima, 'f'); /* float */
|
||||||
/* should test - editmesh_get_derived_cage_and_final */
|
myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
|
||||||
dm = editmesh_get_derived_base();
|
glLoadIdentity();
|
||||||
|
|
||||||
glColor3ub(112, 112, 112);
|
/* draw shadow mesh */
|
||||||
if (dm->drawUVEdges) dm->drawUVEdges(dm);
|
if ((G.sima->flag & SI_DRAWSHADOW) && (G.obedit==OBACT)) { /* TODO - editmesh */
|
||||||
|
DerivedMesh *dm;
|
||||||
|
|
||||||
dm->release(dm);
|
/* draw final mesh with modifiers applied */
|
||||||
}
|
/* should test - editmesh_get_derived_cage_and_final */
|
||||||
else if((G.sima->flag & SI_DRAWTOOL) || (G.obedit==OBACT)) {
|
dm = editmesh_get_derived_base();
|
||||||
/* draw mesh without modifiers applied */
|
|
||||||
|
|
||||||
if (G.obedit) {
|
glColor3ub(112, 112, 112);
|
||||||
glColor3ub(112, 112, 112);
|
if (dm->drawUVEdges) dm->drawUVEdges(dm);
|
||||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
|
||||||
/*if(!(mface->flag & ME_HIDE) && (mface->flag & ME_FACE_SEL)) {*/
|
|
||||||
if(!(efa->flag & ME_HIDE) && (efa->f & SELECT)) {
|
|
||||||
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
|
||||||
glBegin(GL_LINE_LOOP);
|
|
||||||
glVertex2fv(tface->uv[0]);
|
|
||||||
glVertex2fv(tface->uv[1]);
|
|
||||||
glVertex2fv(tface->uv[2]);
|
|
||||||
if(efa->v4) glVertex2fv(tface->uv[3]);
|
|
||||||
glEnd();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if((G.sima->flag & SI_DRAWTOOL) || !(G.obedit==OBACT))
|
dm->release(dm);
|
||||||
return; /* only draw shadow mesh */
|
}
|
||||||
|
else if((G.sima->flag & SI_DRAWTOOL) || (G.obedit==OBACT)) {
|
||||||
/* draw transparent faces */
|
/* draw mesh without modifiers applied */
|
||||||
if(G.f & G_DRAWFACES) {
|
|
||||||
BIF_GetThemeColor4ubv(TH_FACE, col1);
|
|
||||||
BIF_GetThemeColor4ubv(TH_FACE_SELECT, col2);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
|
|
||||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
|
||||||
if(efa->f & SELECT) {
|
|
||||||
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
|
||||||
if(!(~tface->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) &&
|
|
||||||
(!efa->v4 || tface->flag & TF_SEL4))
|
|
||||||
glColor4ubv((GLubyte *)col2);
|
|
||||||
else
|
|
||||||
glColor4ubv((GLubyte *)col1);
|
|
||||||
|
|
||||||
glBegin(efa->v4?GL_QUADS:GL_TRIANGLES);
|
|
||||||
glVertex2fv(tface->uv[0]);
|
|
||||||
glVertex2fv(tface->uv[1]);
|
|
||||||
glVertex2fv(tface->uv[2]);
|
|
||||||
if(efa->v4) glVertex2fv(tface->uv[3]);
|
|
||||||
glEnd();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (G.obedit) {
|
||||||
|
glColor3ub(112, 112, 112);
|
||||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||||
if (efa->f & SELECT) {
|
/*if(!(mface->flag & ME_HIDE) && (mface->flag & ME_FACE_SEL)) {*/
|
||||||
|
if(!(efa->flag & ME_HIDE) && (efa->f & SELECT)) {
|
||||||
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
|
glBegin(GL_LINE_LOOP);
|
||||||
cpack(0x0);
|
glVertex2fv(tface->uv[0]);
|
||||||
glBegin(GL_LINE_LOOP);
|
|
||||||
glVertex2fv(tface->uv[0]);
|
|
||||||
glVertex2fv(tface->uv[1]);
|
|
||||||
glVertex2fv(tface->uv[2]);
|
|
||||||
if(efa->v4) glVertex2fv(tface->uv[3]);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
setlinestyle(2);
|
|
||||||
cpack(0xFFFFFF);
|
|
||||||
glBegin(GL_LINE_STRIP);
|
|
||||||
glVertex2fv(tface->uv[0]);
|
|
||||||
glVertex2fv(tface->uv[1]);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
glBegin(GL_LINE_STRIP);
|
|
||||||
glVertex2fv(tface->uv[0]);
|
|
||||||
if(efa->v4) glVertex2fv(tface->uv[3]);
|
|
||||||
else glVertex2fv(tface->uv[2]);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
glBegin(GL_LINE_STRIP);
|
|
||||||
glVertex2fv(tface->uv[1]);
|
|
||||||
glVertex2fv(tface->uv[2]);
|
|
||||||
if(efa->v4) glVertex2fv(tface->uv[3]);
|
|
||||||
glEnd();
|
|
||||||
setlinestyle(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* draw active face edges */
|
|
||||||
/*if (activetface){*/
|
|
||||||
/* colors: R=u G=v */
|
|
||||||
activetface = get_active_mtface(&efa, NULL);
|
|
||||||
if (activetface) {
|
|
||||||
setlinestyle(2);
|
|
||||||
tface=activetface;
|
|
||||||
/*mface=activemface;*/
|
|
||||||
|
|
||||||
cpack(0x0);
|
|
||||||
glBegin(GL_LINE_LOOP);
|
|
||||||
glVertex2fv(tface->uv[0]);
|
|
||||||
glVertex2fv(tface->uv[1]);
|
glVertex2fv(tface->uv[1]);
|
||||||
glVertex2fv(tface->uv[2]);
|
glVertex2fv(tface->uv[2]);
|
||||||
if(efa->v4) glVertex2fv(tface->uv[3]);
|
if(efa->v4) glVertex2fv(tface->uv[3]);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
cpack(0xFF00);
|
|
||||||
glBegin(GL_LINE_STRIP);
|
|
||||||
glVertex2fv(tface->uv[0]);
|
|
||||||
glVertex2fv(tface->uv[1]);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
cpack(0xFF);
|
|
||||||
glBegin(GL_LINE_STRIP);
|
|
||||||
glVertex2fv(tface->uv[0]);
|
|
||||||
if(efa->v4) glVertex2fv(tface->uv[3]);
|
|
||||||
else glVertex2fv(tface->uv[2]);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
cpack(0xFFFFFF);
|
|
||||||
glBegin(GL_LINE_STRIP);
|
|
||||||
glVertex2fv(tface->uv[1]);
|
|
||||||
glVertex2fv(tface->uv[2]);
|
|
||||||
if(efa->v4) glVertex2fv(tface->uv[3]);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
setlinestyle(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* unselected uv's */
|
|
||||||
BIF_ThemeColor(TH_VERTEX);
|
|
||||||
glPointSize(pointsize);
|
|
||||||
|
|
||||||
bglBegin(GL_POINTS);
|
|
||||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
|
||||||
if (efa->f & SELECT) {
|
|
||||||
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
|
||||||
if(tface->flag & TF_SEL1); else bglVertex2fv(tface->uv[0]);
|
|
||||||
if(tface->flag & TF_SEL2); else bglVertex2fv(tface->uv[1]);
|
|
||||||
if(tface->flag & TF_SEL3); else bglVertex2fv(tface->uv[2]);
|
|
||||||
if(efa->v4) {
|
|
||||||
if(tface->flag & TF_SEL4); 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) {
|
|
||||||
if (efa->f & SELECT) {
|
|
||||||
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
|
||||||
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) {
|
|
||||||
if (efa->f & SELECT) {
|
|
||||||
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
|
||||||
if(tface->flag & TF_SEL1) bglVertex2fv(tface->uv[0]);
|
|
||||||
if(tface->flag & TF_SEL2) bglVertex2fv(tface->uv[1]);
|
|
||||||
if(tface->flag & TF_SEL3) bglVertex2fv(tface->uv[2]);
|
|
||||||
if(efa->v4) {
|
|
||||||
if(tface->flag & TF_SEL4) bglVertex2fv(tface->uv[3]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bglEnd();
|
|
||||||
|
|
||||||
glPointSize(1.0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if((G.sima->flag & SI_DRAWTOOL) || !(G.obedit==OBACT))
|
||||||
|
return; /* only draw shadow mesh */
|
||||||
|
|
||||||
|
/* draw transparent faces */
|
||||||
|
if(G.f & G_DRAWFACES) {
|
||||||
|
BIF_GetThemeColor4ubv(TH_FACE, col1);
|
||||||
|
BIF_GetThemeColor4ubv(TH_FACE_SELECT, col2);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||||
|
if(efa->f & SELECT) {
|
||||||
|
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
|
if(!(~tface->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) &&
|
||||||
|
(!efa->v4 || tface->flag & TF_SEL4))
|
||||||
|
glColor4ubv((GLubyte *)col2);
|
||||||
|
else
|
||||||
|
glColor4ubv((GLubyte *)col1);
|
||||||
|
|
||||||
|
glBegin(efa->v4?GL_QUADS:GL_TRIANGLES);
|
||||||
|
glVertex2fv(tface->uv[0]);
|
||||||
|
glVertex2fv(tface->uv[1]);
|
||||||
|
glVertex2fv(tface->uv[2]);
|
||||||
|
if(efa->v4) glVertex2fv(tface->uv[3]);
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||||
|
if (efa->f & SELECT) {
|
||||||
|
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
|
|
||||||
|
cpack(0x0);
|
||||||
|
glBegin(GL_LINE_LOOP);
|
||||||
|
glVertex2fv(tface->uv[0]);
|
||||||
|
glVertex2fv(tface->uv[1]);
|
||||||
|
glVertex2fv(tface->uv[2]);
|
||||||
|
if(efa->v4) glVertex2fv(tface->uv[3]);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
setlinestyle(2);
|
||||||
|
cpack(0xFFFFFF);
|
||||||
|
glBegin(GL_LINE_STRIP);
|
||||||
|
glVertex2fv(tface->uv[0]);
|
||||||
|
glVertex2fv(tface->uv[1]);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glBegin(GL_LINE_STRIP);
|
||||||
|
glVertex2fv(tface->uv[0]);
|
||||||
|
if(efa->v4) glVertex2fv(tface->uv[3]);
|
||||||
|
else glVertex2fv(tface->uv[2]);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glBegin(GL_LINE_STRIP);
|
||||||
|
glVertex2fv(tface->uv[1]);
|
||||||
|
glVertex2fv(tface->uv[2]);
|
||||||
|
if(efa->v4) glVertex2fv(tface->uv[3]);
|
||||||
|
glEnd();
|
||||||
|
setlinestyle(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* draw active face edges */
|
||||||
|
/*if (activetface){*/
|
||||||
|
/* colors: R=u G=v */
|
||||||
|
activetface = get_active_mtface(&efa, NULL);
|
||||||
|
if (activetface) {
|
||||||
|
setlinestyle(2);
|
||||||
|
tface=activetface;
|
||||||
|
/*mface=activemface;*/
|
||||||
|
|
||||||
|
cpack(0x0);
|
||||||
|
glBegin(GL_LINE_LOOP);
|
||||||
|
glVertex2fv(tface->uv[0]);
|
||||||
|
glVertex2fv(tface->uv[1]);
|
||||||
|
glVertex2fv(tface->uv[2]);
|
||||||
|
if(efa->v4) glVertex2fv(tface->uv[3]);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
cpack(0xFF00);
|
||||||
|
glBegin(GL_LINE_STRIP);
|
||||||
|
glVertex2fv(tface->uv[0]);
|
||||||
|
glVertex2fv(tface->uv[1]);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
cpack(0xFF);
|
||||||
|
glBegin(GL_LINE_STRIP);
|
||||||
|
glVertex2fv(tface->uv[0]);
|
||||||
|
if(efa->v4) glVertex2fv(tface->uv[3]);
|
||||||
|
else glVertex2fv(tface->uv[2]);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
cpack(0xFFFFFF);
|
||||||
|
glBegin(GL_LINE_STRIP);
|
||||||
|
glVertex2fv(tface->uv[1]);
|
||||||
|
glVertex2fv(tface->uv[2]);
|
||||||
|
if(efa->v4) glVertex2fv(tface->uv[3]);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
setlinestyle(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* unselected uv's */
|
||||||
|
BIF_ThemeColor(TH_VERTEX);
|
||||||
|
glPointSize(pointsize);
|
||||||
|
|
||||||
|
bglBegin(GL_POINTS);
|
||||||
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||||
|
if (efa->f & SELECT) {
|
||||||
|
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
|
if(tface->flag & TF_SEL1); else bglVertex2fv(tface->uv[0]);
|
||||||
|
if(tface->flag & TF_SEL2); else bglVertex2fv(tface->uv[1]);
|
||||||
|
if(tface->flag & TF_SEL3); else bglVertex2fv(tface->uv[2]);
|
||||||
|
if(efa->v4) {
|
||||||
|
if(tface->flag & TF_SEL4); 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) {
|
||||||
|
if (efa->f & SELECT) {
|
||||||
|
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
|
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) {
|
||||||
|
if (efa->f & SELECT) {
|
||||||
|
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
|
if(tface->flag & TF_SEL1) bglVertex2fv(tface->uv[0]);
|
||||||
|
if(tface->flag & TF_SEL2) bglVertex2fv(tface->uv[1]);
|
||||||
|
if(tface->flag & TF_SEL3) bglVertex2fv(tface->uv[2]);
|
||||||
|
if(efa->v4) {
|
||||||
|
if(tface->flag & TF_SEL4) bglVertex2fv(tface->uv[3]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bglEnd();
|
||||||
|
|
||||||
|
|
||||||
|
/* Draw the cursor here, this should be in its own function really but it relys on the previous calls to set the view matrix */
|
||||||
|
drawcursor_sima();
|
||||||
|
|
||||||
|
glPointSize(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int *get_part_from_ibuf(ImBuf *ibuf, short startx, short starty, short endx, short endy)
|
static unsigned int *get_part_from_ibuf(ImBuf *ibuf, short startx, short starty, short endx, short endy)
|
||||||
@@ -1717,8 +1761,9 @@ void drawimagespace(ScrArea *sa, void *spacedata)
|
|||||||
|
|
||||||
glPixelZoom(1.0, 1.0);
|
glPixelZoom(1.0, 1.0);
|
||||||
|
|
||||||
if(show_viewer==0)
|
if(show_viewer==0) {
|
||||||
draw_tfaces();
|
draw_tfaces();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glPixelZoom(1.0, 1.0);
|
glPixelZoom(1.0, 1.0);
|
||||||
|
|||||||
@@ -895,6 +895,15 @@ void mouseco_to_curtile(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Could be used for other 2D views also */
|
||||||
|
void mouseco_to_cursor_sima(void)
|
||||||
|
{
|
||||||
|
short mval[2];
|
||||||
|
getmouseco_areawin(mval);
|
||||||
|
areamouseco_to_ipoco(G.v2d, mval, &G.v2d->cursor[0], &G.v2d->cursor[1]);
|
||||||
|
scrarea_queue_winredraw(curarea);
|
||||||
|
}
|
||||||
|
|
||||||
void stitch_uv_tface(int mode)
|
void stitch_uv_tface(int mode)
|
||||||
{
|
{
|
||||||
MTFace *tf;
|
MTFace *tf;
|
||||||
|
|||||||
@@ -1083,6 +1083,18 @@ static uiBlock *image_uvsmenu(void *arg_unused)
|
|||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *around_pup(void)
|
||||||
|
{
|
||||||
|
static char string[512];
|
||||||
|
char *str = string;
|
||||||
|
|
||||||
|
str += sprintf(str, "%s", "Pivot: %t");
|
||||||
|
str += sprintf(str, "%s", "|Bounding Box Center %x0");
|
||||||
|
str += sprintf(str, "%s", "|Median Point %x3");
|
||||||
|
str += sprintf(str, "%s", "|2D Cursor %x1");
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
void image_buttons(void)
|
void image_buttons(void)
|
||||||
{
|
{
|
||||||
Image *ima;
|
Image *ima;
|
||||||
@@ -1158,6 +1170,13 @@ void image_buttons(void)
|
|||||||
|
|
||||||
xco= std_libbuttons(block, xco, 0, 0, NULL, B_SIMABROWSE, ID_IM, 0, (ID *)ima, 0, &(G.sima->imanr), 0, 0, B_IMAGEDELETE, 0, 0);
|
xco= std_libbuttons(block, xco, 0, 0, NULL, B_SIMABROWSE, ID_IM, 0, (ID *)ima, 0, &(G.sima->imanr), 0, 0, B_IMAGEDELETE, 0, 0);
|
||||||
|
|
||||||
|
/* UV EditMode buttons */
|
||||||
|
if (EM_texFaceCheck()) {
|
||||||
|
xco+=10;
|
||||||
|
uiDefIconTextButS(block, ICONTEXTROW,B_AROUND, ICON_ROTATE, around_pup(), xco,0,XIC+10,YIC, &(G.v2d->around), 0, 3.0, 0, 0, "Rotation/Scaling Pivot (Hotkeys: Comma, Shift Comma, Period) ");
|
||||||
|
xco+= XIC+15;
|
||||||
|
}
|
||||||
|
|
||||||
if (ima) {
|
if (ima) {
|
||||||
RenderResult *rr= BKE_image_get_renderresult(ima);
|
RenderResult *rr= BKE_image_get_renderresult(ima);
|
||||||
|
|
||||||
|
|||||||
@@ -4788,10 +4788,13 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
|||||||
else
|
else
|
||||||
sima_sample_color();
|
sima_sample_color();
|
||||||
}
|
}
|
||||||
else if(EM_texFaceCheck())
|
else if(EM_texFaceCheck()) {
|
||||||
gesture();
|
if (!gesture()) {
|
||||||
else
|
mouseco_to_cursor_sima();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
sima_sample_color();
|
sima_sample_color();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case RIGHTMOUSE:
|
case RIGHTMOUSE:
|
||||||
if(EM_texFaceCheck())
|
if(EM_texFaceCheck())
|
||||||
@@ -4908,6 +4911,28 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
|||||||
if(G.qual==0)
|
if(G.qual==0)
|
||||||
image_viewcenter();
|
image_viewcenter();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case COMMAKEY:
|
||||||
|
if(G.qual==LR_SHIFTKEY) {
|
||||||
|
G.v2d->around= V3D_CENTROID;
|
||||||
|
} else if(G.qual==0) {
|
||||||
|
G.v2d->around= V3D_CENTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
scrarea_queue_headredraw(curarea);
|
||||||
|
scrarea_queue_winredraw(curarea);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PERIODKEY:
|
||||||
|
if(G.qual==LR_CTRLKEY) {
|
||||||
|
G.v2d->around= V3D_LOCAL;
|
||||||
|
} else if(G.qual==0) {
|
||||||
|
G.v2d->around= V3D_CURSOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
scrarea_queue_headredraw(curarea);
|
||||||
|
scrarea_queue_winredraw(curarea);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1857,12 +1857,6 @@ static void createTransUVs(TransInfo *t)
|
|||||||
if(is_uv_tface_editing_allowed()==0) return;
|
if(is_uv_tface_editing_allowed()==0) return;
|
||||||
|
|
||||||
/* count */
|
/* count */
|
||||||
/*
|
|
||||||
tf= me->mtface;
|
|
||||||
mf= me->mface;
|
|
||||||
for(a=me->totface; a>0; a--, tf++, mf++) {
|
|
||||||
if(mf->v3 && mf->flag & ME_FACE_SEL) {
|
|
||||||
*/
|
|
||||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||||
if (efa->f & SELECT) {
|
if (efa->f & SELECT) {
|
||||||
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
@@ -1889,12 +1883,6 @@ static void createTransUVs(TransInfo *t)
|
|||||||
|
|
||||||
td= t->data;
|
td= t->data;
|
||||||
td2d= t->data2d;
|
td2d= t->data2d;
|
||||||
/*
|
|
||||||
tf= me->mtface;
|
|
||||||
mf= me->mface;
|
|
||||||
for(a=me->totface; a>0; a--, tf++, mf++) {
|
|
||||||
if(mf->v3 && mf->flag & ME_FACE_SEL) {
|
|
||||||
*/
|
|
||||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||||
if (efa->f & SELECT) {
|
if (efa->f & SELECT) {
|
||||||
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
|
|||||||
@@ -464,6 +464,8 @@ void initTrans (TransInfo *t)
|
|||||||
if(t->spacetype==SPACE_VIEW3D) {
|
if(t->spacetype==SPACE_VIEW3D) {
|
||||||
if(G.vd->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
|
if(G.vd->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
|
||||||
t->around = G.vd->around;
|
t->around = G.vd->around;
|
||||||
|
} else if(t->spacetype==SPACE_IMAGE) {
|
||||||
|
t->around = G.v2d->around;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
t->around = V3D_CENTER;
|
t->around = V3D_CENTER;
|
||||||
@@ -654,6 +656,19 @@ void calculateCenterCursor(TransInfo *t)
|
|||||||
calculateCenter2D(t);
|
calculateCenter2D(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void calculateCenterCursor2D(TransInfo *t)
|
||||||
|
{
|
||||||
|
float aspx=1.0, aspy=1.0;
|
||||||
|
|
||||||
|
if(t->spacetype==SPACE_IMAGE) /* only space supported right now but may change */
|
||||||
|
transform_aspect_ratio_tface_uv(&aspx, &aspy);
|
||||||
|
if (G.v2d) {
|
||||||
|
t->center[0] = G.v2d->cursor[0] * aspx;
|
||||||
|
t->center[1] = G.v2d->cursor[1] * aspy;
|
||||||
|
}
|
||||||
|
calculateCenter2D(t);
|
||||||
|
}
|
||||||
|
|
||||||
void calculateCenterMedian(TransInfo *t)
|
void calculateCenterMedian(TransInfo *t)
|
||||||
{
|
{
|
||||||
float partial[3] = {0.0f, 0.0f, 0.0f};
|
float partial[3] = {0.0f, 0.0f, 0.0f};
|
||||||
@@ -717,7 +732,10 @@ void calculateCenter(TransInfo *t)
|
|||||||
calculateCenterMedian(t);
|
calculateCenterMedian(t);
|
||||||
break;
|
break;
|
||||||
case V3D_CURSOR:
|
case V3D_CURSOR:
|
||||||
calculateCenterCursor(t);
|
if(t->spacetype==SPACE_IMAGE)
|
||||||
|
calculateCenterCursor2D(t);
|
||||||
|
else
|
||||||
|
calculateCenterCursor(t);
|
||||||
break;
|
break;
|
||||||
case V3D_LOCAL:
|
case V3D_LOCAL:
|
||||||
/* Individual element center uses median center for helpline and such */
|
/* Individual element center uses median center for helpline and such */
|
||||||
|
|||||||
Reference in New Issue
Block a user