Revision: 15463
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15463
Author:   broken
Date:     2008-07-07 04:02:10 +0200 (Mon, 07 Jul 2008)

Log Message:
-----------
* 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

Modified Paths:
--------------
    trunk/blender/source/blender/makesdna/DNA_space_types.h
    trunk/blender/source/blender/src/drawimage.c
    trunk/blender/source/blender/src/editsima.c
    trunk/blender/source/blender/src/header_image.c

Modified: trunk/blender/source/blender/makesdna/DNA_space_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_space_types.h     2008-07-07 
01:56:47 UTC (rev 15462)
+++ trunk/blender/source/blender/makesdna/DNA_space_types.h     2008-07-07 
02:02:10 UTC (rev 15463)
@@ -232,8 +232,9 @@
        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 @@
 #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 @@
 #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

Modified: trunk/blender/source/blender/src/drawimage.c
===================================================================
--- trunk/blender/source/blender/src/drawimage.c        2008-07-07 01:56:47 UTC 
(rev 15462)
+++ trunk/blender/source/blender/src/drawimage.c        2008-07-07 02:02:10 UTC 
(rev 15463)
@@ -422,7 +422,7 @@
                        return 1;
                } 
        } else {
-               if (G.sima->flag & SI_SELACTFACE) {
+               if (G.sima->selectmode == SI_SELECT_FACE) {
                        return 1;
                }
        }

Modified: trunk/blender/source/blender/src/editsima.c
===================================================================
--- trunk/blender/source/blender/src/editsima.c 2008-07-07 01:56:47 UTC (rev 
15462)
+++ trunk/blender/source/blender/src/editsima.c 2008-07-07 02:02:10 UTC (rev 
15463)
@@ -694,7 +694,7 @@
        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 @@
        
        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 @@
                }
        } 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:
@@ -761,6 +762,9 @@
                if (nearestefa->v4)     hitv[3]= nearestefa->v4->tmp.l;
                else                            hitv[3]= 0xFFFFFFFF;
        }
+       else if (island) {
+
+       }
        else {
                find_nearest_uv(&nearesttf, &nearestefa, &nearestv, &nearestuv);
                if(nearesttf==NULL)
@@ -774,7 +778,11 @@
                }
        }
 
-       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)) {

Modified: trunk/blender/source/blender/src/header_image.c
===================================================================
--- trunk/blender/source/blender/src/header_image.c     2008-07-07 01:56:47 UTC 
(rev 15462)
+++ trunk/blender/source/blender/src/header_image.c     2008-07-07 02:02:10 UTC 
(rev 15463)
@@ -1214,28 +1214,31 @@
                        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;
+                       
+                       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)");
                        
                }


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to