added pin for images, this is useful because you might want to edit a model's verts...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 18 Sep 2007 13:10:17 +0000 (13:10 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 18 Sep 2007 13:10:17 +0000 (13:10 +0000)
source/blender/include/blendef.h
source/blender/makesdna/DNA_space_types.h
source/blender/src/drawimage.c
source/blender/src/header_image.c

index ac29f3866787e695b85b9ca9f5be68c958e485dd..9ea736dc0feb891062464cb2c4eff25ca480b5c9 100644 (file)
 #define B_UITHEMEIMPORT                323
 #define B_UITHEMEEXPORT                324
 
-#define B_MEMCACHELIMIT         325
+#define B_MEMCACHELIMIT                325
 
 /* Definitions for the fileselect buttons in user prefs */
 #define B_FONTDIRFILESEL       330
 #define B_SIMABROWSE           352
 #define B_SIMAGELOAD           353
 #define B_SIMAGEDRAW           354
-#define B_BE_SQUARE            355
+#define B_BE_SQUARE                    355
 #define B_SIMAGEDRAW1          356
-#define B_TWINANIM             357
+#define B_TWINANIM                     357
 #define B_SIMAGEREPLACE                358
-#define B_CLIP_UV              359
+#define B_CLIP_UV                      359
 #define B_SIMAGELOAD1          360
 #define B_SIMAGEREPLACE1       361
 #define B_SIMAGEPAINTTOOL      362
 #define B_SIMACLONEDELETE      366
 #define B_SIMANOTHING          368
 #define B_SIMACURVES           369
-#define B_SIMARANGE            370
+#define B_SIMARANGE                    370
 #define B_SIMA_USE_ALPHA       371
 #define B_SIMA_SHOW_ALPHA      372
 #define B_SIMA_SHOW_ZBUF       373
 #define B_SIMABTEXBROWSE       378
 #define B_SIMABTEXDELETE       379
 #define B_SIMARELOAD           380
-#define B_SIMANAME             381
-#define B_SIMAMULTI            382
+#define B_SIMANAME                     381
+#define B_SIMAMULTI                    382
 #define B_TRANS_IMAGE          383
 #define B_CURSOR_IMAGE         384
 #define B_SIMA_REPACK          385
-#define B_SIMA_PLAY            386
+#define B_SIMA_PLAY                    386
 #define B_SIMA_RECORD          387
+#define B_SIMAPIN                      388
 
 /* BUTS: 400 */
-#define B_BUTSHOME             401
+#define B_BUTSHOME                     401
 #define B_BUTSPREVIEW          402
-#define B_MATCOPY              403
-#define B_MATPASTE             404
-#define B_MESHTYPE             405
+#define B_MATCOPY                      403
+#define B_MATPASTE                     404
+#define B_MESHTYPE                     405
 #define B_CONTEXT_SWITCH       406
 
 /* IMASEL: 450 */
