re-arranged buttons from matts suggestions. removed some unused vars and added some...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 26 Sep 2007 06:46:08 +0000 (06:46 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 26 Sep 2007 06:46:08 +0000 (06:46 +0000)
source/blender/makesdna/DNA_space_types.h
source/blender/src/drawimage.c
source/blender/src/header_image.c
source/blender/src/transform_snap.c

index b93c4b7c5044ac80e585a95b9bfa39de1a115e76..4c6cecba070d3e6f0f6c54b36e3d813a94499095 100644 (file)
@@ -466,6 +466,11 @@ typedef struct SpaceImaSel {
 #define SI_TEXTURE             0
 #define SI_SHOW                        1
 
+#define SI_UVDT_DASH   0
+#define SI_UVDT_BLACK  1
+#define SI_UVDT_WHITE  2
+#define SI_UVDT_OUTLINE        3
+
 /* SpaceImage->flag */
 #define SI_BE_SQUARE   1<<0
 #define SI_EDITTILE            1<<1
index b95452b0342b3940670fe197cdfef323c8819671..86b6e8bcaaa701700b40ce9864ec9fcfd2392964 100644 (file)
@@ -583,8 +583,16 @@ void draw_uvs_sima(void)
                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        }
 
+
+#define SI_UVDT_DASH   0
+#define SI_UVDT_BLACK  1
+#define SI_UVDT_WHITE  2
+#define SI_UVDT_OUTLINE        3
+
+       
+       
        switch (G.sima->dt_uv) {
-       case 0:
+       case SI_UVDT_DASH:
                for (efa= em->faces.first; efa; efa= efa->next) {
 //                     tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
 //                     if (SIMA_FACEDRAW_CHECK(efa, tface)) {
@@ -622,8 +630,8 @@ void draw_uvs_sima(void)
                        }
                }
                break;
-       case 1: /* black/white */
-       case 2
+       case SI_UVDT_BLACK: /* black/white */
+       case SI_UVDT_WHITE
                cpack((G.sima->dt_uv==1) ? 0x0 : 0xFFFFFF);
                for (efa= em->faces.first; efa; efa= efa->next) {
 //                     tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
@@ -641,7 +649,7 @@ void draw_uvs_sima(void)
                        }
                }
                break;
-       case 3:
+       case SI_UVDT_OUTLINE:
                glLineWidth(3);
                cpack(0x0);
                
@@ -684,42 +692,6 @@ void draw_uvs_sima(void)
        if (G.sima->flag & SI_SMOOTH_UV) {
                glDisable( GL_LINE_SMOOTH);
                glDisable(GL_BLEND);
-       }
-       
-       
-       /* draw active face edges */
-       
-       if (activetface) {
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
        }
 
     /* unselected uv's */
@@ -1200,10 +1172,10 @@ static void image_panel_view_properties(short cntrl)    // IMAGE_HANDLER_VIEW_PROPE
        if (EM_texFaceCheck()) {
                uiDefBut(block, LABEL, B_NOP, "Draw Type:",             10, 20,120,19, 0, 0, 0, 0, 0, "");
                uiBlockBeginAlign(block);
-               uiDefButC(block,  ROW, B_REDR, "Dash",                  10, 0,58,19, &G.sima->dt_uv, 0.0, 0.0, 0, 0, "Dashed Wire UV drawtype");
-               uiDefButC(block,  ROW, B_REDR, "Black",                 68, 0,58,19, &G.sima->dt_uv, 0.0, 1.0, 0, 0, "Black Wire UV drawtype");
-               uiDefButC(block,  ROW, B_REDR, "White",                 126,0,58,19, &G.sima->dt_uv, 0.0, 2.0, 0, 0, "White Wire UV drawtype");
-               uiDefButC(block,  ROW, B_REDR, "Outline",               184,0,58,19, &G.sima->dt_uv, 0.0, 3.0, 0, 0, "Outline Wire UV drawtype");
+               uiDefButC(block,  ROW, B_REDR, "Dash",                  10, 0,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_DASH, 0, 0, "Dashed Wire UV drawtype");
+               uiDefButC(block,  ROW, B_REDR, "Black",                 68, 0,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_WHITE, 0, 0, "Black Wire UV drawtype");
+               uiDefButC(block,  ROW, B_REDR, "White",                 126,0,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_BLACK, 0, 0, "White Wire UV drawtype");
+               uiDefButC(block,  ROW, B_REDR, "Outline",               184,0,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_OUTLINE, 0, 0, "Outline Wire UV drawtype");
                uiBlockBeginAlign(block);
                uiDefButBitI(block, TOG, SI_SMOOTH_UV, B_REDR, "Smooth",        250,0,60,19,  &G.sima->flag, 0, 0, 0, 0, "Display smooth lines in the UV view");
        }
index a44a9ecb2cfca1d25180b00ef38c6034de74bccd..c9cde5436e8c9128cffa8c6c957753d59786a3bd 100644 (file)
@@ -1159,13 +1159,25 @@ void image_buttons(void)
        if (is_render)
                allow_pin = 0;
        
