New feature for UV/Editmode - 'Sync Mesh Selection' a button in the UV header this mode is disabled by default.

This is implimented by defining macro's that take the mode into account when get/set/checking the selection and that a face can be drawn.

When this is enabled, things work a bit differently
* all faces are drawn in the UV view (except hidden faces).
* selecting faces/verts in the UV window selects them on the mesh also and vice vercer.
* when EditMode (Face only) is enabled, selecting faces in the UV view is not sticky.
* hiding/(de)select all and invert selection simle call the editmesh functions.
* there is no way to select 1 uv corner of 1 face (because a mesh cannot have this as a valid selection) either all UV's that use a vert (sticky), or the whole face.
This commit is contained in:
Campbell Barton 2007-09-17 18:22:06 +00:00
parent d1e5c86b76
commit 0c7c57685e
11 changed files with 499 additions and 321 deletions

@ -38,7 +38,7 @@ struct EditFace;
struct Mesh;
struct MCol;
struct MTFace *get_active_mtface(struct EditFace **efa, struct MCol **mcol);
struct MTFace *get_active_mtface(struct EditFace **efa, struct MCol **mcol, short partsel);
void calculate_uv_map(unsigned short mapmode);
void default_uv(float uv[][2], float size);
void make_tfaces(struct Mesh *me);

@ -32,9 +32,28 @@
struct Mesh;
struct EditMesh;
/* id can be from 0 to 3 */
#define TF_PIN_MASK(id) (TF_PIN1 << id)
#define TF_SEL_MASK(id) (TF_SEL1 << id)
#define SIMA_FACEDRAW_CHECK(efa) \
((G.sima->flag & SI_SYNC_UVSEL) ? (efa->h==0) : (efa->h==0 && efa->f & SELECT))
#define SIMA_FACESEL_CHECK(efa, tf) \
((G.sima->flag & SI_SYNC_UVSEL) ? (efa->f & SELECT) : (!(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) &&(!efa->v4 || tf->flag & TF_SEL4)))
#define SIMA_FACESEL_SET(efa, tf) \
((G.sima->flag & SI_SYNC_UVSEL) ? (EM_select_face(efa, 1)) : (tf->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)))
#define SIMA_FACESEL_UNSET(efa, tf) \
((G.sima->flag & SI_SYNC_UVSEL) ? (EM_select_face(efa, 0)) : (tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)))
#define SIMA_UVSEL_CHECK(efa, tf, i) (G.sima->flag & SI_SYNC_UVSEL ? \
(G.scene->selectmode == SCE_SELECT_FACE ? efa->f & SELECT : ((*(&efa->v1 + i))->f & SELECT) ) : (tf->flag & TF_SEL_MASK(i) ))
#define SIMA_UVSEL_SET(efa, tf, i) (G.sima->flag & SI_SYNC_UVSEL ? \
(G.scene->selectmode == SCE_SELECT_FACE ? EM_select_face(efa, 1) : ((*(&efa->v1 + i))->f |= SELECT) ) : (tf->flag |= TF_SEL_MASK(i) ))
#define SIMA_UVSEL_UNSET(efa, tf, i) (G.sima->flag & SI_SYNC_UVSEL ? \
(G.scene->selectmode == SCE_SELECT_FACE ? EM_select_face(efa, 0) : ((*(&efa->v1 + i))->f &= ~SELECT) ) : (tf->flag &= ~TF_SEL_MASK(i) ))
struct Object;
void object_uvs_changed(struct Object *ob);
@ -88,3 +107,5 @@ void pack_image_sima(void);
/* checks images for forced updates on frame change */
void BIF_image_update_frame(void);

