Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2007-09-18 17:10:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-09-18 17:10:17 +0400
commit621a1746de181d72e5c1cc5250b84d0c044e165d (patch)
treec4adc9038eb81df9a685cfb339bd3ad4a268028c /source
parent0a8c558c1726714d2235d84fa5bc00c608ba306b (diff)
added pin for images, this is useful because you might want to edit a model's verts without the image changing.
Diffstat (limited to 'source')
-rw-r--r--source/blender/include/blendef.h25
-rw-r--r--source/blender/makesdna/DNA_space_types.h2
-rw-r--r--source/blender/src/drawimage.c40
-rw-r--r--source/blender/src/header_image.c22
4 files changed, 51 insertions, 38 deletions
diff --git a/source/blender/include/blendef.h b/source/blender/include/blendef.h
index ac29f386678..9ea736dc0fe 100644
--- a/source/blender/include/blendef.h
+++ b/source/blender/include/blendef.h
@@ -283,7 +283,7 @@
#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
@@ -304,11 +304,11 @@
#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
@@ -318,7 +318,7 @@
#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
@@ -329,20 +329,21 @@
#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 */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 3e8d9d50d02..f7345f96b2d 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -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 */
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
index c1f66d3f27e..3a0ebb9b3b5 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -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;
}
}
}
diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c
index dc40b17f3fc..cb5bc6579a7 100644
--- a/source/blender/src/header_image.c
+++ b/source/blender/src/header_image.c
@@ -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");