[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12678] branches/imgbrowser-elubie/source/ blender: Doing some more buttons stuff again - intermediate commit working on texture panels

Matt Ebb matt at mke3.net
Mon Nov 26 07:55:18 CET 2007


Revision: 12678
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12678
Author:   broken
Date:     2007-11-26 07:55:17 +0100 (Mon, 26 Nov 2007)

Log Message:
-----------
Doing some more buttons stuff again - intermediate commit working on texture panels

Modified Paths:
--------------
    branches/imgbrowser-elubie/source/blender/include/butspace.h
    branches/imgbrowser-elubie/source/blender/src/buttons_shading.c
    branches/imgbrowser-elubie/source/blender/src/drawimage.c
    branches/imgbrowser-elubie/source/blender/src/drawview.c

Modified: branches/imgbrowser-elubie/source/blender/include/butspace.h
===================================================================
--- branches/imgbrowser-elubie/source/blender/include/butspace.h	2007-11-26 02:41:06 UTC (rev 12677)
+++ branches/imgbrowser-elubie/source/blender/include/butspace.h	2007-11-26 06:55:17 UTC (rev 12678)
@@ -118,7 +118,7 @@
 extern void texture_panels(void);
 extern void do_texbuts(unsigned short event);
 void uiblock_image_panel(struct uiBlock *block, struct Image **ima_pp, struct ImageUser *iuser, 
-						 short redraw, short imagechanged);
+						 short redraw, short imagechanged, short yco);
 void uiblock_layer_pass_buttons(struct uiBlock *block, struct RenderResult *rr, 
 							   struct ImageUser *iuser, int event, int x, int y, int w);
 

