Patch #6717:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 10 Jun 2007 14:06:34 +0000 (14:06 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 10 Jun 2007 14:06:34 +0000 (14:06 +0000)
Select Inverse function in the UV editor, by Juho Vepsalainen.

source/blender/include/BIF_editsima.h
source/blender/src/editsima.c
source/blender/src/header_image.c

index 6a67ebc700974ce9f92e1a98cb7b0037e3c62bcf..ec274290c91b05d10519822511204be7108fcdec 100644 (file)
@@ -52,6 +52,7 @@ void transform_aspect_ratio_tface_uv(float *aspx, float *aspy);
 void borderselect_sima(short whichuvs);
 void mouseco_to_curtile(void);
 void mouse_select_sima(void);
+void select_invert_tface_uv(void);
 void select_swap_tface_uv(void);
 void mirrormenu_tface_uv(void);
 void mirror_tface_uv(char mirroraxis);
index 40cbe36ac8c5157b1fdc16c41a8dcafd00eaec46..3f257bb848ff9e250ca25de22730b6612c39aa1e 100644 (file)
@@ -430,6 +430,31 @@ void weld_align_menu_tface_uv(void)
        else if(mode==2 || mode==3) BIF_undo_push("Align UV");
 }
 
+void select_invert_tface_uv(void)
+{
+       Mesh *me;
+       MTFace *tface;
+       MFace *mface;
+       int a;
+       
+       if( is_uv_tface_editing_allowed()==0 ) return;
+       me= get_mesh(OBACT);
+       mface= me->mface;
+
+       for(a=me->totface, tface= me->mtface; a>0; a--, tface++, mface++) {
+               if(mface->flag & ME_FACE_SEL) { 
+                       tface->flag ^= TF_SEL1;
+                       tface->flag ^= TF_SEL2;
+                       tface->flag ^= TF_SEL3;
+                       if(mface->v4) tface->flag ^= TF_SEL4;
+               }
+       }
+
+       BIF_undo_push("Select Inverse UV");
+
+       allqueue(REDRAWIMAGE, 0);
+}
+
 void select_swap_tface_uv(void)
 {
        Mesh *me;
@@ -1033,10 +1058,14 @@ void reveal_tface_uv(void)
        me= get_mesh(OBACT);
 
        mface= me->mface;
-       for(a=me->totface, tface= me->mtface; a>0; a--, tface++, mface++)
-               if(!(mface->flag & ME_HIDE))
-                       if(!(mface->flag & ME_FACE_SEL))
+       for(a=me->totface, tface= me->mtface; a>0; a--, tface++, mface++) {
+               if(!(mface->flag & ME_HIDE)) {
+                       if(!(mface->flag & ME_FACE_SEL)) {
+                               mface->flag |= ME_FACE_SEL;
                                tface->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
+                       }
+               }
+       }
        
        BIF_undo_push("Reveal UV");
 
index ea0850d77d0f927c7fccafaac2ee4c2ca348dbb8..d6878d70165584e6a7342752b8a88d8dafd78730 100644 (file)
@@ -524,6 +524,9 @@ static void do_image_selectmenu(void *arg, int event)
        case 1: /* Select/Deselect All */
                select_swap_tface_uv();
                break;
+       case 9: /* Select Inverse */
+               select_invert_tface_uv();
+               break;
        case 2: /* Unlink Selection */
                unlink_selection();
                break;
@@ -591,6 +594,8 @@ static uiBlock *image_selectmenu(void *arg_unused)
 
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
 
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Inverse", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
+
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Unlink Selection|Alt L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
        
        uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");