[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12083] trunk/blender/source/blender: added pin for images, this is useful because you might want to edit a model' s verts without the image changing.

Campbell Barton cbarton at metavr.com
Tue Sep 18 15:10:17 CEST 2007


Revision: 12083
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12083
Author:   campbellbarton
Date:     2007-09-18 15:10:17 +0200 (Tue, 18 Sep 2007)

Log Message:
-----------
added pin for images, this is useful because you might want to edit a model's verts without the image changing.

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

Modified: trunk/blender/source/blender/include/blendef.h
===================================================================
--- trunk/blender/source/blender/include/blendef.h	2007-09-18 12:24:22 UTC (rev 12082)
+++ trunk/blender/source/blender/include/blendef.h	2007-09-18 13:10:17 UTC (rev 12083)
@@ -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 */

Modified: trunk/blender/source/blender/makesdna/DNA_space_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_space_types.h	2007-09-18 12:24:22 UTC (rev 12082)
+++ trunk/blender/source/blender/makesdna/DNA_space_types.h	2007-09-18 13:10:17 UTC (rev 12083)
@@ -235,7 +235,7 @@
 	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 */

Modified: trunk/blender/source/blender/src/drawimage.c
===================================================================
--- trunk/blender/source/blender/src/drawimage.c	2007-09-18 12:24:22 UTC (rev 12082)
+++ trunk/blender/source/blender/src/drawimage.c	2007-09-18 13:10:17 UTC (rev 12083)
@@ -244,26 +244,28 @@
 {
 	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;
 		}
 	}
 }

Modified: trunk/blender/source/blender/src/header_image.c
===================================================================
--- trunk/blender/source/blender/src/header_image.c	2007-09-18 12:24:22 UTC (rev 12082)
+++ trunk/blender/source/blender/src/header_image.c	2007-09-18 13:10:17 UTC (rev 12083)
@@ -105,6 +105,9 @@
 	}
 	
 	switch(event) {
+	case B_SIMAPIN:
+		allqueue (REDRAWIMAGE, 0);
+		break;
 	case B_SIMAGEHOME:
 		image_home();
 		break;
@@ -1112,8 +1115,15 @@
 	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 @@
 	/* 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 @@
 		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");
 





More information about the Bf-blender-cvs mailing list