[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15126] branches/soc-2008-unclezeiv/source /blender: Added "rendering time" to stamp feature.

Davide Vercelli davide.vercelli at gmail.com
Thu Jun 5 00:51:14 CEST 2008


Revision: 15126
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15126
Author:   unclezeiv
Date:     2008-06-05 00:51:14 +0200 (Thu, 05 Jun 2008)

Log Message:
-----------
Added "rendering time" to stamp feature.

The code is completely independent from the lightcuts project, so if someone wants to review and commit it in trunk, it would be great.

Modified Paths:
--------------
    branches/soc-2008-unclezeiv/source/blender/blenkernel/intern/image.c
    branches/soc-2008-unclezeiv/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2008-unclezeiv/source/blender/src/buttons_scene.c

Modified: branches/soc-2008-unclezeiv/source/blender/blenkernel/intern/image.c
===================================================================
--- branches/soc-2008-unclezeiv/source/blender/blenkernel/intern/image.c	2008-06-04 22:32:15 UTC (rev 15125)
+++ branches/soc-2008-unclezeiv/source/blender/blenkernel/intern/image.c	2008-06-04 22:51:14 UTC (rev 15126)
@@ -893,11 +893,13 @@
 	char 	camera[64];
 	char 	scene[64];
 	char 	strip[64];
+	char	rentime[64];
 } StampData;
 
 static void stampdata(StampData *stamp_data, int do_prefix)
 {
 	char text[256];
+	extern char info_time_str[32]; // header_info.c
 	
 #ifndef WIN32
 	struct tm *tl;
@@ -1017,6 +1019,11 @@
 	} else {
 		stamp_data->strip[0] = '\0';
 	}
+	
+	if (G.scene->r.stamp & R_STAMP_RENTIME) {
+		if (do_prefix)		sprintf(stamp_data->rentime, "Rendering %s", info_time_str);
+		else				sprintf(stamp_data->rentime, "%s", info_time_str);
+	}
 }
 
 void BKE_stamp_buf(unsigned char *rect, float *rectf, int width, int height, int channels)
@@ -1141,6 +1148,16 @@
 		BMF_DrawStringBuf(font, stamp_data.strip, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height, channels);
 	}
 	
+	/* top right corner, before strip */
+	if (stamp_data.rentime[0]) {
+		text_width = BMF_GetStringWidth(font, stamp_data.rentime);
+		/* Top right corner */
+		if (!stamp_data.strip[0]) x = width + 1;
+		x -= (text_width + 2 + text_pad);
+		y = height - font_height - 1;
+		buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
+		BMF_DrawStringBuf(font, stamp_data.rentime, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height, channels);
+	}
 }
 
 void BKE_stamp_info(struct ImBuf *ibuf)
@@ -1161,6 +1178,7 @@
 	if (stamp_data.camera[0])	IMB_imginfo_change_field (ibuf, "Camera",	stamp_data.camera);
 	if (stamp_data.scene[0])	IMB_imginfo_change_field (ibuf, "Scene",	stamp_data.scene);
 	if (stamp_data.strip[0])	IMB_imginfo_change_field (ibuf, "Strip",	stamp_data.strip);
+	if (stamp_data.rentime[0])	IMB_imginfo_change_field (ibuf, "Rendering",stamp_data.rentime);
 }
 
 int BKE_write_ibuf(ImBuf *ibuf, char *name, int imtype, int subimtype, int quality)

Modified: branches/soc-2008-unclezeiv/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/soc-2008-unclezeiv/source/blender/makesdna/DNA_scene_types.h	2008-06-04 22:32:15 UTC (rev 15125)
+++ branches/soc-2008-unclezeiv/source/blender/makesdna/DNA_scene_types.h	2008-06-04 22:51:14 UTC (rev 15126)
@@ -651,6 +651,7 @@
 #define R_STAMP_MARKER	0x0080
 #define R_STAMP_FILENAME	0x0100
 #define R_STAMP_SEQSTRIP	0x0200
+#define R_STAMP_RENTIME	0x0400
 
 /* alphamode */
 #define R_ADDSKY		0

Modified: branches/soc-2008-unclezeiv/source/blender/src/buttons_scene.c
===================================================================
--- branches/soc-2008-unclezeiv/source/blender/src/buttons_scene.c	2008-06-04 22:32:15 UTC (rev 15125)
+++ branches/soc-2008-unclezeiv/source/blender/src/buttons_scene.c	2008-06-04 22:51:14 UTC (rev 15126)
@@ -2944,7 +2944,7 @@
 		yofs += 30; /* gap */
 		
 		
-		yofs += 80;
+		yofs += 100;
  		/* Order is important for alligning ... grr */
 		uiBlockBeginAlign(block);
 		uiDefButBitI(block, TOG, R_STAMP_FILENAME, B_REDR, "Filename", xofs, yofs, 120, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp blend filename");
@@ -2959,8 +2959,10 @@
 		uiDefButBitI(block, TOG, R_STAMP_MARKER, B_REDR, "Marker", xofs+60, yofs, 60, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp the last marker");
 		yofs -= 20;
 		uiDefButBitI(block, TOG, R_STAMP_SEQSTRIP, B_REDR, "Sequence Strip", xofs, yofs, 120, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp the forground sequence strip name");
+		yofs -= 20;
+		uiDefButBitI(block, TOG, R_STAMP_RENTIME, B_REDR, "Render time", xofs, yofs, 120, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp the rendering time");
 		uiBlockEndAlign(block);
-		yofs += 80;
+		yofs += 100;
 		
 		/* draw font selector */
 		if (G.scene->r.stamp & R_STAMP_DRAW) {





More information about the Bf-blender-cvs mailing list