index 3e8d9d50d02abd1516136696a3645deecd9b7ee2..f7345f96b2d5c85355516a94e82f386d0628f65b 100644 (file)
@@ -235,7 +235,7 @@ typedef struct SpaceImage {
        short imanr, curtile;
        int flag;
        short imtypenr, lock;
-       short showspare, pad2;
+       short showspare, pin;
        float zoom;
        
        float xof, yof;                                 /* user defined offset, image is centered */
index c1f66d3f27ef776758365d7b3128c9c27ee86cf9..3a0ebb9b3b512d90cfb5a0b0cb3a2cb813da6c32 100644 (file)
@@ -244,26 +244,28 @@ void what_image(SpaceImage *sima)
 {
        MTFace *activetf;
                
-       if(sima->mode==SI_TEXTURE) {
+       if(             (sima->pin != 0) ||
+                       (sima->mode!=SI_TEXTURE) ||
+                       (sima->image && sima->image->source==IMA_SRC_VIEWER) ||
+                       (G.obedit != OBACT)
+       ) {
+               return;
+       }
+       
+       /* viewer overrides faceselect */
+       sima->image= NULL;
+       activetf = get_active_mtface(NULL, NULL, 1); /* partially selected face is ok */
+       
+       if(activetf && activetf->mode & TF_TEX) {
+               sima->image= activetf->tpage;
                
-               /* viewer overrides faceselect */
-               if(sima->image && sima->image->source==IMA_SRC_VIEWER) {}
-               else if (G.obedit == OBACT) {
-                       sima->image= NULL;
-                       activetf = get_active_mtface(NULL, NULL, 1); /* partially selected face is ok */
-                       
-                       if(activetf && activetf->mode & TF_TEX) {
-                               sima->image= activetf->tpage;
-                               
-                               if(sima->flag & SI_EDITTILE);
-                               else sima->curtile= activetf->tile;
-                               
-                               if(sima->image) {
-                                       if(activetf->mode & TF_TILES)
-                                               sima->image->tpageflag |= IMA_TILES;
-                                       else sima->image->tpageflag &= ~IMA_TILES;
-                               }
-                       }
+               if(sima->flag & SI_EDITTILE);
+               else sima->curtile= activetf->tile;
+               
+               if(sima->image) {
+                       if(activetf->mode & TF_TILES)
+                               sima->image->tpageflag |= IMA_TILES;
+                       else sima->image->tpageflag &= ~IMA_TILES;
                }
        }
 }
index dc40b17f3fc9ae730792150cacf2918040267994..cb5bc6579a7bcc5642ebfab08afa6b6243dee689 100644 (file)
@@ -105,6 +105,9 @@ void do_image_buttons(unsigned short event)
        }
        
        switch(event) {
+       case B_SIMAPIN:
+               allqueue (REDRAWIMAGE, 0);
+               break;
        case B_SIMAGEHOME:
                image_home();
                break;
@@ -1112,8 +1115,15 @@ void image_buttons(void)
        uiBlock *block;
        short xco, xmax;
        char naam[256], *menuname;
+       char is_render; /* true if the image is a render or composite */
+       
+       int allow_pin= B_SIMAPIN;
+       
        /* This should not be a static var */
        static int headerbuttons_packdummy;
+       
+       
+       is_render = ((G.sima->image!=NULL) && ((G.sima->image->type == IMA_TYPE_R_RESULT) || (G.sima->image->type == IMA_TYPE_COMPOSITE)));
 
        headerbuttons_packdummy = 0;
                
@@ -1178,13 +1188,13 @@ void image_buttons(void)
        /* other buttons: */
        uiBlockSetEmboss(block, UI_EMBOSS);
 
-       xco= std_libbuttons(block, xco, 0, 0, NULL, B_SIMABROWSE, ID_IM, 0, (ID *)ima, 0, &(G.sima->imanr), 0, 0, B_IMAGEDELETE, 0, 0);
+       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);
 
        /* UV EditMode buttons, not painting or rencering or compositing */
-       if (    EM_texFaceCheck() &&
-                       (G.sima->flag & SI_DRAWTOOL)==0 && 
-                       ((G.sima->image==NULL) || ((G.sima->image->type != IMA_TYPE_R_RESULT) && (G.sima->image->type != IMA_TYPE_COMPOSITE)))
-       ) {
+       if ( EM_texFaceCheck() && (G.sima->flag & SI_DRAWTOOL)==0 && !is_render) {
                xco+=10;
                uiDefIconTextButS(block, ICONTEXTROW,B_AROUND, ICON_ROTATE, around_pup(), xco,0,XIC+10,YIC, &(G.v2d->around), 0, 3.0, 0, 0, "Rotation/Scaling Pivot (Hotkeys: Comma, Shift Comma, Period) ");
                xco+= XIC + 12;
@@ -1247,7 +1257,7 @@ void image_buttons(void)
                uiBlockEndAlign(block);
                xco+= 8;
        }
-
+       
        /* draw LOCK */
        uiDefIconButS(block, ICONTOG, 0, ICON_UNLOCKED, xco,0,XIC,YIC, &(G.sima->lock), 0, 0, 0, 0, "Updates other affected window spaces automatically to reflect changes in real time");