-       xco= std_libbuttons(block, xco, 0, allow_pin, &G.sima->pin, B_SIMABROWSE, ID_IM, 0, (ID *)ima, 0, &(G.sima->imanr), 0, 0, B_IMAGEDELETE, 0, 0);
+       xco= 8 + std_libbuttons(block, xco, 0, allow_pin, &G.sima->pin, B_SIMABROWSE, ID_IM, 0, (ID *)ima, 0, &(G.sima->imanr), 0, 0, B_IMAGEDELETE, 0, 0);
+       
+       if( ima && !ELEM3(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE, IMA_SRC_VIEWER) && ima->ok) {
 
+               if (ima->packedfile) {
+                       headerbuttons_packdummy = 1;
+               }
+               if (ima->packedfile && ibuf && (ibuf->userflags & IB_BITMAPDIRTY))
+                       uiDefIconButBitI(block, TOG, 1, B_SIMA_REPACK, ICON_UGLYPACKAGE,        xco,0,XIC,YIC, &headerbuttons_packdummy, 0, 0, 0, 0, "Re-Pack this image as PNG");
+               else
+                       uiDefIconButBitI(block, TOG, 1, B_SIMAPACKIMA, ICON_PACKAGE,    xco,0,XIC,YIC, &headerbuttons_packdummy, 0, 0, 0, 0, "Pack/Unpack this image");
+                       
+               xco+= XIC+8;
+       }
+       
        /* UV EditMode buttons, not painting or rencering or compositing */
        if ( EM_texFaceCheck() && (G.sima->flag & SI_DRAWTOOL)==0 && !is_render) {
                uiBut *ubut;
                int layercount;
-               xco+=10;
                
                uiDefIconTextButS(block, ICONTEXTROW, B_NOP, ICON_ROTATE,
                                "Pivot: %t|Bounding Box Center %x0|Median Point %x3|2D Cursor %x1",
@@ -1174,7 +1186,7 @@ void image_buttons(void)
                xco+= XIC + 18;
                
                uiBlockBeginAlign(block);
-               uiDefIconButBitI(block, TOG, SI_SYNC_UVSEL, B_REDR, ICON_MESH_HLT, xco,0,XIC,YIC, &G.sima->flag, 0, 0, 0, 0, "Sync Mesh Selection (vert & face selection mode override sticky)");
+               uiDefIconButBitI(block, TOGN, SI_SYNC_UVSEL, B_REDR, ICON_NO_GO_LEFT, xco,0,XIC,YIC, &G.sima->flag, 0, 0, 0, 0, "Mesh independant selection");
                xco+= XIC;
                if ((G.sima->flag & SI_SYNC_UVSEL)==0) {
                        ubut = uiDefIconTextButC(block, ICONTEXTROW, B_REDR, ICON_STICKY_UVS_LOC,
@@ -1217,11 +1229,11 @@ void image_buttons(void)
                        str_pt = str_menu;
                        str_pt[0]='\0';
                        mesh_layers_menu_concat(&G.editMesh->fdata, CD_MTFACE, str_pt);
-                       ubut = uiDefButI(block, MENU, B_NOP, str_menu ,xco,0,115,YIC, &act, 0, 0, 0, 0, "Active UV Layer for editing");
+                       ubut = uiDefButI(block, MENU, B_NOP, str_menu ,xco,0,85,YIC, &act, 0, 0, 0, 0, "Active UV Layer for editing");
                        uiButSetFunc(ubut, do_image_buttons_set_uvlayer_callback, &act, NULL);
                        
                        /*MEM_freeN(str);*/
-                       xco+= 120;
+                       xco+= 90;
                }
        }
        
@@ -1236,19 +1248,6 @@ void image_buttons(void)
                        uiBlockEndAlign(block);
                        xco+= 166;
                }
-               if( !ELEM3(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE, IMA_SRC_VIEWER) && ima->ok) {
-
-                       if (ima->packedfile) {
-                               headerbuttons_packdummy = 1;
-                       }
-                       if (ima->packedfile && ibuf && (ibuf->userflags & IB_BITMAPDIRTY))
-                               uiDefIconButBitI(block, TOG, 1, B_SIMA_REPACK, ICON_UGLYPACKAGE,        xco,0,XIC,YIC, &headerbuttons_packdummy, 0, 0, 0, 0, "Re-Pack this image as PNG");
-                       else
-                               uiDefIconButBitI(block, TOG, 1, B_SIMAPACKIMA, ICON_PACKAGE,    xco,0,XIC,YIC, &headerbuttons_packdummy, 0, 0, 0, 0, "Pack/Unpack this image");
-                               
-                       xco+= XIC+8;
-               }
-               
                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;
index 3b632e8c4676bca1b23c44df8d529b2ff625d0de..d62d49c2de87684a4121fb5ee75b7d6507151d57 100644 (file)
@@ -400,17 +400,10 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
                        }
                }
                else if (t->spacetype == SPACE_IMAGE)
-               {
-                       
+               {       /* same as above but for UV's */
                        MTFace *nearesttf=NULL;
-                       unsigned int face_corner;
+                       int face_corner;
                        
-                       float vec[3];
-                       int found = 0;
-                       int dist = 40; // Use a user defined value here
-                       
-                       // use findnearestverts in vert mode, others in other modes
-                       //nearest = findnearestvert(&dist, SELECT, 1);
                        find_nearest_uv(&nearesttf, NULL, NULL, &face_corner);
                        
                        if (nearesttf != NULL)
@@ -424,8 +417,6 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
                        {
                                t->tsnap.status &= ~POINT_INIT;
                        }
-                       
-                       
                }