* New UV editor selection mode: Island

This goes alongside vertex and face selection and selects an entire UV island with a single click. It's a lot less painful to use when rearranging UV layouts, especially with Drag Immediately on - see: http://mke3.net/blender/etc/uv_island.mov
This commit is contained in:
Matt Ebb
2008-07-07 02:02:10 +00:00
parent 32cefbdecf
commit 0456a71edd
4 changed files with 35 additions and 17 deletions

View File

@@ -232,8 +232,9 @@ typedef struct SpaceImage {
short imanr;
short curtile; /* the currently active tile of the image when tile is enabled, is kept in sync with the active faces tile */
int flag;
short selectmode;
short imtypenr, lock;
short pin, pad2;
short pin;
float zoom;
char dt_uv; /* UV draw type */
char sticky; /* sticky selection type */
@@ -496,6 +497,12 @@ typedef struct SpaceImaSel {
#define SI_STICKY_DISABLE 1
#define SI_STICKY_VERTEX 2
/* SpaceImage->selectmode */
#define SI_SELECT_VERTEX 0
#define SI_SELECT_EDGE 1 /* not implemented */
#define SI_SELECT_FACE 2
#define SI_SELECT_ISLAND 3
/* SpaceImage->flag */
#define SI_BE_SQUARE 1<<0
#define SI_EDITTILE 1<<1
@@ -503,7 +510,7 @@ typedef struct SpaceImaSel {
#define SI_DRAWTOOL 1<<3
#define SI_DEPRECATED1 1<<4 /* stick UVs to others in the same location */
#define SI_DRAWSHADOW 1<<5
#define SI_SELACTFACE 1<<6
#define SI_SELACTFACE 1<<6 /* deprecated */
#define SI_DEPRECATED2 1<<7
#define SI_DEPRECATED3 1<<8 /* stick UV selection to mesh vertex (UVs wont always be touching) */
#define SI_COORDFLOATS 1<<9

View File

@@ -422,7 +422,7 @@ int draw_uvs_face_check(void)
return 1;
}
} else {
if (G.sima->flag & SI_SELACTFACE) {
if (G.sima->selectmode == SI_SELECT_FACE) {
return 1;
}
}

View File

@@ -694,7 +694,7 @@ void mouse_select_sima(void)
EditFace *efa;
MTFace *tf, *nearesttf;
EditFace *nearestefa=NULL;
int a, selectsticky, edgeloop, actface, nearestuv, nearestedge, i, shift;
int a, selectsticky, edgeloop, actface, nearestuv, nearestedge, i, shift, island;
char sticky= 0;
int flush = 0; /* 0 == dont flush, 1 == sel, -1 == desel; only use when selection sync is enabled */
unsigned int hitv[4], nearestv;
@@ -706,7 +706,7 @@ void mouse_select_sima(void)
edgeloop= G.qual & LR_ALTKEY;
shift= G.qual & LR_SHIFTKEY;
if (G.sima->flag & SI_SYNC_UVSEL) {
/* copy from mesh */
if (G.scene->selectmode == SCE_SELECT_FACE) {
@@ -718,7 +718,8 @@ void mouse_select_sima(void)
}
} else {
/* normal operation */
actface= G.sima->flag & SI_SELACTFACE;
actface= G.sima->selectmode == SI_SELECT_FACE;
island= G.sima->selectmode == SI_SELECT_ISLAND;
switch(G.sima->sticky) {
case SI_STICKY_LOC:
@@ -760,6 +761,9 @@ void mouse_select_sima(void)
if (nearestefa->v4) hitv[3]= nearestefa->v4->tmp.l;
else hitv[3]= 0xFFFFFFFF;
}
else if (island) {
}
else {
find_nearest_uv(&nearesttf, &nearestefa, &nearestv, &nearestuv);
@@ -774,7 +778,11 @@ void mouse_select_sima(void)
}
}
if(!edgeloop && shift) {
if (island) {
if(shift) select_linked_tface_uv(1);
else select_linked_tface_uv(0);
}
else if(!edgeloop && shift) {
/* (de)select face */
if(actface) {
if(simaFaceSel_Check(nearestefa, nearesttf)) {

View File

@@ -1214,28 +1214,31 @@ void image_buttons(void)
uiBlockBeginAlign(block);
/* B_SEL_VERT & B_SEL_FACE are not defined here which is a bit bad, BUT it works even if image editor is fullscreen */
uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode (Ctrl Tab 1)");
xco+= XIC;
uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL,
xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode (Ctrl Tab 1)");
/* no edge */
/*uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Edge select mode (Ctrl Tab 2)");
xco+= XIC; */
uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Face select mode (Ctrl Tab 3)");
xco+= XIC+8;
uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL,
xco+=XIC,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Face select mode (Ctrl Tab 3)");
uiBlockEndAlign(block);
} else {
uiBlockBeginAlign(block);
uiDefIconButBitI(block, TOGN, SI_SELACTFACE, B_REDR, ICON_VERTEXSEL, xco,0,XIC,YIC, &G.sima->flag, 1.0, 0.0, 0, 0, "UV Vertex select mode");
xco+= XIC;
uiDefIconButBitI(block, TOG, SI_SELACTFACE, B_REDR, ICON_FACESEL, xco,0,XIC,YIC, &G.sima->flag, 0, 0, 0, 0, "UV Face select mode");
xco+= XIC+8;
uiBlockEndAlign(block);
uiDefIconButS(block, ROW, B_REDR, ICON_VERTEXSEL,
xco,0,XIC,YIC, &G.sima->selectmode, 0.0, SI_SELECT_VERTEX, 0, 0, "UV vertex select mode");
uiDefIconButS(block, ROW, B_REDR, ICON_FACESEL,
xco+=XIC,0,XIC,YIC, &G.sima->selectmode, 0.0, SI_SELECT_FACE, 0, 0, "UV Face select mode");
uiDefIconButS(block, ROW, B_REDR, ICON_MESH,
xco+=XIC,0,XIC,YIC, &G.sima->selectmode, 0.0, SI_SELECT_ISLAND, 0, 0, "UV Island select mode");
uiBlockEndAlign(block);
/* would use these if const's could go in strings
* SI_STICKY_LOC SI_STICKY_DISABLE SI_STICKY_VERTEX */
ubut = uiDefIconTextButC(block, ICONTEXTROW, B_REDR, ICON_STICKY_UVS_LOC,
"Sticky UV Selection: %t|Disable%x1|Shared Location%x0|Shared Vertex%x2",
xco,0,XIC+10,YIC, &(G.sima->sticky), 0, 3.0, 0, 0,
xco+=XIC+10,0,XIC+10,YIC, &(G.sima->sticky), 0, 3.0, 0, 0,
"Sticky UV Selection (Hotkeys: Shift C, Alt C, Ctrl C)");
}