forked from bartvdbraak/blender
UV Editmode
made UV face selecting into a generic function that respects UV sticky modes. moved this out of lasso so border select uses too.
This commit is contained in:
parent
2062aa6838
commit
0b9f1be464
@ -96,6 +96,7 @@ void reveal_tface_uv(void);
|
|||||||
void stitch_limit_uv_tface(void);
|
void stitch_limit_uv_tface(void);
|
||||||
void stitch_vert_uv_tface(void);
|
void stitch_vert_uv_tface(void);
|
||||||
void unlink_selection(void);
|
void unlink_selection(void);
|
||||||
|
void uvface_setsel__internal(short select);
|
||||||
void select_linked_tface_uv(int mode);
|
void select_linked_tface_uv(int mode);
|
||||||
void pin_tface_uv(int mode);
|
void pin_tface_uv(int mode);
|
||||||
void weld_align_menu_tface_uv(void);
|
void weld_align_menu_tface_uv(void);
|
||||||
|
@ -2494,6 +2494,7 @@ void reveal_mesh(void)
|
|||||||
BIF_undo_push("Reveal");
|
BIF_undo_push("Reveal");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO - improve this with sync sel and selection flushing */
|
||||||
void hide_tface_uv(int swap)
|
void hide_tface_uv(int swap)
|
||||||
{
|
{
|
||||||
EditMesh *em = G.editMesh;
|
EditMesh *em = G.editMesh;
|
||||||
|
@ -830,13 +830,14 @@ void borderselect_sima(short whichuvs)
|
|||||||
MTFace *tface;
|
MTFace *tface;
|
||||||
rcti rect;
|
rcti rect;
|
||||||
rctf rectf;
|
rctf rectf;
|
||||||
int val;
|
int val, ok = 1;
|
||||||
short mval[2];
|
short mval[2], select;
|
||||||
|
|
||||||
if( is_uv_tface_editing_allowed()==0) return;
|
if( is_uv_tface_editing_allowed()==0) return;
|
||||||
|
|
||||||
val= get_border(&rect, 3);
|
val= get_border(&rect, 3);
|
||||||
|
select = (val==LEFTMOUSE) ? 1 : 0;
|
||||||
|
|
||||||
if(val) {
|
if(val) {
|
||||||
mval[0]= rect.xmin;
|
mval[0]= rect.xmin;
|
||||||
mval[1]= rect.ymin;
|
mval[1]= rect.ymin;
|
||||||
@ -844,66 +845,86 @@ void borderselect_sima(short whichuvs)
|
|||||||
mval[0]= rect.xmax;
|
mval[0]= rect.xmax;
|
||||||
mval[1]= rect.ymax;
|
mval[1]= rect.ymax;
|
||||||
areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
|
areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
|
||||||
|
|
||||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
if (draw_uvs_face_check() && whichuvs != UV_SELECT_PINNED) {
|
||||||
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
float cent[2];
|
||||||
if (SIMA_FACEDRAW_CHECK(efa, tface)) {
|
ok = 0;
|
||||||
if (whichuvs == UV_SELECT_ALL || (G.sima->flag & SI_SYNC_UVSEL) ) {
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||||
/* SI_SYNC_UVSEL - cant do pinned selection */
|
/* assume not touched */
|
||||||
if(BLI_in_rctf(&rectf, (float)tface->uv[0][0], (float)tface->uv[0][1])) {
|
efa->tmp.l = 0;
|
||||||
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 0);
|
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
else SIMA_UVSEL_UNSET(efa, tface, 0);
|
if (SIMA_FACEDRAW_CHECK(efa, tface)) {
|
||||||
|
tface_center(tface, cent, (void *)efa->v4);
|
||||||
|
if(BLI_in_rctf(&rectf, cent[0], cent[1])) {
|
||||||
|
efa->tmp.l = ok = 1;
|
||||||
}
|
}
|
||||||
if(BLI_in_rctf(&rectf, (float)tface->uv[1][0], (float)tface->uv[1][1])) {
|
}
|
||||||
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 1);
|
}
|
||||||
else SIMA_UVSEL_UNSET(efa, tface, 1);
|
/* (de)selects all tagged faces and deals with sticky modes */
|
||||||
}
|
if (ok)
|
||||||
if(BLI_in_rctf(&rectf, (float)tface->uv[2][0], (float)tface->uv[2][1])) {
|
uvface_setsel__internal(select);
|
||||||
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 2);
|
} else {
|
||||||
else SIMA_UVSEL_UNSET(efa, tface, 2);
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||||
}
|
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
if(efa->v4 && BLI_in_rctf(&rectf, (float)tface->uv[3][0], (float)tface->uv[3][1])) {
|
if (SIMA_FACEDRAW_CHECK(efa, tface)) {
|
||||||
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 3);
|
if (whichuvs == UV_SELECT_ALL || (G.sima->flag & SI_SYNC_UVSEL) ) {
|
||||||
else SIMA_UVSEL_UNSET(efa, tface, 3);
|
/* SI_SYNC_UVSEL - cant do pinned selection */
|
||||||
}
|
if(BLI_in_rctf(&rectf, tface->uv[0][0], tface->uv[0][1])) {
|
||||||
} else if (whichuvs == UV_SELECT_PINNED) {
|
if(select) SIMA_UVSEL_SET(efa, tface, 0);
|
||||||
if ((tface->unwrap & TF_PIN1) &&
|
else SIMA_UVSEL_UNSET(efa, tface, 0);
|
||||||
BLI_in_rctf(&rectf, (float)tface->uv[0][0], (float)tface->uv[0][1])) {
|
}
|
||||||
|
if(BLI_in_rctf(&rectf, tface->uv[1][0], tface->uv[1][1])) {
|
||||||
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 0);
|
if(select) SIMA_UVSEL_SET(efa, tface, 1);
|
||||||
else SIMA_UVSEL_UNSET(efa, tface, 0);
|
else SIMA_UVSEL_UNSET(efa, tface, 1);
|
||||||
}
|
}
|
||||||
if ((tface->unwrap & TF_PIN2) &&
|
if(BLI_in_rctf(&rectf, tface->uv[2][0], tface->uv[2][1])) {
|
||||||
BLI_in_rctf(&rectf, (float)tface->uv[1][0], (float)tface->uv[1][1])) {
|
if(select) SIMA_UVSEL_SET(efa, tface, 2);
|
||||||
|
else SIMA_UVSEL_UNSET(efa, tface, 2);
|
||||||
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 1);
|
}
|
||||||
else SIMA_UVSEL_UNSET(efa, tface, 1);
|
if(efa->v4 && BLI_in_rctf(&rectf, tface->uv[3][0], tface->uv[3][1])) {
|
||||||
}
|
if(select) SIMA_UVSEL_SET(efa, tface, 3);
|
||||||
if ((tface->unwrap & TF_PIN3) &&
|
else SIMA_UVSEL_UNSET(efa, tface, 3);
|
||||||
BLI_in_rctf(&rectf, (float)tface->uv[2][0], (float)tface->uv[2][1])) {
|
}
|
||||||
|
} else if (whichuvs == UV_SELECT_PINNED) {
|
||||||
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 2);
|
if ((tface->unwrap & TF_PIN1) &&
|
||||||
else SIMA_UVSEL_UNSET(efa, tface, 2);
|
BLI_in_rctf(&rectf, tface->uv[0][0], tface->uv[0][1])) {
|
||||||
}
|
|
||||||
if ((efa->v4) && (tface->unwrap & TF_PIN4) && BLI_in_rctf(&rectf, (float)tface->uv[3][0], (float)tface->uv[3][1])) {
|
if(select) SIMA_UVSEL_SET(efa, tface, 0);
|
||||||
if(val==LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, 3);
|
else SIMA_UVSEL_UNSET(efa, tface, 0);
|
||||||
else SIMA_UVSEL_UNSET(efa, tface, 3);
|
}
|
||||||
|
if ((tface->unwrap & TF_PIN2) &&
|
||||||
|
BLI_in_rctf(&rectf, tface->uv[1][0], tface->uv[1][1])) {
|
||||||
|
|
||||||
|
if(select) SIMA_UVSEL_SET(efa, tface, 1);
|
||||||
|
else SIMA_UVSEL_UNSET(efa, tface, 1);
|
||||||
|
}
|
||||||
|
if ((tface->unwrap & TF_PIN3) &&
|
||||||
|
BLI_in_rctf(&rectf, tface->uv[2][0], tface->uv[2][1])) {
|
||||||
|
|
||||||
|
if(select) SIMA_UVSEL_SET(efa, tface, 2);
|
||||||
|
else SIMA_UVSEL_UNSET(efa, tface, 2);
|
||||||
|
}
|
||||||
|
if ((efa->v4) && (tface->unwrap & TF_PIN4) && BLI_in_rctf(&rectf, tface->uv[3][0], tface->uv[3][1])) {
|
||||||
|
if(select) SIMA_UVSEL_SET(efa, tface, 3);
|
||||||
|
else SIMA_UVSEL_UNSET(efa, tface, 3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ok) {
|
||||||
/* make sure newly selected vert selection is updated*/
|
/* make sure newly selected vert selection is updated*/
|
||||||
if (G.sima->flag & SI_SYNC_UVSEL) {
|
if (G.sima->flag & SI_SYNC_UVSEL) {
|
||||||
if (G.scene->selectmode != SCE_SELECT_FACE) {
|
if (G.scene->selectmode != SCE_SELECT_FACE) {
|
||||||
if (val==LEFTMOUSE) EM_select_flush();
|
if (select) EM_select_flush();
|
||||||
else EM_deselect_flush();
|
else EM_deselect_flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
allqueue(REDRAWVIEW3D, 0); /* mesh selection has changed */
|
allqueue(REDRAWVIEW3D, 0); /* mesh selection has changed */
|
||||||
|
|
||||||
|
BIF_undo_push("Border select UV");
|
||||||
|
scrarea_queue_winredraw(curarea);
|
||||||
}
|
}
|
||||||
|
|
||||||
BIF_undo_push("Border select UV");
|
|
||||||
scrarea_queue_winredraw(curarea);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1550,29 +1571,148 @@ void unlink_selection(void)
|
|||||||
scrarea_queue_winredraw(curarea);
|
scrarea_queue_winredraw(curarea);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* this function sets the selection on tagged faces
|
||||||
void toggle_uv_select(int mode)
|
* This is needed because setting the selection on a face is done in
|
||||||
|
* a number of places but it also needs to respect the sticky modes
|
||||||
|
* for the UV verts - dealing with the sticky modes is best done in a seperate function
|
||||||
|
*
|
||||||
|
* de-selects faces that have been tagged on efa->tmp.l
|
||||||
|
*/
|
||||||
|
void uvface_setsel__internal(short select)
|
||||||
{
|
{
|
||||||
switch(mode){
|
|
||||||
case 'f':
|
/* All functions calling this should call
|
||||||
G.sima->flag ^= SI_SELACTFACE;
|
* draw_uvs_face_check()
|
||||||
break;
|
*/
|
||||||
case 's':
|
|
||||||
G.sima->flag &= ~SI_LOCALSTICKY;
|
|
||||||
G.sima->flag |= SI_STICKYUVS;
|
/* selecting UV Faces with some modes requires us to change
|
||||||
break;
|
* the selection in other faces (depending on the stickt mode)
|
||||||
case 'l':
|
*
|
||||||
G.sima->flag &= ~SI_STICKYUVS;
|
* This only needs to be done when the Mesh is not used for selection
|
||||||
G.sima->flag &= ~SI_LOCALSTICKY;
|
* (So for sticky modes - vertex or location based)
|
||||||
break;
|
* */
|
||||||
case 'o':
|
|
||||||
G.sima->flag &= ~SI_STICKYUVS;
|
EditMesh *em = G.editMesh;
|
||||||
G.sima->flag |= SI_LOCALSTICKY;
|
EditFace *efa;
|
||||||
break;
|
MTFace *tf;
|
||||||
|
int nverts, i;
|
||||||
|
|
||||||
|
if ((G.sima->flag & SI_SYNC_UVSEL)==0 && G.sima->sticky == SI_STICKY_VERTEX) {
|
||||||
|
/* tag all verts as untouched,
|
||||||
|
* then touch the ones that have a face center in the loop
|
||||||
|
* and select all MTFace UV's that use a touched vert */
|
||||||
|
|
||||||
|
EditVert *eve;
|
||||||
|
|
||||||
|
for (eve= em->verts.first; eve; eve= eve->next)
|
||||||
|
eve->tmp.l = 0;
|
||||||
|
|
||||||
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||||
|
if (efa->tmp.l) {
|
||||||
|
if (efa->v4) {
|
||||||
|
efa->v1->tmp.l= efa->v2->tmp.l= efa->v3->tmp.l= efa->v4->tmp.l=1;
|
||||||
|
} else {
|
||||||
|
efa->v1->tmp.l= efa->v2->tmp.l= efa->v3->tmp.l= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* now select tagged verts */
|
||||||
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||||
|
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
|
nverts= efa->v4? 4: 3;
|
||||||
|
for(i=0; i<nverts; i++) {
|
||||||
|
if ((*(&efa->v1 + i))->tmp.l) {
|
||||||
|
if (select) {
|
||||||
|
SIMA_UVSEL_SET(efa, tf, i);
|
||||||
|
} else {
|
||||||
|
SIMA_UVSEL_UNSET(efa, tf, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ((G.sima->flag & SI_SYNC_UVSEL)==0 && G.sima->sticky == SI_STICKY_LOC) {
|
||||||
|
EditFace *efa_vlist;
|
||||||
|
MTFace *tf_vlist;
|
||||||
|
UvMapVert *vlist, *start_vlist, *vlist_iter;
|
||||||
|
struct UvVertMap *vmap;
|
||||||
|
float limit[2];
|
||||||
|
int efa_index;
|
||||||
|
//EditVert *eve; /* removed vert counting for now */
|
||||||
|
//int a;
|
||||||
|
|
||||||
|
get_connected_limit_tface_uv(limit);
|
||||||
|
|
||||||
|
EM_init_index_arrays(0, 0, 1);
|
||||||
|
vmap= make_uv_vert_map_EM(0, 0, limit);
|
||||||
|
|
||||||
|
/* verts are numbered above in make_uv_vert_map_EM, make sure this stays true! */
|
||||||
|
/*for (a=0, eve= em->verts.first; eve; a++, eve= eve->next)
|
||||||
|
eve->tmp.l = a; */
|
||||||
|
|
||||||
|
if(vmap == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (efa_index=0, efa= em->faces.first; efa; efa_index++, efa= efa->next) {
|
||||||
|
if (efa->tmp.l) {
|
||||||
|
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
|
nverts= efa->v4? 4: 3;
|
||||||
|
for(i=0; i<nverts; i++) {
|
||||||
|
if (select) {
|
||||||
|
SIMA_UVSEL_SET(efa, tf, i);
|
||||||
|
} else {
|
||||||
|
SIMA_UVSEL_UNSET(efa, tf, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
vlist= vlist_iter= get_uv_map_vert_EM(vmap, (*(&efa->v1 + i))->tmp.l);
|
||||||
|
|
||||||
|
while (vlist_iter) {
|
||||||
|
if (vlist_iter->separate)
|
||||||
|
start_vlist = vlist_iter;
|
||||||
|
|
||||||
|
if (efa_index == vlist_iter->f) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
vlist_iter = vlist_iter->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
vlist_iter = start_vlist;
|
||||||
|
while (vlist_iter) {
|
||||||
|
|
||||||
|
if (vlist_iter != start_vlist && vlist_iter->separate)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (efa_index != vlist_iter->f) {
|
||||||
|
efa_vlist = EM_get_face_for_index(vlist_iter->f);
|
||||||
|
tf_vlist = CustomData_em_get(&em->fdata, efa_vlist->data, CD_MTFACE);
|
||||||
|
|
||||||
|
if (select) {
|
||||||
|
SIMA_UVSEL_SET(efa_vlist, tf_vlist, vlist_iter->tfindex);
|
||||||
|
} else {
|
||||||
|
SIMA_UVSEL_UNSET(efa_vlist, tf_vlist, vlist_iter->tfindex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vlist_iter = vlist_iter->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EM_free_index_arrays();
|
||||||
|
free_uv_vert_map_EM(vmap);
|
||||||
|
|
||||||
|
} else { /* SI_STICKY_DISABLE or G.sima->flag & SI_SYNC_UVSEL */
|
||||||
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||||
|
if (efa->tmp.l) {
|
||||||
|
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
|
if (select) {
|
||||||
|
SIMA_FACESEL_SET(efa, tf);
|
||||||
|
} else {
|
||||||
|
SIMA_FACESEL_UNSET(efa, tf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
allqueue(REDRAWIMAGE, 0);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
void pin_tface_uv(int mode)
|
void pin_tface_uv(int mode)
|
||||||
{
|
{
|
||||||
|
@ -475,141 +475,30 @@ static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select
|
|||||||
EditMesh *em = G.editMesh;
|
EditMesh *em = G.editMesh;
|
||||||
EditFace *efa;
|
EditFace *efa;
|
||||||
MTFace *tf;
|
MTFace *tf;
|
||||||
int screenUV[2], nverts, i;
|
int screenUV[2], nverts, i, ok = 1;
|
||||||
rcti rect;
|
rcti rect;
|
||||||
|
|
||||||
lasso_select_boundbox(&rect, mcords, moves);
|
lasso_select_boundbox(&rect, mcords, moves);
|
||||||
|
|
||||||
if (draw_uvs_face_check()) { /* Face Center Sel */
|
if (draw_uvs_face_check()) { /* Face Center Sel */
|
||||||
float cent[2];
|
float cent[2];
|
||||||
|
ok = 0;
|
||||||
/* selecting UV Faces with some modes requires us to change
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||||
* the selection in other faces (depending on the stickt mode)
|
/* assume not touched */
|
||||||
*
|
efa->tmp.l = 0;
|
||||||
* This only needs to be done when the Mesh is not used for selection
|
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
* (So for sticky modes - vertex or location based)
|
if ((select) != (SIMA_FACESEL_CHECK(efa, tf))) {
|
||||||
* This shoud be a generic function - so Ill make one but it will
|
tface_center(tf, cent, (void *)efa->v4);
|
||||||
* Only be used by this at the moment.
|
uvco_to_areaco_noclip(cent, screenUV);
|
||||||
* */
|
if (BLI_in_rcti(&rect, screenUV[0], screenUV[1]) && lasso_inside(mcords, moves, screenUV[0], screenUV[1])) {
|
||||||
|
efa->tmp.l = ok = 1;
|
||||||
if ((G.sima->flag & SI_SYNC_UVSEL)==0 && G.sima->sticky == SI_STICKY_VERTEX) {
|
|
||||||
/* tag all verts as untouched,
|
|
||||||
* then touch the ones that have a face center in the loop
|
|
||||||
* and select all MTFace UV's that use a touched vert */
|
|
||||||
|
|
||||||
EditVert *eve;
|
|
||||||
|
|
||||||
for (eve= em->verts.first; eve; eve= eve->next)
|
|
||||||
eve->tmp.l = 0;
|
|
||||||
|
|
||||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
|
||||||
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
|
||||||
if (SIMA_FACEDRAW_CHECK(efa, tf)) {
|
|
||||||
if ((select) != (SIMA_FACESEL_CHECK(efa, tf))) {
|
|
||||||
tface_center(tf, cent, (void *)efa->v4);
|
|
||||||
uvco_to_areaco_noclip(cent, screenUV);
|
|
||||||
if (BLI_in_rcti(&rect, screenUV[0], screenUV[1]) && lasso_inside(mcords, moves, screenUV[0], screenUV[1])) {
|
|
||||||
if (efa->v4) {
|
|
||||||
efa->v1->tmp.l= efa->v2->tmp.l= efa->v3->tmp.l= efa->v4->tmp.l=1;
|
|
||||||
} else {
|
|
||||||
efa->v1->tmp.l= efa->v2->tmp.l= efa->v3->tmp.l= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* now select tagged verts */
|
|
||||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
|
||||||
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
|
||||||
nverts= efa->v4? 4: 3;
|
|
||||||
for(i=0; i<nverts; i++) {
|
|
||||||
if ((*(&efa->v1 + i))->tmp.l) {
|
|
||||||
if (select) {
|
|
||||||
SIMA_UVSEL_SET(efa, tf, i);
|
|
||||||
} else {
|
|
||||||
SIMA_UVSEL_UNSET(efa, tf, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ((G.sima->flag & SI_SYNC_UVSEL)==0 && G.sima->sticky == SI_STICKY_LOC) {
|
|
||||||
EditFace *efa_vlist;
|
|
||||||
MTFace *tf_vlist;
|
|
||||||
UvMapVert *vlist;
|
|
||||||
struct UvVertMap *vmap;
|
|
||||||
float limit[2];
|
|
||||||
//EditVert *eve; /* removed vert counting for now */
|
|
||||||
//int a;
|
|
||||||
|
|
||||||
get_connected_limit_tface_uv(limit);
|
|
||||||
|
|
||||||
EM_init_index_arrays(0, 0, 1);
|
|
||||||
vmap= make_uv_vert_map_EM(0, 0, limit);
|
|
||||||
|
|
||||||
/* verts are numbered above in make_uv_vert_map_EM, make sure this stays true! */
|
|
||||||
/*for (a=0, eve= em->verts.first; eve; a++, eve= eve->next)
|
|
||||||
eve->tmp.l = a; */
|
|
||||||
|
|
||||||
if(vmap == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
|
||||||
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
|
||||||
|
|
||||||
if ((select) != (SIMA_FACESEL_CHECK(efa, tf))) {
|
|
||||||
tface_center(tf, cent, (void *)efa->v4);
|
|
||||||
uvco_to_areaco_noclip(cent, screenUV);
|
|
||||||
|
|
||||||
if (BLI_in_rcti(&rect, screenUV[0], screenUV[1]) && lasso_inside(mcords, moves, screenUV[0], screenUV[1])) {
|
|
||||||
nverts= efa->v4? 4: 3;
|
|
||||||
for(i=0; i<nverts; i++) {
|
|
||||||
if (select) {
|
|
||||||
SIMA_UVSEL_SET(efa, tf, i);
|
|
||||||
} else {
|
|
||||||
SIMA_UVSEL_UNSET(efa, tf, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
vlist= get_uv_map_vert_EM(vmap, (*(&efa->v1 + i))->tmp.l);
|
|
||||||
while (vlist) {
|
|
||||||
if (!vlist->separate) {
|
|
||||||
efa_vlist = EM_get_face_for_index(vlist->f);
|
|
||||||
if (efa != efa_vlist) {
|
|
||||||
tf_vlist = CustomData_em_get(&em->fdata, efa_vlist->data, CD_MTFACE);
|
|
||||||
|
|
||||||
if (select) {
|
|
||||||
SIMA_UVSEL_SET(efa_vlist, tf_vlist, vlist->tfindex);
|
|
||||||
} else {
|
|
||||||
SIMA_UVSEL_UNSET(efa_vlist, tf_vlist, vlist->tfindex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
vlist = vlist->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EM_free_index_arrays();
|
|
||||||
free_uv_vert_map_EM(vmap);
|
|
||||||
|
|
||||||
} else { /* SI_STICKY_DISABLE or G.sima->flag & SI_SYNC_UVSEL */
|
|
||||||
|
|
||||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
|
||||||
if ((tf=(MTFace *)efa->tmp.p)) {
|
|
||||||
if ((select) != (SIMA_FACESEL_CHECK(efa, tf))) {
|
|
||||||
tface_center(tf, cent, (void *)efa->v4);
|
|
||||||
uvco_to_areaco_noclip(cent, screenUV);
|
|
||||||
if (BLI_in_rcti(&rect, screenUV[0], screenUV[1]) && lasso_inside(mcords, moves, screenUV[0], screenUV[1])) {
|
|
||||||
if (select) {
|
|
||||||
SIMA_FACESEL_SET(efa, tf);
|
|
||||||
} else {
|
|
||||||
SIMA_FACESEL_UNSET(efa, tf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* (de)selects all tagged faces and deals with sticky modes */
|
||||||
|
if (ok)
|
||||||
|
uvface_setsel__internal(select);
|
||||||
|
|
||||||
} else { /* Vert Sel*/
|
} else { /* Vert Sel*/
|
||||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||||
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
@ -630,7 +519,7 @@ static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (G.sima->flag & SI_SYNC_UVSEL) {
|
if (ok && G.sima->flag & SI_SYNC_UVSEL) {
|
||||||
if (select) EM_select_flush();
|
if (select) EM_select_flush();
|
||||||
else EM_deselect_flush();
|
else EM_deselect_flush();
|
||||||
}
|
}
|
||||||
|
@ -2338,6 +2338,9 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
|||||||
if((G.qual & LR_CTRLKEY) && G.obedit->type==OB_MESH) {
|
if((G.qual & LR_CTRLKEY) && G.obedit->type==OB_MESH) {
|
||||||
convert_to_triface(G.qual & LR_SHIFTKEY);
|
convert_to_triface(G.qual & LR_SHIFTKEY);
|
||||||
allqueue(REDRAWVIEW3D, 0);
|
allqueue(REDRAWVIEW3D, 0);
|
||||||
|
if (EM_texFaceCheck())
|
||||||
|
allqueue(REDRAWIMAGE, 0);
|
||||||
|
|
||||||
countall();
|
countall();
|
||||||
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
|
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user