@ -4836,7 +4836,7 @@ void do_fpaintbuts(unsigned short event)
case B_COPY_TF_COL:
case B_COPY_TF_TEX:
me= get_mesh(OBACT);
activetf= get_active_mtface(NULL, &activemcol);
activetf= get_active_mtface(NULL, &activemcol, 0);
if(me && activetf) {
for (a=0, tf=me->mtface, mf=me->mface; a < me->totface; a++, tf++, mf++) {
@ -4890,7 +4890,7 @@ void do_fpaintbuts(unsigned short event)
break;
case B_TFACE_HALO:
activetf = get_active_mtface(NULL, NULL);
activetf = get_active_mtface(NULL, NULL, 0);
if(activetf) {
activetf->mode &= ~TF_BILLBOARD2;
allqueue(REDRAWBUTSEDIT, 0);
@ -4898,7 +4898,7 @@ void do_fpaintbuts(unsigned short event)
break;
case B_TFACE_BILLB:
activetf = get_active_mtface(NULL, NULL);
activetf = get_active_mtface(NULL, NULL, 0);
if(activetf) {
activetf->mode &= ~TF_BILLBOARD;
allqueue(REDRAWBUTSEDIT, 0);
@ -5289,7 +5289,7 @@ static void editing_panel_mesh_texface(void)
uiNewPanelTabbed("Multires", "Editing");
if(uiNewPanel(curarea, block, "Texture Face", "Editing", 960, 0, 318, 204)==0) return;
tf = get_active_mtface(NULL, NULL);
tf = get_active_mtface(NULL, NULL, 0);
if(tf) {
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, TF_TEX, B_REDR_3D_IMA, "Tex", 600,160,60,19, &tf->mode, 0, 0, 0, 0, "Render face with texture");

@ -250,7 +250,7 @@ void what_image(SpaceImage *sima)
if(sima->image && sima->image->source==IMA_SRC_VIEWER) {}
else if (G.obedit == OBACT) {
sima->image= NULL;
activetf = get_active_mtface(NULL, NULL);
activetf = get_active_mtface(NULL, NULL, 1); /* partially selected face is ok */
if(activetf && activetf->mode & TF_TEX) {
sima->image= activetf->tpage;
@ -305,7 +305,8 @@ void image_changed(SpaceImage *sima, int dotile)
}
for (efa= em->faces.first; efa; efa= efa->next) {
if (efa->f & SELECT) {
/*if (efa->f & SELECT) {*/
if (SIMA_FACEDRAW_CHECK(efa)) {
tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(dotile==2) {
@ -446,7 +447,8 @@ void draw_tfaces(void)
glColor3ub(112, 112, 112);
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)) {
/*if(!(efa->flag & ME_HIDE) && (efa->f & SELECT)) {*/
if (SIMA_FACEDRAW_CHECK(efa)) {
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
glBegin(GL_LINE_LOOP);
glVertex2fv(tface->uv[0]);
@ -470,10 +472,10 @@ void draw_tfaces(void)
glEnable(GL_BLEND);
for (efa= em->faces.first; efa; efa= efa->next) {
if(efa->f & SELECT) {
/*if(efa->f & SELECT) {*/
if (SIMA_FACEDRAW_CHECK(efa)) {
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))
if( SIMA_FACESEL_CHECK(efa, tface) )
glColor4ubv((GLubyte *)col2);
else
glColor4ubv((GLubyte *)col1);
@ -490,7 +492,8 @@ void draw_tfaces(void)
}
for (efa= em->faces.first; efa; efa= efa->next) {
if (efa->f & SELECT) {
/*if (efa->f & SELECT) {*/
if (SIMA_FACEDRAW_CHECK(efa)) {
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
cpack(0x0);
@ -526,7 +529,7 @@ void draw_tfaces(void)
/* draw active face edges */
/*if (activetface){*/
/* colors: R=u G=v */
activetface = get_active_mtface(&efa, NULL);
activetface = get_active_mtface(&efa, NULL, 0);
if (activetface) {
setlinestyle(2);
tface=activetface;
@ -569,13 +572,14 @@ void draw_tfaces(void)
bglBegin(GL_POINTS);
for (efa= em->faces.first; efa; efa= efa->next) {
if (efa->f & SELECT) {
/*if (efa->f & SELECT) {*/
if (SIMA_FACEDRAW_CHECK(efa)) {
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(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(tface->flag & TF_SEL4); else bglVertex2fv(tface->uv[3]);
if(SIMA_UVSEL_CHECK(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
}
}
}
@ -588,7 +592,8 @@ void draw_tfaces(void)
bglBegin(GL_POINTS);
for (efa= em->faces.first; efa; efa= efa->next) {
if (efa->f & SELECT) {
/*if (efa->f & SELECT) {*/
if (SIMA_FACEDRAW_CHECK(efa)) {
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]);
@ -606,13 +611,14 @@ void draw_tfaces(void)
bglBegin(GL_POINTS);
for (efa= em->faces.first; efa; efa= efa->next) {
if (efa->f & SELECT) {
/*if (efa->f & SELECT) {*/
if (SIMA_FACEDRAW_CHECK(efa)) {
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(!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(tface->flag & TF_SEL4) bglVertex2fv(tface->uv[3]);
if(!SIMA_UVSEL_CHECK(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
}
}
}
@ -683,17 +689,34 @@ static void draw_image_view_icon(void)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if(G.sima->flag & SI_STICKYUVS) {
BIF_icon_draw_aspect(xPos, 5.0, ICON_STICKY2_UVS, 1.0f);
if (G.sima->flag & SI_SYNC_UVSEL) {
/* take settings from the editmesh */
if (G.scene->selectmode == SCE_SELECT_FACE) {
BIF_icon_draw_aspect(xPos, 5.0, ICON_STICKY_UVS, 1.0f);
} else {
BIF_icon_draw_aspect(xPos, 5.0, ICON_STICKY2_UVS, 1.0f);
}
xPos = 25.0;
}
else if(!(G.sima->flag & SI_LOCALSTICKY)) {
BIF_icon_draw_aspect(xPos, 5.0, ICON_STICKY_UVS, 1.0f);
xPos = 25.0;
}
if(G.sima->flag & SI_SELACTFACE) {
BIF_icon_draw_aspect(xPos, 5.0, ICON_DRAW_UVFACES, 1.0f);
if (G.scene->selectmode == SCE_SELECT_FACE || G.sima->flag & SI_SELACTFACE) {
BIF_icon_draw_aspect(xPos, 5.0, ICON_DRAW_UVFACES, 1.0f);
}
} else {
/* use the flags for UV mode - normal operation */
if(G.sima->flag & SI_STICKYUVS) {
BIF_icon_draw_aspect(xPos, 5.0, ICON_STICKY2_UVS, 1.0f);
xPos = 25.0;
}
else if(!(G.sima->flag & SI_LOCALSTICKY)) {
BIF_icon_draw_aspect(xPos, 5.0, ICON_STICKY_UVS, 1.0f);
xPos = 25.0;
}
if(G.sima->flag & SI_SELACTFACE) {
BIF_icon_draw_aspect(xPos, 5.0, ICON_DRAW_UVFACES, 1.0f);
}
}
glBlendFunc(GL_ONE, GL_ZERO);
@ -768,28 +791,30 @@ void image_editvertex_buts(uiBlock *block)
image_transform_but_attr(&imx, &imy, &step, &digits);
for (efa= em->faces.first; efa; efa= efa->next) {
if (!(efa->f & SELECT)) continue;
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (tf->flag & TF_SEL1) {
cent[0]+= tf->uv[0][0];
cent[1]+= tf->uv[0][1];
nactive++;
}
if (tf->flag & TF_SEL2) {
cent[0]+= tf->uv[1][0];
cent[1]+= tf->uv[1][1];
nactive++;
}
if (tf->flag & TF_SEL3) {
cent[0]+= tf->uv[2][0];
cent[1]+= tf->uv[2][1];
nactive++;
}
if (efa->v4 && (tf->flag & TF_SEL4)) {
cent[0]+= tf->uv[3][0];
cent[1]+= tf->uv[3][1];
nactive++;
/*if ((efa->f & SELECT)) { */
if (SIMA_FACEDRAW_CHECK(efa)) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (SIMA_UVSEL_CHECK(efa, tf, 0)) {
cent[0]+= tf->uv[0][0];
cent[1]+= tf->uv[0][1];
nactive++;
}
if (SIMA_UVSEL_CHECK(efa, tf, 1)) {
cent[0]+= tf->uv[1][0];
cent[1]+= tf->uv[1][1];
nactive++;
}
if (SIMA_UVSEL_CHECK(efa, tf, 2)) {
cent[0]+= tf->uv[2][0];
cent[1]+= tf->uv[2][1];
nactive++;
}
if (efa->v4 && SIMA_UVSEL_CHECK(efa, tf, 3)) {
cent[0]+= tf->uv[3][0];
cent[1]+= tf->uv[3][1];
nactive++;
}
}
}
@ -831,24 +856,26 @@ void image_editvertex_buts(uiBlock *block)
}
for (efa= em->faces.first; efa; efa= efa->next) {
if (!(efa->f & SELECT)) continue;
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (tf->flag & TF_SEL1) {
tf->uv[0][0]+= delta[0];
tf->uv[0][1]+= delta[1];
}
if (tf->flag & TF_SEL2) {
tf->uv[1][0]+= delta[0];
tf->uv[1][1]+= delta[1];
}
if (tf->flag & TF_SEL3) {
tf->uv[2][0]+= delta[0];
tf->uv[2][1]+= delta[1];
}
if (efa->v4 && (tf->flag & TF_SEL4)) {
tf->uv[3][0]+= delta[0];
tf->uv[3][1]+= delta[1];
/*if (!(efa->f & SELECT)) continue;*/
if (SIMA_FACEDRAW_CHECK(efa)) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (SIMA_UVSEL_CHECK(efa, tf, 0)) {
tf->uv[0][0]+= delta[0];
tf->uv[0][1]+= delta[1];
}
if (SIMA_UVSEL_CHECK(efa, tf, 1)) {
tf->uv[1][0]+= delta[0];
tf->uv[1][1]+= delta[1];
}
if (SIMA_UVSEL_CHECK(efa, tf, 2)) {
tf->uv[2][0]+= delta[0];
tf->uv[2][1]+= delta[1];
}
if (efa->v4 && SIMA_UVSEL_CHECK(efa, tf, 3)) {
tf->uv[3][0]+= delta[0];
tf->uv[3][1]+= delta[1];
}
}
}
@ -1623,7 +1650,7 @@ void drawimagespace(ScrArea *sa, void *spacedata)
if (!G.obedit && OBACT && (sima->flag & SI_DRAWSHADOW)) {
object_handle_update(OBACT);
}
BIF_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
@ -1761,7 +1788,7 @@ void drawimagespace(ScrArea *sa, void *spacedata)
else if(ibuf->rect_float && ibuf->channels==4)
sima_draw_alpha_pixelsf(x1, y1, ibuf->x, ibuf->y, ibuf->rect_float);
}
else if(sima->flag & SI_SHOW_ZBUF) {
else if(sima->flag & SI_SHOW_ZBUF && ((ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels==1)) == 0)) {
if(ibuf->zbuf)
sima_draw_zbuf_pixels(x1, y1, ibuf->x, ibuf->y, ibuf->zbuf);
else if(ibuf->zbuf_float)

@ -552,10 +552,11 @@ void calculate_uv_map(unsigned short mapmode)
allqueue(REDRAWIMAGE, 0);
}
MTFace *get_active_mtface(EditFace **act_efa, MCol **mcol)
MTFace *get_active_mtface(EditFace **act_efa, MCol **mcol, short partsel)
{
EditMesh *em = G.editMesh;
EditFace *efa = NULL;
EditFace *efa_vertsel = NULL; /* use this if one of the faces verts are selected */
EditSelection *ese;
if(!EM_texFaceCheck())
@ -565,9 +566,8 @@ MTFace *get_active_mtface(EditFace **act_efa, MCol **mcol)
if(ese->type == EDITFACE) {
efa = (EditFace *)ese->data;
if (efa->h)
efa= NULL;
break;
if (efa->h) efa= NULL;
else break;
}
}
@ -575,9 +575,17 @@ MTFace *get_active_mtface(EditFace **act_efa, MCol **mcol)
for (efa= em->faces.first; efa; efa= efa->next) {
if (efa->f & SELECT)
break;
/* use a face that has 1 vert selected as a last resort
* This is so selecting verts in editmode does not always make the UV window flicker */
if (partsel && ((efa->v1->f & SELECT) || (efa->v2->f & SELECT) || (efa->v3->f & SELECT) || (efa->v4 && efa->v4->f & SELECT)))
efa_vertsel = efa;
}
}
if (partsel && !efa)
efa= efa_vertsel;
if (efa) {
if (mcol) {
if (CustomData_has_layer(&em->fdata, CD_MCOL))

@ -52,6 +52,7 @@ editmesh_mods.c, UI level access, no geometry changes
#include "DNA_texture_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_view3d_types.h"
#include "BLI_blenlib.h"
@ -2473,6 +2474,12 @@ void hide_tface_uv(int swap)
if( is_uv_tface_editing_allowed()==0 ) return;
/* call the mesh function if we are in mesh sync sel */
if (G.sima->flag & SI_SYNC_UVSEL) {
hide_mesh(swap);
return;
}
if(swap) {
for (efa= em->faces.first; efa; efa= efa->next) {
if(efa->f & SELECT) {
@ -2514,6 +2521,12 @@ void reveal_tface_uv(void)
if( is_uv_tface_editing_allowed()==0 ) return;
/* call the mesh function if we are in mesh sync sel */
if (G.sima->flag & SI_SYNC_UVSEL) {
reveal_mesh();
return;
}
for (efa= em->faces.first; efa; efa= efa->next) {
if (!(efa->h)) {
if (!(efa->f & SELECT)) {

@ -112,7 +112,7 @@
#include "editmesh.h"
/* local prototypes */
void sel_uvco_inside_radius(short , MTFace *, int , float *, float *, short);
void sel_uvco_inside_radius(short , EditFace *efa, MTFace *, int , float *, float *, short);
void uvedit_selectionCB(short , Object *, short *, float ); /* used in edit.c*/
void object_uvs_changed(Object *ob)
@ -163,9 +163,9 @@ void be_square_tface_uv(EditMesh *em)
/* if 1 vertex selected: doit (with the selected vertex) */
for (efa= em->faces.first; efa; efa= efa->next) {
if (efa->v4) {
if (efa->f & SELECT) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(tface->flag & TF_SEL1) {
if (SIMA_UVSEL_CHECK(efa, tface, 0)) {
if( tface->uv[1][0] == tface->uv[2][0] ) {
tface->uv[1][1]= tface->uv[0][1];
tface->uv[3][0]= tface->uv[0][0];
@ -176,7 +176,7 @@ void be_square_tface_uv(EditMesh *em)
}
}
if(tface->flag & TF_SEL2) {
if (SIMA_UVSEL_CHECK(efa, tface, 1)) {
if( tface->uv[2][1] == tface->uv[3][1] ) {
tface->uv[2][0]= tface->uv[1][0];
tface->uv[0][1]= tface->uv[1][1];
@ -187,7 +187,7 @@ void be_square_tface_uv(EditMesh *em)
}
}
if(tface->flag & TF_SEL3) {
if (SIMA_UVSEL_CHECK(efa, tface, 2)) {
if( tface->uv[3][0] == tface->uv[0][0] ) {
tface->uv[3][1]= tface->uv[2][1];
tface->uv[1][0]= tface->uv[2][0];
@ -197,7 +197,7 @@ void be_square_tface_uv(EditMesh *em)
tface->uv[1][1]= tface->uv[2][1];
}
}
if(tface->flag & TF_SEL4) {
if (SIMA_UVSEL_CHECK(efa, tface, 3)) {
if( tface->uv[0][1] == tface->uv[1][1] ) {
tface->uv[0][0]= tface->uv[3][0];
tface->uv[2][1]= tface->uv[3][1];
@ -266,38 +266,37 @@ void weld_align_tface_uv(char tool)
EditFace *efa;
MTFace *tface;
float cent[2];
int a;
if( is_uv_tface_editing_allowed()==0 ) return;
cent_tface_uv(cent, 0);
if(tool == 'x' || tool == 'w') {
for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
if(efa->f & SELECT) {
for (efa= em->faces.first; efa; efa= efa->next) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(tface->flag & TF_SEL1)
if (SIMA_UVSEL_CHECK(efa, tface, 0))
tface->uv[0][0]= cent[0];
if(tface->flag & TF_SEL2)
if (SIMA_UVSEL_CHECK(efa, tface, 1))
tface->uv[1][0]= cent[0];
if(tface->flag & TF_SEL3)
if (SIMA_UVSEL_CHECK(efa, tface, 2))
tface->uv[2][0]= cent[0];
if(efa->v4 && (tface->flag & TF_SEL4))
if (efa->v4 && SIMA_UVSEL_CHECK(efa, tface, 3))
tface->uv[3][0]= cent[0];
}
}
}
if(tool == 'y' || tool == 'w') {
for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
if(efa->f & SELECT) {
for (efa= em->faces.first; efa; efa= efa->next) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(tface->flag & TF_SEL1)
if (SIMA_UVSEL_CHECK(efa, tface, 0))
tface->uv[0][1]= cent[1];
if(tface->flag & TF_SEL2)
if (SIMA_UVSEL_CHECK(efa, tface, 1))
tface->uv[1][1]= cent[1];
if(tface->flag & TF_SEL3)
if (SIMA_UVSEL_CHECK(efa, tface, 2))
tface->uv[2][1]= cent[1];
if(efa->v4 && (tface->flag & TF_SEL4))
if (efa->v4 && SIMA_UVSEL_CHECK(efa, tface, 3))
tface->uv[3][1]= cent[1];
}
}
@ -329,21 +328,26 @@ void select_invert_tface_uv(void)
EditMesh *em = G.editMesh;
EditFace *efa;
MTFace *tface;
MFace *mface;
int a;
if( is_uv_tface_editing_allowed()==0 ) return;
for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
if(efa->f & SELECT) {
tface = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
tface->flag ^= TF_SEL1;
tface->flag ^= TF_SEL2;
tface->flag ^= TF_SEL3;
if(mface->v4) tface->flag ^= TF_SEL4;
if (G.sima->flag & SI_SYNC_UVSEL) {
/* Warning, this is not that good (calling editmode stuff from UV),
TODO look into changing it */
selectswap_mesh();
return;
} else {
for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tface = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
tface->flag ^= TF_SEL1;
tface->flag ^= TF_SEL2;
tface->flag ^= TF_SEL3;
if(efa->v4) tface->flag ^= TF_SEL4;
}
}
}
BIF_undo_push("Select Inverse UV");
allqueue(REDRAWIMAGE, 0);
@ -358,30 +362,35 @@ void select_swap_tface_uv(void)
if( is_uv_tface_editing_allowed()==0 ) return;
for (efa= em->faces.first; efa; efa= efa->next) {
if (efa->f & SELECT) {
tface = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
if(tface->flag & (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4)) {
sel= 1;
break;
if (G.sima->flag & SI_SYNC_UVSEL) {
deselectall_mesh();
return;
} else {
for (efa= em->faces.first; efa; efa= efa->next) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tface = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
if(tface->flag & (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4)) {
sel= 1;
break;
}
}
}
}
for (efa= em->faces.first; efa; efa= efa->next) {
if (efa->f & SELECT) {
tface = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
if(efa->v4) {
if(sel) tface->flag &= ~(TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
else tface->flag |= (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
}
else {
if(sel) tface->flag &= ~(TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
else tface->flag |= (TF_SEL1+TF_SEL2+TF_SEL3);
}
}
}
for (efa= em->faces.first; efa; efa= efa->next) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tface = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
if(efa->v4) {
if(sel) tface->flag &= ~(TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
else tface->flag |= (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
}
else {
if(sel) tface->flag &= ~(TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
else tface->flag |= (TF_SEL1+TF_SEL2+TF_SEL3);
}
}
}
}
BIF_undo_push("Select swap");
allqueue(REDRAWIMAGE, 0);
@ -408,7 +417,6 @@ static void find_nearest_tface(MTFace **nearesttf, EditFace **nearestefa)
EditMesh *em= G.editMesh;
MTFace *tf;
EditFace *efa;
/*MFace *mf;*/
int i, nverts, mindist, dist, fcenter[2], uval[2];
short mval[2];
@ -419,7 +427,7 @@ static void find_nearest_tface(MTFace **nearesttf, EditFace **nearestefa)
*nearestefa= NULL;
for (efa= em->faces.first; efa; efa= efa->next) {
if (efa->f & SELECT) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
fcenter[0]= fcenter[1]= 0;
nverts= efa->v4? 4: 3;
@ -469,12 +477,11 @@ 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, unsigned int *nearestv, int *nearestuv)
static void find_nearest_uv(MTFace **nearesttf, EditFace **nearestefa, unsigned int *nearestv, int *nearestuv)
{
EditMesh *em= G.editMesh;
EditFace *efa;
MTFace *tf;
/*MFace *mf;*/
int i, nverts, mindist, dist, uval[2];
short mval[2];
@ -482,16 +489,17 @@ static void find_nearest_uv(MTFace **nearesttf, unsigned int *nearestv, int *nea
mindist= 0x7FFFFFF;
*nearesttf= NULL;
*nearestefa= NULL;
for (efa= em->faces.first; efa; efa= efa->next) {
if (efa->f & SELECT) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
nverts= efa->v4? 4: 3;
for(i=0; i<nverts; i++) {
uvco_to_areaco_noclip(tf->uv[i], uval);
dist= abs(mval[0]-uval[0]) + abs(mval[1]-uval[1]);
if(tf->flag & TF_SEL_MASK(i))
if (SIMA_UVSEL_CHECK(efa, tf, i))
dist += 5;
if(dist<=mindist) {
@ -502,6 +510,7 @@ static void find_nearest_uv(MTFace **nearesttf, unsigned int *nearestv, int *nea
mindist= dist;
*nearesttf= tf;
*nearestefa= efa;
*nearestuv= i;
if (i==0) *nearestv= efa->v1->tmp.l;
@ -514,29 +523,43 @@ static void find_nearest_uv(MTFace **nearesttf, unsigned int *nearestv, int *nea
}
}
void mouse_select_sima(void)
void mouse_select_sima(void) /* TODO - SYNCSEL */
{
EditMesh *em = G.editMesh;
EditFace *efa;
MTFace *tf, *nearesttf;
EditFace *nearestefa=NULL;
int a, selectsticky, sticky, actface, nearestuv, i;
short flush = 0; /* 0 == dont flush, 1 == sel, -1 == desel; only use when selection sync is enabled */
unsigned int hitv[4], nearestv;
float *hituv[4], limit[2];
if( is_uv_tface_editing_allowed()==0 ) return;
get_connected_limit_tface_uv(limit);
actface= (G.qual & LR_ALTKEY || G.sima->flag & SI_SELACTFACE);
if(G.qual & LR_CTRLKEY) {
if(G.sima->flag & SI_STICKYUVS) sticky= 0;
else sticky= 1;
}
else {
if(G.sima->flag & SI_STICKYUVS) sticky= 1;
else if(G.sima->flag & SI_LOCALSTICKY) sticky= 2;
else sticky= 0;
if (G.sima->flag & SI_SYNC_UVSEL) {
/* copy from mesh */
if (G.scene->selectmode == SCE_SELECT_FACE) {
actface= 1;
sticky= 0;
} else {
actface= (G.qual & LR_ALTKEY || G.sima->flag & SI_SELACTFACE);
sticky= 2;
}
} else {
/* normal operation */
actface= (G.qual & LR_ALTKEY || G.sima->flag & SI_SELACTFACE);
if(G.qual & LR_CTRLKEY) {
if(G.sima->flag & SI_STICKYUVS) sticky= 0;
else sticky= 1;
}
else {
if(G.sima->flag & SI_STICKYUVS) sticky= 1;
else if(G.sima->flag & SI_LOCALSTICKY) sticky= 2;
else sticky= 0;
}
}
if(actface) {
@ -557,7 +580,7 @@ void mouse_select_sima(void)
else hitv[3]= 0xFFFFFFFF;
}
else {
find_nearest_uv(&nearesttf, &nearestv, &nearestuv);
find_nearest_uv(&nearesttf, &nearestefa, &nearestv, &nearestuv);
if(nearesttf==NULL)
return;
@ -572,26 +595,27 @@ void mouse_select_sima(void)
if(G.qual & LR_SHIFTKEY) {
/* (de)select face */
if(actface) {
if(!(~nearesttf->flag & (TF_SEL1|TF_SEL2|TF_SEL3))
&& (!nearestefa->v4 || nearesttf->flag & TF_SEL4)) {
nearesttf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
if(SIMA_FACESEL_CHECK(nearestefa, nearesttf)) {
SIMA_FACESEL_UNSET(nearestefa, nearesttf);
selectsticky= 0;
}
else {
nearesttf->flag |= TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4;
SIMA_FACESEL_SET(nearestefa, nearesttf);
selectsticky= 1;
}
flush = -1;
}
/* (de)select uv node */
else {
if(nearesttf->flag & TF_SEL_MASK(nearestuv)) {
nearesttf->flag &= ~TF_SEL_MASK(nearestuv);
if (SIMA_UVSEL_CHECK(nearestefa, nearesttf, nearestuv)) {
SIMA_UVSEL_UNSET(nearestefa, nearesttf, nearestuv);
selectsticky= 0;
}
else {
nearesttf->flag |= TF_SEL_MASK(nearestuv);
SIMA_UVSEL_SET(nearestefa, nearesttf, nearestuv);
selectsticky= 1;
}
flush = 1;
}
/* (de)select sticky uv nodes */
@ -604,42 +628,46 @@ void mouse_select_sima(void)
/* deselect */
if(selectsticky==0) {
for (efa= em->faces.first; efa; efa= efa->next) {
if(!(efa->f & SELECT)) continue;
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(nearesttf && tf!=nearesttf) tf->flag &=~ TF_ACTIVE;
if (!sticky) continue;
if(msel_hit(limit, hitv, efa->v1->tmp.l, hituv, tf->uv[0], sticky))
tf->flag &= ~TF_SEL1;
if(msel_hit(limit, hitv, efa->v2->tmp.l, hituv, tf->uv[1], sticky))
tf->flag &= ~TF_SEL2;
if(msel_hit(limit, hitv, efa->v3->tmp.l, hituv, tf->uv[2], sticky))
tf->flag &= ~TF_SEL3;
if (efa->v4)
if(msel_hit(limit, hitv, efa->v4->tmp.l, hituv, tf->uv[3], sticky))
tf->flag &= ~TF_SEL4;
if (SIMA_FACEDRAW_CHECK(efa)) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
/*if(nearesttf && tf!=nearesttf) tf->flag &=~ TF_ACTIVE;*/ /* TODO - deal with editmesh active face */
if (!sticky) continue;
if(msel_hit(limit, hitv, efa->v1->tmp.l, hituv, tf->uv[0], sticky))
SIMA_UVSEL_UNSET(efa, tf, 0);
if(msel_hit(limit, hitv, efa->v2->tmp.l, hituv, tf->uv[1], sticky))
SIMA_UVSEL_UNSET(efa, tf, 1);
if(msel_hit(limit, hitv, efa->v3->tmp.l, hituv, tf->uv[2], sticky))
SIMA_UVSEL_UNSET(efa, tf, 2);
if (efa->v4)
if(msel_hit(limit, hitv, efa->v4->tmp.l, hituv, tf->uv[3], sticky))
SIMA_UVSEL_UNSET(efa, tf, 3);
}
}
flush = -1;
}
/* select */
else {
for (efa= em->faces.first; efa; efa= efa->next) {
if(!(efa->f & SELECT)) continue;
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(nearesttf && tf!=nearesttf)
tf->flag &=~ TF_ACTIVE;
if (!sticky) continue;
if(msel_hit(limit, hitv, efa->v1->tmp.l, hituv, tf->uv[0], sticky))
tf->flag |= TF_SEL1;
if(msel_hit(limit, hitv, efa->v2->tmp.l, hituv, tf->uv[1], sticky))
tf->flag |= TF_SEL2;
if(msel_hit(limit, hitv, efa->v3->tmp.l, hituv, tf->uv[2], sticky))
tf->flag |= TF_SEL3;
if (efa->v4)
if(msel_hit(limit, hitv, efa->v4->tmp.l, hituv, tf->uv[3], sticky))
tf->flag |= TF_SEL4;
if (SIMA_FACEDRAW_CHECK(efa)) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(nearesttf && tf!=nearesttf)
tf->flag &=~ TF_ACTIVE;
if (!sticky) continue;
if(msel_hit(limit, hitv, efa->v1->tmp.l, hituv, tf->uv[0], sticky))
SIMA_UVSEL_SET(efa, tf, 0);
if(msel_hit(limit, hitv, efa->v2->tmp.l, hituv, tf->uv[1], sticky))
SIMA_UVSEL_SET(efa, tf, 1);
if(msel_hit(limit, hitv, efa->v3->tmp.l, hituv, tf->uv[2], sticky))
SIMA_UVSEL_SET(efa, tf, 2);
if (efa->v4)
if(msel_hit(limit, hitv, efa->v4->tmp.l, hituv, tf->uv[3], sticky))
SIMA_UVSEL_SET(efa, tf, 3);
}
}
}
flush = 1;
}
}
}
else {
@ -647,39 +675,51 @@ void mouse_select_sima(void)
if(actface) {
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
if(nearesttf && tf!=nearesttf)
tf->flag &= ~TF_ACTIVE;
SIMA_FACESEL_UNSET(efa, tf);
//if(nearesttf && tf!=nearesttf) /* TODO - deal with editmesh active face */
// tf->flag &= ~TF_ACTIVE;
}
if(nearesttf)
nearesttf->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
SIMA_FACESEL_SET(nearestefa, nearesttf);
}
/* deselect uvs, and select sticky uvs */
for (efa= em->faces.first; efa; efa= efa->next) {
if(efa->f & SELECT) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(!actface) tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
if(!actface) SIMA_FACESEL_UNSET(efa, tf);
if(!sticky) continue;
if(msel_hit(limit, hitv, efa->v1->tmp.l, hituv, tf->uv[0], sticky))
tf->flag |= TF_SEL1;
SIMA_UVSEL_SET(efa, tf, 0);
if(msel_hit(limit, hitv, efa->v2->tmp.l, hituv, tf->uv[1], sticky))
tf->flag |= TF_SEL2;
SIMA_UVSEL_SET(efa, tf, 1);
if(msel_hit(limit, hitv, efa->v3->tmp.l, hituv, tf->uv[2], sticky))
tf->flag |= TF_SEL3;
SIMA_UVSEL_SET(efa, tf, 2);
if(efa->v4)
if(msel_hit(limit, hitv, efa->v4->tmp.l, hituv, tf->uv[3], sticky))
tf->flag |= TF_SEL4;
SIMA_UVSEL_SET(efa, tf, 3);
flush= 1;
}
}
if(!actface)
nearesttf->flag |= TF_SEL_MASK(nearestuv);
if(!actface) {
SIMA_UVSEL_SET(nearestefa, nearesttf, nearestuv);
flush= 1;
}
}
force_draw(1);
if (G.sima->flag & SI_SYNC_UVSEL) {
/* flush for mesh selection */
if (G.scene->selectmode != SCE_SELECT_FACE) {
if (flush==1) EM_select_flush();
else if (flush==-1) EM_deselect_flush();
}
allqueue(REDRAWVIEW3D, 0); /* mesh selection has changed */
}
BIF_undo_push("Select UV");
rightmouse_transform();
}
@ -707,54 +747,63 @@ void borderselect_sima(short whichuvs)
areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
for (efa= em->faces.first; efa; efa= efa->next) {
if(efa->f & SELECT) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (whichuvs == UV_SELECT_ALL) {
if (whichuvs == UV_SELECT_ALL || (G.sima->flag & SI_SYNC_UVSEL) ) {
/* SI_SYNC_UVSEL - cant do pinned selection */
if(BLI_in_rctf(&rectf, (float)tface->uv[0][0], (float)tface->uv[0][1])) {
if(val==LEFTMOUSE) tface->flag |= TF_SEL1;
else tface->flag &= ~TF_SEL1;
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 0);
else SIMA_UVSEL_UNSET(efa, tface, 0);
}
if(BLI_in_rctf(&rectf, (float)tface->uv[1][0], (float)tface->uv[1][1])) {
if(val==LEFTMOUSE) tface->flag |= TF_SEL2;
else tface->flag &= ~TF_SEL2;
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 1);
else SIMA_UVSEL_UNSET(efa, tface, 1);
}
if(BLI_in_rctf(&rectf, (float)tface->uv[2][0], (float)tface->uv[2][1])) {
if(val==LEFTMOUSE) tface->flag |= TF_SEL3;
else tface->flag &= ~TF_SEL3;
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 2);
else SIMA_UVSEL_UNSET(efa, tface, 2);
}
if(efa->v4 && BLI_in_rctf(&rectf, (float)tface->uv[3][0], (float)tface->uv[3][1])) {
if(val==LEFTMOUSE) tface->flag |= TF_SEL4;
else tface->flag &= ~TF_SEL4;
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 3);
else SIMA_UVSEL_UNSET(efa, tface, 3);
}
} else if (whichuvs == UV_SELECT_PINNED) {
if ((tface->unwrap & TF_PIN1) &&
BLI_in_rctf(&rectf, (float)tface->uv[0][0], (float)tface->uv[0][1])) {
if(val==LEFTMOUSE) tface->flag |= TF_SEL1;
else tface->flag &= ~TF_SEL1;
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 0);
else SIMA_UVSEL_UNSET(efa, tface, 0);
}
if ((tface->unwrap & TF_PIN2) &&
BLI_in_rctf(&rectf, (float)tface->uv[1][0], (float)tface->uv[1][1])) {
if(val==LEFTMOUSE) tface->flag |= TF_SEL2;
else tface->flag &= ~TF_SEL2;
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 1);
else SIMA_UVSEL_UNSET(efa, tface, 1);
}
if ((tface->unwrap & TF_PIN3) &&
BLI_in_rctf(&rectf, (float)tface->uv[2][0], (float)tface->uv[2][1])) {
if(val==LEFTMOUSE) tface->flag |= TF_SEL3;
else tface->flag &= ~TF_SEL3;
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 2);
else SIMA_UVSEL_UNSET(efa, tface, 2);
}
if ((efa->v4) && (tface->unwrap & TF_PIN4) && BLI_in_rctf(&rectf, (float)tface->uv[3][0], (float)tface->uv[3][1])) {
if(val==LEFTMOUSE) tface->flag |= TF_SEL4;
else tface->flag &= ~TF_SEL4;
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 3);
else SIMA_UVSEL_UNSET(efa, tface, 3);
}
}
}
}
/* make sure newly selected vert selection is updated*/
if (G.sima->flag & SI_SYNC_UVSEL) {
if (G.scene->selectmode != SCE_SELECT_FACE) {
if (val==LEFTMOUSE) EM_select_flush();
else EM_deselect_flush();
}
allqueue(REDRAWVIEW3D, 0); /* mesh selection has changed */
}
BIF_undo_push("Border select UV");
scrarea_queue_winredraw(curarea);
}
@ -768,13 +817,13 @@ int snap_uv_sel_to_curs(void)
short change = 0;
for (efa= em->faces.first; efa; efa= efa->next) {
if(efa->f & SELECT) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (tface->flag & TF_SEL1) VECCOPY2D(tface->uv[0], G.v2d->cursor);
if (tface->flag & TF_SEL2) VECCOPY2D(tface->uv[1], G.v2d->cursor);
if (tface->flag & TF_SEL3) VECCOPY2D(tface->uv[2], G.v2d->cursor);
if (SIMA_UVSEL_CHECK(efa, tface, 0)) VECCOPY2D(tface->uv[0], G.v2d->cursor);
if (SIMA_UVSEL_CHECK(efa, tface, 1)) VECCOPY2D(tface->uv[1], G.v2d->cursor);
if (SIMA_UVSEL_CHECK(efa, tface, 2)) VECCOPY2D(tface->uv[2], G.v2d->cursor);
if (efa->v4)
if (tface->flag & TF_SEL4) VECCOPY2D(tface->uv[3], G.v2d->cursor);
if (SIMA_UVSEL_CHECK(efa, tface, 3)) VECCOPY2D(tface->uv[3], G.v2d->cursor);
change = 1;
}
}
@ -801,13 +850,13 @@ int snap_uv_sel_to_pixels(void) /* warning, sanity checks must alredy be done */
h = (float)hi;
for (efa= em->faces.first; efa; efa= efa->next) {
if(efa->f & SELECT) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (tface->flag & TF_SEL1) snap_coord_to_pixel(tface->uv[0], w, h);
if (tface->flag & TF_SEL2) snap_coord_to_pixel(tface->uv[1], w, h);
if (tface->flag & TF_SEL3) snap_coord_to_pixel(tface->uv[2], w, h);
if (SIMA_UVSEL_CHECK(efa, tface, 0)) snap_coord_to_pixel(tface->uv[0], w, h);
if (SIMA_UVSEL_CHECK(efa, tface, 1)) snap_coord_to_pixel(tface->uv[1], w, h);
if (SIMA_UVSEL_CHECK(efa, tface, 2)) snap_coord_to_pixel(tface->uv[2], w, h);
if (efa->v4)
if (tface->flag & TF_SEL4) snap_coord_to_pixel(tface->uv[3], w, h);
if (SIMA_UVSEL_CHECK(efa, tface, 3)) snap_coord_to_pixel(tface->uv[3], w, h);
change = 1;
}
}
@ -869,7 +918,7 @@ void snap_menu_sima(void)
* Just for readability...
*/
void sel_uvco_inside_radius(short sel, MTFace *tface, int index, float *offset, float *ell, short select_mask)
void sel_uvco_inside_radius(short sel, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, short select_index)
{
// normalized ellipse: ell[0] = scaleX,
// [1] = scaleY
@ -882,8 +931,8 @@ void sel_uvco_inside_radius(short sel, MTFace *tface, int index, float *offset,
r2 = x * x + y * y;
if (r2 < 1.0) {
if (sel == LEFTMOUSE) tface->flag |= select_mask;
else tface->flag &= ~select_mask;
if (sel == LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, select_index);
else SIMA_UVSEL_UNSET(efa, tface, select_index);
}
}
@ -929,11 +978,11 @@ void uvedit_selectionCB(short selecting, Object *editobj, short *mval, float rad
if (selecting) {
for (efa= em->faces.first; efa; efa= efa->next) {
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
sel_uvco_inside_radius(selecting, tface, 0, offset, ellipse, TF_SEL1);
sel_uvco_inside_radius(selecting, tface, 1, offset, ellipse, TF_SEL2);
sel_uvco_inside_radius(selecting, tface, 2, offset, ellipse, TF_SEL3);
sel_uvco_inside_radius(selecting, efa, tface, 0, offset, ellipse, 0);
sel_uvco_inside_radius(selecting, efa, tface, 1, offset, ellipse, 1);
sel_uvco_inside_radius(selecting, efa, tface, 2, offset, ellipse, 2);
if (efa->v4)
sel_uvco_inside_radius(selecting, tface, 3, offset, ellipse, TF_SEL4);
sel_uvco_inside_radius(selecting, efa, tface, 3, offset, ellipse, 3);
}
if(G.f & G_DRAWFACES) { /* full redraw only if necessary */
@ -946,7 +995,11 @@ void uvedit_selectionCB(short selecting, Object *editobj, short *mval, float rad
bglFlush();
glDrawBuffer(GL_BACK);
}
}
}
if (selecting == LEFTMOUSE) EM_select_flush();
else EM_deselect_flush();
allqueue(REDRAWVIEW3D, 0);
}
@ -1016,7 +1069,11 @@ void stitch_uv_tface(int mode)
if(is_uv_tface_editing_allowed()==0)
return;
if(G.sima->flag & SI_SYNC_UVSEL) {
error("Can't stitch when Mesh Sync selection is enabled");
return;
}
limit[0]= limit[1]= 20.0;
if(mode==1) {
add_numbut(0, NUM|FLO, "Limit:", 0.1, 1000.0, &limit[0], NULL);
@ -1123,10 +1180,10 @@ void stitch_uv_tface(int mode)
object_uvs_changed(OBACT);
}
void select_linked_tface_uv(int mode)
void select_linked_tface_uv(int mode) /* TODO */
{
EditMesh *em= G.editMesh;
EditFace *efa;
EditFace *efa, *nearestefa=NULL;
MTFace *tf, *nearesttf=NULL;
UvVertMap *vmap;
UvMapVert *vlist, *iterv, *startv;
@ -1137,12 +1194,17 @@ void select_linked_tface_uv(int mode)
if(is_uv_tface_editing_allowed()==0)
return;
if(G.sima->flag & SI_SYNC_UVSEL) {
error("Can't stitch when Mesh Sync selection is enabled");
return;
}
if (mode == 2) {
nearesttf= NULL;
nearestuv= 0;
}
if (mode!=2) {
find_nearest_uv(&nearesttf, &nearestv, &nearestuv);
find_nearest_uv(&nearesttf, &nearestefa, &nearestv, &nearestuv);
if(nearesttf==NULL)
return;
}
@ -1157,7 +1219,7 @@ void select_linked_tface_uv(int mode)
if (mode == 2) {
for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
if(!(efa->h) && (efa->f & SELECT)) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)) {
stack[stacksize]= a;
@ -1238,7 +1300,6 @@ void select_linked_tface_uv(int mode)
}
}
/*if (a<me->totface) {*/
if (efa) {
for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
if(flag[a]) {
@ -1274,8 +1335,13 @@ void unlink_selection(void)
if( is_uv_tface_editing_allowed()==0 ) return;
if(G.sima->flag & SI_SYNC_UVSEL) {
error("Can't stitch when Mesh Sync selection is enabled");
return;
}
for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
if(efa->f & SELECT) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(efa->v4) {
if(~tface->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4))
@ -1324,21 +1390,22 @@ void pin_tface_uv(int mode)
if( is_uv_tface_editing_allowed()==0 ) return;
for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
if(efa->f & SELECT) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(mode ==1){
if(tface->flag & TF_SEL1) tface->unwrap |= TF_PIN1;
if(tface->flag & TF_SEL2) tface->unwrap |= TF_PIN2;
if(tface->flag & TF_SEL3) tface->unwrap |= TF_PIN3;
if(SIMA_UVSEL_CHECK(efa, tface, 0)) tface->unwrap |= TF_PIN1;
if(SIMA_UVSEL_CHECK(efa, tface, 1)) tface->unwrap |= TF_PIN2;
if(SIMA_UVSEL_CHECK(efa, tface, 2)) tface->unwrap |= TF_PIN3;
if(efa->v4)
if(tface->flag & TF_SEL4) tface->unwrap |= TF_PIN4;
if(SIMA_UVSEL_CHECK(efa, tface, 3)) tface->unwrap |= TF_PIN4;
}
else if (mode ==0){
if(tface->flag & TF_SEL1) tface->unwrap &= ~TF_PIN1;
if(tface->flag & TF_SEL2) tface->unwrap &= ~TF_PIN2;
if(tface->flag & TF_SEL3) tface->unwrap &= ~TF_PIN3;
if(SIMA_UVSEL_CHECK(efa, tface, 0)) tface->unwrap &= ~TF_PIN1;
if(SIMA_UVSEL_CHECK(efa, tface, 1)) tface->unwrap &= ~TF_PIN2;
if(SIMA_UVSEL_CHECK(efa, tface, 2)) tface->unwrap &= ~TF_PIN3;
if(efa->v4)
if(tface->flag & TF_SEL4) tface->unwrap &= ~TF_PIN4;
if(SIMA_UVSEL_CHECK(efa, tface, 3)) tface->unwrap &= ~TF_PIN4;
}
}
}
@ -1357,18 +1424,22 @@ void select_pinned_tface_uv(void)
if( is_uv_tface_editing_allowed()==0 ) return;
for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
if(efa->f & SELECT) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (tface->unwrap & TF_PIN1) tface->flag |= TF_SEL1;
if (tface->unwrap & TF_PIN2) tface->flag |= TF_SEL2;
if (tface->unwrap & TF_PIN3) tface->flag |= TF_SEL3;
if (tface->unwrap & TF_PIN1) SIMA_UVSEL_SET(efa, tface, 0);
if (tface->unwrap & TF_PIN2) SIMA_UVSEL_SET(efa, tface, 1);
if (tface->unwrap & TF_PIN3) SIMA_UVSEL_SET(efa, tface, 2);
if(efa->v4) {
if (tface->unwrap & TF_PIN4) tface->flag |= TF_SEL4;
if (tface->unwrap & TF_PIN4) SIMA_UVSEL_SET(efa, tface, 3);
}
}
}
if (G.sima->flag & SI_SYNC_UVSEL) {
allqueue(REDRAWVIEW3D, 0); /* mesh selection has changed */
}
BIF_undo_push("Select Pinned UVs");
scrarea_queue_winredraw(curarea);
}
@ -1386,13 +1457,12 @@ int minmax_tface_uv(float *min, float *max)
sel= 0;
for (efa= em->faces.first; efa; efa= efa->next) {
if (efa->h);
else if(efa->f & SELECT) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (tf->flag & TF_SEL1) DO_MINMAX2(tf->uv[0], min, max);
if (tf->flag & TF_SEL2) DO_MINMAX2(tf->uv[1], min, max);
if (tf->flag & TF_SEL3) DO_MINMAX2(tf->uv[2], min, max);
if (efa->v4 && tf->flag & TF_SEL4) DO_MINMAX2(tf->uv[3], min, max);
if (SIMA_UVSEL_CHECK(efa, tf, 0)) DO_MINMAX2(tf->uv[0], min, max);
if (SIMA_UVSEL_CHECK(efa, tf, 1)) DO_MINMAX2(tf->uv[1], min, max);
if (SIMA_UVSEL_CHECK(efa, tf, 2)) DO_MINMAX2(tf->uv[2], min, max);
if (efa->v4 && (SIMA_UVSEL_CHECK(efa, tf, 3))) DO_MINMAX2(tf->uv[3], min, max);
sel = 1;
}
}
@ -1416,12 +1486,12 @@ int cent_tface_uv(float *cent, int mode)
INIT_MINMAX2(min, max);
for (efa= G.editMesh->faces.first; efa; efa= efa->next) {
if(efa->f & SELECT && efa->h==0) {
if (SIMA_FACEDRAW_CHECK(efa)) {
tf = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
if (tf->flag & TF_SEL1) { DO_MINMAX2(tf->uv[0], min, max); change= 1;}
if (tf->flag & TF_SEL2) { DO_MINMAX2(tf->uv[1], min, max); change= 1;}
if (tf->flag & TF_SEL3) { DO_MINMAX2(tf->uv[2], min, max); change= 1;}
if (efa->v4 && tf->flag & TF_SEL4) { DO_MINMAX2(tf->uv[3], min, max); change= 1;}
if (SIMA_UVSEL_CHECK(efa, tf, 0)) { DO_MINMAX2(tf->uv[0], min, max); change= 1;}
if (SIMA_UVSEL_CHECK(efa, tf, 1)) { DO_MINMAX2(tf->uv[1], min, max); change= 1;}
if (SIMA_UVSEL_CHECK(efa, tf, 2)) { DO_MINMAX2(tf->uv[2], min, max); change= 1;}
if (efa->v4 && (SIMA_UVSEL_CHECK(efa, tf, 3))) { DO_MINMAX2(tf->uv[3], min, max); change= 1;}
}
}
break;

@ -576,20 +576,25 @@ static uiBlock *image_selectmenu(void *arg_unused)
block= uiNewBlock(&curarea->uiblocks, "image_selectmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
uiBlockSetButmFunc(block, do_image_selectmenu, NULL);
if(G.sima->flag & SI_SELACTFACE) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Active Face Select|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Active Face Select|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
if(G.sima->flag & SI_LOCALSTICKY) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Stick Local UVs to Mesh Vertex|Shift C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Stick Local UVs to Mesh Vertex|Shift C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
if(G.sima->flag & SI_STICKYUVS) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Stick UVs to Mesh Vertex|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Stick UVs to Mesh Vertex|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
if ((G.sima->flag & SI_SYNC_UVSEL)==0 || (G.sima->flag & SI_SYNC_UVSEL && (G.scene->selectmode != SCE_SELECT_FACE))) {
if(G.sima->flag & SI_SELACTFACE) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Active Face Select|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Active Face Select|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
}
if ((G.sima->flag & SI_SYNC_UVSEL)==0) {
if(G.sima->flag & SI_LOCALSTICKY) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Stick Local UVs to Mesh Vertex|Shift C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Stick Local UVs to Mesh Vertex|Shift C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
if(G.sima->flag & SI_STICKYUVS) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Stick UVs to Mesh Vertex|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Stick UVs to Mesh Vertex|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
}
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select Pinned|Shift B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
@ -1175,11 +1180,16 @@ 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);
/* UV EditMode buttons */
if (EM_texFaceCheck() && (G.sima->flag & SI_DRAWTOOL)==0) {
/* UV EditMode buttons, not painting or rencering or compositing */
if ( EM_texFaceCheck() &&
(G.sima->flag & SI_DRAWTOOL)==0 &&
((G.sima->image==NULL) || ((G.sima->image->type != IMA_TYPE_R_RESULT) && (G.sima->image->type != IMA_TYPE_COMPOSITE)))
) {
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;
xco+= XIC + 12;
uiDefIconButBitI(block, TOG, SI_SYNC_UVSEL, B_REDR, ICON_MESH_HLT, xco,0,XIC,YIC, &G.sima->flag, 0, 0, 0, 0, "Sync from mesh selection");
xco+= XIC+16;
}
if (ima) {
@ -1207,6 +1217,7 @@ void image_buttons(void)
}
uiDefIconButBitI(block, TOG, SI_DRAWTOOL, B_SIMAGEPAINTTOOL, ICON_TPAINT_HLT, xco,0,XIC,YIC, &G.sima->flag, 0, 0, 0, 0, "Enables painting textures on the image with left mouse button");
xco+= XIC+8;
uiBlockBeginAlign(block);
@ -1221,7 +1232,6 @@ void image_buttons(void)
uiDefIconButBitI(block, TOG, SI_SHOW_ZBUF, B_SIMA_SHOW_ZBUF, ICON_SOLID, xco,0,XIC,YIC, &G.sima->flag, 0, 0, 0, 0, "Draws zbuffer values");
xco+= XIC;
}
else G.sima->flag &= ~SI_SHOW_ZBUF; /* no confusing display for non-zbuf images */
}
xco+= 8;
@ -1240,7 +1250,7 @@ void image_buttons(void)
/* draw LOCK */
uiDefIconButS(block, ICONTOG, 0, ICON_UNLOCKED, xco,0,XIC,YIC, &(G.sima->lock), 0, 0, 0, 0, "Updates other affected window spaces automatically to reflect changes in real time");
/* Always do this last */
curarea->headbutlen= xco+2*XIC;

@ -4815,14 +4815,41 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
borderselect_sima(UV_SELECT_ALL);
break;
case CKEY:
if(G.qual==LR_CTRLKEY)
toggle_uv_select('s');
else if(G.qual==LR_SHIFTKEY)
toggle_uv_select('l');
else if(G.qual==LR_ALTKEY)
toggle_uv_select('o');
else
toggle_uv_select('f');
if (G.sima->flag & SI_SYNC_UVSEL) {
/* operate on the editmesh */
if (G.qual==0) {
if (G.scene->selectmode != SCE_SELECT_FACE)
toggle_uv_select('f');
/* we could do this too but better not to */
/*if ((G.scene->selectmode & SCE_SELECT_FACE)==0) {
G.scene->selectmode= SCE_SELECT_FACE;
EM_selectmode_set();
BIF_undo_push("Selectmode Set: Face");
} else {
G.scene->selectmode= SCE_SELECT_VERTEX;
EM_selectmode_set();
BIF_undo_push("Selectmode Set: Vertex");
}
countall();
allqueue(REDRAWVIEW3D, 1); */
} else {
error("Sync selection to Edit Mesh disables UV select options");
}
} else {
/* normal operaton */
if(G.qual==LR_CTRLKEY)
toggle_uv_select('s');
else if(G.qual==LR_SHIFTKEY)
toggle_uv_select('l');
else if(G.qual==LR_ALTKEY)
toggle_uv_select('o');
else
toggle_uv_select('f');
}
break;
case EKEY :
if(okee("Unwrap"))
@ -4840,7 +4867,7 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
else if((G.qual==LR_SHIFTKEY))
hide_tface_uv(1);
else if((G.qual==0))
hide_tface_uv(0);
hide_tface_uv(0);
break;
case LKEY:
if(G.qual==0)

@ -1858,12 +1858,12 @@ static void createTransUVs(TransInfo *t)
/* count */
for (efa= em->faces.first; efa; efa= efa->next) {
if (efa->f & SELECT) {
if SIMA_FACEDRAW_CHECK(efa) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(tf->flag & TF_SEL1) countsel++;
if(tf->flag & TF_SEL2) countsel++;
if(tf->flag & TF_SEL3) countsel++;
if(efa->v4 && (tf->flag & TF_SEL4)) countsel++;
if (SIMA_UVSEL_CHECK(efa, tf, 0)) countsel++;
if (SIMA_UVSEL_CHECK(efa, tf, 1)) countsel++;
if (SIMA_UVSEL_CHECK(efa, tf, 2)) countsel++;
if (efa->v4 && SIMA_UVSEL_CHECK(efa, tf, 3)) countsel++;
if(propmode)
count += (efa->v4)? 4: 3;
}
@ -1884,17 +1884,17 @@ static void createTransUVs(TransInfo *t)
td= t->data;
td2d= t->data2d;
for (efa= em->faces.first; efa; efa= efa->next) {
if (efa->f & SELECT) {
if SIMA_FACEDRAW_CHECK(efa) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(tf->flag & TF_SEL1 || propmode)
UVsToTransData(td++, td2d++, tf->uv[0], (tf->flag & TF_SEL1));
if(tf->flag & TF_SEL2 || propmode)
UVsToTransData(td++, td2d++, tf->uv[1], (tf->flag & TF_SEL2));
if(tf->flag & TF_SEL3 || propmode)
UVsToTransData(td++, td2d++, tf->uv[2], (tf->flag & TF_SEL3));
if(propmode || SIMA_UVSEL_CHECK(efa, tf, 0))
UVsToTransData(td++, td2d++, tf->uv[0], SIMA_UVSEL_CHECK(efa, tf, 0));
if(propmode || SIMA_UVSEL_CHECK(efa, tf, 1))
UVsToTransData(td++, td2d++, tf->uv[1], SIMA_UVSEL_CHECK(efa, tf, 1));
if(propmode || SIMA_UVSEL_CHECK(efa, tf, 2))
UVsToTransData(td++, td2d++, tf->uv[2], SIMA_UVSEL_CHECK(efa, tf, 2));
if(efa->v4 && (tf->flag & TF_SEL4 || propmode))
UVsToTransData(td++, td2d++, tf->uv[3], (tf->flag & TF_SEL4));
if(efa->v4 && (propmode || SIMA_UVSEL_CHECK(efa, tf, 3)))
UVsToTransData(td++, td2d++, tf->uv[3], SIMA_UVSEL_CHECK(efa, tf, 3));
}
}

@ -191,14 +191,10 @@ void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int index)
}
/* Parametrizer */
ParamHandle *construct_param_handle(EditMesh *em, short implicit, short fill, short sel)
{
int a;
MTFace *tf;
/*MFace *mf;
MVert *mv;
MEdge *medge;*/
EditFace *efa;
EditEdge *eed;
@ -208,7 +204,7 @@ ParamHandle *construct_param_handle(EditMesh *em, short implicit, short fill, sh
handle = param_construct_begin();
/* we need the vert */
/* we need the vert indicies */
for (ev= em->verts.first, a=0; ev; ev= ev->next, a++)
ev->tmp.l = a;
@ -218,17 +214,23 @@ ParamHandle *construct_param_handle(EditMesh *em, short implicit, short fill, sh
float *co[4];
float *uv[4];
int nverts;
tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (efa->h)
continue;
if (sel && !(efa->f & SELECT))
tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (sel && !SIMA_FACESEL_CHECK(efa, tf))
continue;
if (implicit && !(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)))
if (implicit &&
!( SIMA_UVSEL_CHECK(efa, tf, 0) ||
SIMA_UVSEL_CHECK(efa, tf, 1) ||
SIMA_UVSEL_CHECK(efa, tf, 2) ||
(efa->v4 && SIMA_UVSEL_CHECK(efa, tf, 3)) )
) {
continue;
}
key = (ParamKey)efa;
vkeys[0] = (ParamKey)efa->v1->tmp.l;
@ -247,16 +249,16 @@ ParamHandle *construct_param_handle(EditMesh *em, short implicit, short fill, sh
pin[1] = ((tf->unwrap & TF_PIN2) != 0);
pin[2] = ((tf->unwrap & TF_PIN3) != 0);
select[0] = ((tf->flag & TF_SEL1) != 0);
select[1] = ((tf->flag & TF_SEL2) != 0);
select[2] = ((tf->flag & TF_SEL3) != 0);
select[0] = ((SIMA_UVSEL_CHECK(efa, tf, 0)) != 0);
select[1] = ((SIMA_UVSEL_CHECK(efa, tf, 1)) != 0);
select[2] = ((SIMA_UVSEL_CHECK(efa, tf, 2)) != 0);
if (efa->v4) {
vkeys[3] = (ParamKey)efa->v4->tmp.l;
co[3] = efa->v4->co;
uv[3] = tf->uv[3];
pin[3] = ((tf->unwrap & TF_PIN4) != 0);
select[3] = ((tf->flag & TF_SEL4) != 0);
select[3] = (SIMA_UVSEL_CHECK(efa, tf, 3) != 0);
nverts = 4;
}
else