Modified: branches/imgbrowser-elubie/source/blender/src/buttons_shading.c
===================================================================
--- branches/imgbrowser-elubie/source/blender/src/buttons_shading.c	2007-11-26 02:41:06 UTC (rev 12677)
+++ branches/imgbrowser-elubie/source/blender/src/buttons_shading.c	2007-11-26 06:55:17 UTC (rev 12678)
@@ -1347,7 +1347,7 @@
 
 /* The general Image panel with the loadsa callbacks! */
 void uiblock_image_panel(uiBlock *block, Image **ima_pp, ImageUser *iuser, 
-						 short redraw, short imagechanged)
+						 short redraw, short imagechanged, short yco)
 {
 	Image *ima= *ima_pp;
 	uiBut *but;
@@ -1358,24 +1358,33 @@
 		ImBuf *ibuf= BKE_image_get_ibuf(ima, iuser);
 		
 		image_info(ima, ibuf, str);
-		uiDefBut(block, LABEL, 0, ima->id.name+2,	10, 180, 300, 20, NULL, 1, 0, 0, 0, "");
-		uiDefBut(block, LABEL, 0, str,				10, 160, 300, 20, NULL, 1, 0, 0, 0, "");
+		uiDefBut(block, LABEL, 0, ima->id.name+2,	
+			X1CLM1, yco-=BUTH, BUTW1, BUTH, NULL, 1, 0, 0, 0, "");
+		uiDefBut(block, LABEL, 0, str,
+			X2CLM1, yco-=BUTH, BUTW1, BUTH, NULL, 1, 0, 0, 0, "");
 		
+		yco -= BUTH;
+		
 		if(ima->type==IMA_TYPE_COMPOSITE) {
 			iuser= ntree_get_active_iuser(G.scene->nodetree);
 			if(iuser) {
 				uiBlockBeginAlign(block);
-				uiDefIconTextBut(block, BUT, B_SIMA_RECORD, ICON_REC, "Record",	10,120,100,20, 0, 0, 0, 0, 0, "");
-				uiDefIconTextBut(block, BUT, B_SIMA_PLAY, ICON_PLAY, "Play",	110,120,100,20, 0, 0, 0, 0, 0, "");
-				but= uiDefBut(block, BUT, B_NOP, "Free Cache",	210,120,100,20, 0, 0, 0, 0, 0, "");
+				uiDefIconTextBut(block, BUT, B_SIMA_RECORD, ICON_REC, "Record",
+					X3CLM1, yco-=BUTH, BUTW3, BUTH, 0, 0, 0, 0, 0, "");
+				uiDefIconTextBut(block, BUT, B_SIMA_PLAY, ICON_PLAY, "Play",
+					X3CLM2, yco, BUTW3, BUTH, 0, 0, 0, 0, 0, "");
+				but= uiDefBut(block, BUT, B_NOP, "Free Cache",
+					X3CLM3,yco, BUTW3, BUTH, 0, 0, 0, 0, 0, "");
 				uiButSetFunc(but, image_freecache_cb, ima, NULL);
 				
 				if(iuser->frames)
 					sprintf(str, "(%d) Frames:", iuser->framenr);
 				else strcpy(str, "Frames:");
 				uiBlockBeginAlign(block);
-				uiDefButI(block, NUM, imagechanged, str,		10, 90,150, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Sets the number of images of a movie to use");
-				uiDefButI(block, NUM, imagechanged, "StartFr:",	160,90,150,20, &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Sets the global starting frame of the movie");
+				uiDefButI(block, NUM, imagechanged, str,
+					X2CLM1, yco-=BUTH, BUTW2, BUTH, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "The number of images of a movie to record");
+				uiDefButI(block, NUM, imagechanged, "Start Frame:",
+					X2CLM2, yco, BUTW2, BUTH, &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "The global starting frame in Blender to record from");
 			}
 		}
 		else if(ima->type==IMA_TYPE_R_RESULT) {
@@ -1390,97 +1399,122 @@
 		uiSetButLock(ima->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
 		uiBlockBeginAlign(block);
 		uiBlockSetFunc(block, image_src_change_cb, ima, iuser);
-		uiDefButS(block, ROW, imagechanged, "Still",		10, 180, 60, 20, &ima->source, 0.0, IMA_SRC_FILE, 0, 0, "Single Image file");
-		uiDefButS(block, ROW, imagechanged, "Movie",		70, 180, 60, 20, &ima->source, 0.0, IMA_SRC_MOVIE, 0, 0, "Movie file");
-		uiDefButS(block, ROW, imagechanged, "Sequence",	130, 180, 90, 20, &ima->source, 0.0, IMA_SRC_SEQUENCE, 0, 0, "Multiple Image files, as a sequence");
-		uiDefButS(block, ROW, imagechanged, "Generated",	220, 180, 90, 20, &ima->source, 0.0, IMA_SRC_GENERATED, 0, 0, "Generated Image");
+		uiDefButS(block, ROW, imagechanged, "Still",
+			10, yco-=BUTH, 60, BUTH, &ima->source, 0.0, IMA_SRC_FILE, 0, 0, "Single Image file");
+		uiDefButS(block, ROW, imagechanged, "Movie",
+			70, yco, 60, BUTH, &ima->source, 0.0, IMA_SRC_MOVIE, 0, 0, "Movie file");
+		uiDefButS(block, ROW, imagechanged, "Sequence",
+			130, yco, 90, BUTH, &ima->source, 0.0, IMA_SRC_SEQUENCE, 0, 0, "Multiple Image files, as a sequence");
+		uiDefButS(block, ROW, imagechanged, "Generated",
+			220, yco, 90, BUTH, &ima->source, 0.0, IMA_SRC_GENERATED, 0, 0, "Generated Image");
 		uiBlockSetFunc(block, NULL, NULL, NULL);
 	}
 	else
-		uiDefBut(block, LABEL, 0, " ",					10, 180, 300, 20, 0, 0, 0, 0, 0, "");	/* for align in panel */
-				 
-	 /* Browse */
-	 IMAnames_to_pupstring(&strp, NULL, NULL, &(G.main->image), NULL, &iuser->menunr);
+		uiDefBut(block, LABEL, 0, " ",
+			10, yco, 300, 20, 0, 0, 0, 0, 0, "");	/* for align in panel */
+	
+	yco -= YSPACE;
+	/* Browse */
+	IMAnames_to_pupstring(&strp, NULL, NULL, &(G.main->image), NULL, &iuser->menunr);
 	 
-	 uiBlockBeginAlign(block);
-	 but= uiDefButS(block, MENU, imagechanged, strp,		10,155,23,20, &iuser->menunr, 0, 0, 0, 0, "Selects an existing Image or Movie");
-	 uiButSetFunc(but, image_browse_cb, ima_pp, iuser);
+	uiBlockBeginAlign(block);
+	but= uiDefButS(block, MENU, imagechanged, strp,
+		X1CLM1, yco-=BUTH, ICONBUTW, BUTH, &iuser->menunr, 0, 0, 0, 0, "Selects an existing Image or Movie");
+	uiButSetFunc(but, image_browse_cb, ima_pp, iuser);
 	 
-	 MEM_freeN(strp);
+	MEM_freeN(strp);
 	 
-	 /* name + options, or only load */
-	 if(ima) {
-		 int drawpack= (ima->source!=IMA_SRC_SEQUENCE && ima->source!=IMA_SRC_MOVIE && ima->ok);
+	/* name + options, or only load */
+	if(ima) {
+		int drawpack= (ima->source!=IMA_SRC_SEQUENCE && ima->source!=IMA_SRC_MOVIE && ima->ok);
 
-		 but= uiDefBut(block, TEX, B_IDNAME, "IM:",		33, 155, 177, 20, ima->id.name+2, 0.0, 21.0, 0, 0, "Current Image Datablock name.");
-		 uiButSetFunc(but, test_idbutton_cb, ima->id.name, NULL);
-		 but= uiDefBut(block, BUT, imagechanged, "Reload",		210, 155, 60, 20, NULL, 0, 0, 0, 0, "Reloads Image or Movie");
-		 uiButSetFunc(but, image_reload_cb, ima, iuser);
+		but= uiDefBut(block, TEX, B_IDNAME, "IM:",
+			X1CLM1+ICONBUTW, yco, (BUTW1-3*ICONBUTW-BUTW4-XSPACE), BUTH, ima->id.name+2, 0.0, 21.0, 0, 0, "The Image Datablock's name");
+		uiButSetFunc(but, test_idbutton_cb, ima->id.name, NULL);
+		but= uiDefBut(block, BUT, imagechanged, "Reload",
+			PANEL_XMAX-2*ICONBUTW-BUTW4, yco, BUTW4, BUTH, NULL, 0, 0, 0, 0, "Reload Image or Movie");
+		uiButSetFunc(but, image_reload_cb, ima, iuser);
 		 
-		 but= uiDefIconBut(block, BUT, imagechanged, ICON_X,	270,155,20,20, 0, 0, 0, 0, 0, "Unlink Image block");
-		 uiButSetFunc(but, image_unlink_cb, ima_pp, NULL);
-		 sprintf(str, "%d", ima->id.us);
-		 uiDefBut(block, BUT, B_NOP, str,					290,155,20,20, 0, 0, 0, 0, 0, "Only displays number of users of Image block");
+		but= uiDefIconBut(block, BUT, imagechanged, ICON_X,
+			PANEL_XMAX-2*ICONBUTW, yco, ICONBUTW, BUTH, 0, 0, 0, 0, 0, "Unlink this Image block");
+		uiButSetFunc(but, image_unlink_cb, ima_pp, NULL);
+		sprintf(str, "%d", ima->id.us);
+		uiDefBut(block, BUT, B_NOP, str,
+			PANEL_XMAX-ICONBUTW, yco, ICONBUTW, BUTH, 0, 0, 0, 0, 0, "The number of users of this Image block");
 		 
-		 but= uiDefIconBut(block, BUT, imagechanged, ICON_FILESEL,	10, 135, 23, 20, 0, 0, 0, 0, 0, "Open Fileselect to load new Image");
-		 uiButSetFunc(but, image_load_fs_cb, ima_pp, iuser);
-		 but= uiDefBut(block, TEX, imagechanged, "",				33,135,257+(drawpack?0:20),20, ima->name, 0.0, 239.0, 0, 0, "Image/Movie file name, change to load new");
-		 uiButSetFunc(but, image_load_cb, ima_pp, iuser);
+		but= uiDefIconBut(block, BUT, imagechanged, ICON_FILESEL,
+			X1CLM1, yco-=BUTH, ICONBUTW, BUTH, 0, 0, 0, 0, 0, "Open Fileselect to load new Image");
+		uiButSetFunc(but, image_load_fs_cb, ima_pp, iuser);
+		but= uiDefBut(block, TEX, imagechanged, "",
+			X1CLM1+ICONBUTW, yco, (BUTW1-2*ICONBUTW)+(drawpack?0:ICONBUTW), BUTH, ima->name, 0.0, 239.0, 0, 0, "Image/Movie file name, change to load new");
+		uiButSetFunc(but, image_load_cb, ima_pp, iuser);
 		 
-		 if(drawpack) {
-			 if (ima->packedfile) packdummy = 1;
-			 else packdummy = 0;
-			 but= uiDefIconButBitI(block, TOG, 1, redraw, ICON_PACKAGE, 290,135,20,20, &packdummy, 0, 0, 0, 0, "Toggles Packed status of this Image");
-			 uiButSetFunc(but, image_pack_cb, ima, iuser);
-		 }
-		 
-	 }
-	 else {
-		 but= uiDefBut(block, BUT, imagechanged, "Load",		33, 155, 100,20, NULL, 0, 0, 0, 0, "Load new Image of Movie");
-		 uiButSetFunc(but, image_load_fs_cb, ima_pp, iuser);
-	 }
-	 uiBlockEndAlign(block);
+		if(drawpack) {
+			if (ima->packedfile) packdummy = 1;
+			else packdummy = 0;
+			but= uiDefIconButBitI(block, TOG, 1, redraw, ICON_PACKAGE,
+				PANEL_XMAX-ICONBUTW, yco, ICONBUTW, BUTH, &packdummy, 0, 0, 0, 0, "pack or unpack this Image in the .blend file");
+			uiButSetFunc(but, image_pack_cb, ima, iuser);
+		}
+	}
+	else {
+		but= uiDefIconTextBut(block, BUT, imagechanged, ICON_FILESEL, "Open Image",
+			X2CLM1+ICONBUTW, yco, BUTW3, BUTH, NULL, 0, 0, 0, 0, "Open new Image or Movie");
+		uiButSetFunc(but, image_load_fs_cb, ima_pp, iuser);
+	}
+	uiBlockEndAlign(block);
 	 
 	 if(ima) {
-		 ImBuf *ibuf= BKE_image_get_ibuf(ima, iuser);
+		ImBuf *ibuf= BKE_image_get_ibuf(ima, iuser);
 		 
-		 /* check for re-render, only buttons */
-		 if(imagechanged==B_IMAGECHANGED) {
+		/* check for re-render, only buttons */
+		if(imagechanged==B_IMAGECHANGED) {
 			 if(iuser->flag & IMA_ANIM_REFRESHED) {
-				 iuser->flag &= ~IMA_ANIM_REFRESHED;
-				 BIF_preview_changed(ID_TE);
-			 }
-		 }
+				iuser->flag &= ~IMA_ANIM_REFRESHED;
+				BIF_preview_changed(ID_TE);
+			}
+		}
 		 
 		 /* multilayer? */
-		 if(ima->type==IMA_TYPE_MULTILAYER && ima->rr) {
-			 uiblock_layer_pass_arrow_buttons(block, ima->rr, iuser, imagechanged);
-		 }
-		 else {
-			 image_info(ima, ibuf, str);
-			 uiDefBut(block, LABEL, 0, str,		10, 112, 300, 20, NULL, 1, 0, 0, 0, "");
-		 }

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list