? user-config.py ? tools/Blender.pyc ? tools/__init__.pyc ? tools/bcolors.pyc ? tools/btools.pyc Index: source/blender/blenkernel/BKE_global.h =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/blenkernel/BKE_global.h,v retrieving revision 1.47 diff -u -u -r1.47 BKE_global.h --- source/blender/blenkernel/BKE_global.h 30 Jan 2007 10:49:56 -0000 1.47 +++ source/blender/blenkernel/BKE_global.h 12 Feb 2007 21:18:25 -0000 @@ -148,6 +148,16 @@ /* confusing... G.f and G.flags */ int flags; + /* stamp info. */ + struct + { + short date; + short time; + short frame; + short camera; + short scene; + } + stamp; } Global; /* **************** GLOBAL ********************* */ Index: source/blender/blenkernel/BKE_image.h =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/blenkernel/BKE_image.h,v retrieving revision 1.16 diff -u -u -r1.16 BKE_image.h --- source/blender/blenkernel/BKE_image.h 20 Dec 2006 17:57:41 -0000 1.16 +++ source/blender/blenkernel/BKE_image.h 12 Feb 2007 21:18:26 -0000 @@ -146,6 +146,12 @@ void BKE_image_memorypack(struct Image *ima); +/* Stamp info. */ +#define STAMP_TO_RENDER 0 +#define STAMP_TO_RECT 1 + +void BKE_stamp ( void *data, int winx, int winy, struct View3D *v3d, int mode ); + #ifdef __cplusplus } #endif Index: source/blender/blenkernel/intern/blender.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/blenkernel/intern/blender.c,v retrieving revision 1.47 diff -u -u -r1.47 blender.c --- source/blender/blenkernel/intern/blender.c 27 Nov 2006 10:43:00 -0000 1.47 +++ source/blender/blenkernel/intern/blender.c 12 Feb 2007 21:18:29 -0000 @@ -227,6 +227,12 @@ G.charstart = 0x0000; G.charmin = 0x0000; G.charmax = 0xffff; + + G.stamp.date = 1; + G.stamp.time = 1; + G.stamp.frame = 1; + G.stamp.camera = 1; + G.stamp.scene = 1; } /***/ Index: source/blender/blenkernel/intern/image.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/blenkernel/intern/image.c,v retrieving revision 1.59 diff -u -u -r1.59 image.c --- source/blender/blenkernel/intern/image.c 10 Feb 2007 16:59:20 -0000 1.59 +++ source/blender/blenkernel/intern/image.c 12 Feb 2007 21:18:37 -0000 @@ -54,6 +54,8 @@ #include "DNA_scene_types.h" #include "DNA_texture_types.h" #include "DNA_userdef_types.h" +#include "DNA_view3d_types.h" +#include "DNA_camera_types.h" #include "BLI_arithb.h" #include "BLI_blenlib.h" @@ -84,6 +86,105 @@ #define IMA_MAKE_INDEX(frame, index) ((frame)<<10)+index #define IMA_INDEX_FRAME(index) (index>>10) +/* font data for stamp info. */ +unsigned char fntdat[95][12]={ +/* [ ] = */ {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, +/* [!] = */ {0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x78,0x78,0x78,0x30,0x00}, +/* ["] = */ {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x66,0x66,0x66,0x00}, +/* [#] = */ {0x00,0x00,0x6c,0x6c,0xfe,0x6c,0x6c,0x6c,0xfe,0x6c,0x6c,0x00}, +/* [$] = */ {0x00,0x30,0x30,0xf8,0x0c,0x0c,0x78,0xc0,0xc0,0x7c,0x30,0x30}, +/* [%] = */ {0x00,0x00,0x8c,0xcc,0x60,0x30,0x18,0xcc,0xc4,0x00,0x00,0x00}, +/* [&] = */ {0x00,0x00,0x76,0xdc,0xcc,0xde,0xfa,0x70,0xd8,0xd8,0x70,0x00}, +/* ['] = */ {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x30,0x30,0x30,0x00}, +/* [(] = */ {0x00,0x00,0x0c,0x18,0x30,0x60,0x60,0x60,0x30,0x18,0x0c,0x00}, +/* [)] = */ {0x00,0x00,0x60,0x30,0x18,0x0c,0x0c,0x0c,0x18,0x30,0x60,0x00}, +/* [*] = */ {0x00,0x00,0x00,0x00,0x66,0x3c,0xff,0x3c,0x66,0x00,0x00,0x00}, +/* [+] = */ {0x00,0x00,0x00,0x00,0x18,0x18,0x7e,0x18,0x18,0x00,0x00,0x00}, +/* [,] = */ {0x00,0x60,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, +/* [-] = */ {0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00}, +/* [.] = */ {0x00,0x00,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, +/* [/] = */ {0x00,0x00,0x80,0xc0,0x60,0x30,0x18,0x0c,0x06,0x02,0x00,0x00}, +/* [0] = */ {0x00,0x00,0x7c,0xc6,0xe6,0xf6,0xd6,0xde,0xce,0xc6,0x7c,0x00}, +/* [1] = */ {0x00,0x00,0xfc,0x30,0x30,0x30,0x30,0x30,0xf0,0x30,0x10,0x00}, +/* [2] = */ {0x00,0x00,0xfc,0xcc,0x60,0x30,0x18,0x0c,0xcc,0xcc,0x78,0x00}, +/* [3] = */ {0x00,0x00,0x78,0xcc,0x0c,0x0c,0x38,0x0c,0x0c,0xcc,0x78,0x00}, +/* [4] = */ {0x00,0x00,0x1e,0x0c,0x0c,0xfe,0xcc,0x6c,0x3c,0x1c,0x0c,0x00}, +/* [5] = */ {0x00,0x00,0x78,0xcc,0x0c,0x0c,0xf8,0xc0,0xc0,0xc0,0xfc,0x00}, +/* [6] = */ {0x00,0x00,0x78,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0x60,0x38,0x00}, +/* [7] = */ {0x00,0x00,0x30,0x30,0x30,0x18,0x0c,0x06,0xc6,0xc6,0xfe,0x00}, +/* [8] = */ {0x00,0x00,0x78,0xcc,0xcc,0xdc,0x78,0xec,0xcc,0xcc,0x78,0x00}, +/* [9] = */ {0x00,0x00,0x70,0x30,0x18,0x18,0x7c,0xcc,0xcc,0xcc,0x78,0x00}, +/* [:] = */ {0x00,0x00,0x00,0x38,0x38,0x00,0x00,0x38,0x38,0x00,0x00,0x00}, +/* [;] = */ {0x00,0x30,0x18,0x38,0x38,0x00,0x00,0x38,0x38,0x00,0x00,0x00}, +/* [<] = */ {0x00,0x00,0x0c,0x18,0x30,0x60,0xc0,0x60,0x30,0x18,0x0c,0x00}, +/* [=] = */ {0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x7e,0x00,0x00,0x00,0x00}, +/* [>] = */ {0x00,0x00,0x60,0x30,0x18,0x0c,0x06,0x0c,0x18,0x30,0x60,0x00}, +/* [?] = */ {0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x18,0x0c,0xcc,0x78,0x00}, +/* [@] = */ {0x00,0x00,0x7c,0xc0,0xc0,0xde,0xde,0xde,0xc6,0xc6,0x7c,0x00}, +/* [A] = */ {0x00,0x00,0xcc,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0x78,0x30,0x00}, +/* [B] = */ {0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x66,0x66,0x66,0xfc,0x00}, +/* [C] = */ {0x00,0x00,0x3c,0x66,0xc6,0xc0,0xc0,0xc0,0xc6,0x66,0x3c,0x00}, +/* [D] = */ {0x00,0x00,0xf8,0x6c,0x66,0x66,0x66,0x66,0x66,0x6c,0xf8,0x00}, +/* [E] = */ {0x00,0x00,0xfe,0x62,0x60,0x64,0x7c,0x64,0x60,0x62,0xfe,0x00}, +/* [F] = */ {0x00,0x00,0xf0,0x60,0x60,0x64,0x7c,0x64,0x62,0x66,0xfe,0x00}, +/* [G] = */ {0x00,0x00,0x3e,0x66,0xc6,0xce,0xc0,0xc0,0xc6,0x66,0x3c,0x00}, +/* [H] = */ {0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0xcc,0x00}, +/* [I] = */ {0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00}, +/* [J] = */ {0x00,0x00,0x78,0xcc,0xcc,0xcc,0x0c,0x0c,0x0c,0x0c,0x1e,0x00}, +/* [K] = */ {0x00,0x00,0xe6,0x66,0x6c,0x6c,0x78,0x6c,0x6c,0x66,0xe6,0x00}, +/* [L] = */ {0x00,0x00,0xfe,0x66,0x66,0x62,0x60,0x60,0x60,0x60,0xf0,0x00}, +/* [M] = */ {0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xd6,0xfe,0xfe,0xee,0xc6,0x00}, +/* [N] = */ {0x00,0x00,0xc6,0xc6,0xce,0xde,0xfe,0xf6,0xe6,0xc6,0xc6,0x00}, +/* [O] = */ {0x00,0x00,0x38,0x6c,0xc6,0xc6,0xc6,0xc6,0xc6,0x6c,0x38,0x00}, +/* [P] = */ {0x00,0x00,0xf0,0x60,0x60,0x60,0x7c,0x66,0x66,0x66,0xfc,0x00}, +/* [Q] = */ {0x00,0x1e,0x0c,0x7c,0xde,0xce,0xc6,0xc6,0xc6,0x6c,0x38,0x00}, +/* [R] = */ {0x00,0x00,0xe6,0x66,0x66,0x6c,0x7c,0x66,0x66,0x66,0xfc,0x00}, +/* [S] = */ {0x00,0x00,0x78,0xcc,0xcc,0x18,0x70,0xc0,0xcc,0xcc,0x78,0x00}, +/* [T] = */ {0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0xb4,0xfc,0x00}, +/* [U] = */ {0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x00}, +/* [V] = */ {0x00,0x00,0x30,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x00}, +/* [W] = */ {0x00,0x00,0x6c,0x6c,0x6c,0xd6,0xd6,0xc6,0xc6,0xc6,0xc6,0x00}, +/* [X] = */ {0x00,0x00,0xcc,0xcc,0xcc,0x78,0x30,0x78,0xcc,0xcc,0xcc,0x00}, +/* [Y] = */ {0x00,0x00,0x78,0x30,0x30,0x30,0x78,0xcc,0xcc,0xcc,0xcc,0x00}, +/* [Z] = */ {0x00,0x00,0xfe,0xc6,0x62,0x60,0x30,0x18,0x98,0xce,0xfe,0x00}, +/* [[] = */ {0x00,0x00,0x3c,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3c,0x00}, +/* [\] = */ {0x00,0x00,0x02,0x06,0x0c,0x18,0x30,0x60,0xc0,0x80,0x00,0x00}, +/* []] = */ {0x00,0x00,0x3c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3c,0x00}, +/* [^] = */ {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc6,0x6c,0x38,0x10}, +/* [_] = */ {0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, +/* [`] = */ {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x30,0x30}, +/* [a] = */ {0x00,0x00,0x76,0xcc,0xcc,0x7c,0x0c,0x78,0x00,0x00,0x00,0x00}, +/* [b] = */ {0x00,0x00,0xdc,0x66,0x66,0x66,0x66,0x7c,0x60,0x60,0xe0,0x00}, +/* [c] = */ {0x00,0x00,0x78,0xcc,0xc0,0xc0,0xcc,0x78,0x00,0x00,0x00,0x00}, +/* [d] = */ {0x00,0x00,0x76,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x1c,0x00}, +/* [e] = */ {0x00,0x00,0x78,0xcc,0xc0,0xfc,0xcc,0x78,0x00,0x00,0x00,0x00}, +/* [f] = */ {0x00,0x00,0xf0,0x60,0x60,0x60,0xf8,0x60,0x60,0x6c,0x38,0x00}, +/* [g] = */ {0x78,0xcc,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00}, +/* [h] = */ {0x00,0x00,0xe6,0x66,0x66,0x66,0x76,0x6c,0x60,0x60,0xe0,0x00}, +/* [i] = */ {0x00,0x00,0x7e,0x18,0x18,0x18,0x18,0x78,0x00,0x18,0x18,0x00}, +/* [j] = */ {0x78,0xcc,0xcc,0x0c,0x0c,0x0c,0x0c,0x3c,0x00,0x0c,0x0c,0x00}, +/* [k] = */ {0x00,0x00,0xe6,0x66,0x6c,0x78,0x6c,0x66,0x60,0x60,0xe0,0x00}, +/* [l] = */ {0x00,0x00,0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x00}, +/* [m] = */ {0x00,0x00,0xc6,0xd6,0xd6,0xd6,0xd6,0xfc,0x00,0x00,0x00,0x00}, +/* [n] = */ {0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xf8,0x00,0x00,0x00,0x00}, +/* [o] = */ {0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00,0x00}, +/* [p] = */ {0xf0,0x60,0x7c,0x66,0x66,0x66,0x66,0xdc,0x00,0x00,0x00,0x00}, +/* [q] = */ {0x1e,0x0c,0x7c,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00}, +/* [r] = */ {0x00,0x00,0xf0,0x60,0x60,0x76,0x6e,0xec,0x00,0x00,0x00,0x00}, +/* [s] = */ {0x00,0x00,0x78,0xcc,0x18,0x60,0xcc,0x78,0x00,0x00,0x00,0x00}, +/* [t] = */ {0x00,0x00,0x38,0x6c,0x60,0x60,0x60,0xfc,0x60,0x20,0x00,0x00}, +/* [u] = */ {0x00,0x00,0x76,0xcc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00,0x00}, +/* [v] = */ {0x00,0x00,0x30,0x78,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00,0x00}, +/* [w] = */ {0x00,0x00,0x6c,0x6c,0xd6,0xd6,0xc6,0xc6,0x00,0x00,0x00,0x00}, +/* [x] = */ {0x00,0x00,0xc6,0x6c,0x38,0x38,0x6c,0xc6,0x00,0x00,0x00,0x00}, +/* [y] = */ {0xf0,0x18,0x0c,0x3c,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00}, +/* [z] = */ {0x00,0x00,0xfc,0xc4,0x60,0x18,0x8c,0xfc,0x00,0x00,0x00,0x00}, +/* [{] = */ {0x00,0x00,0x1c,0x30,0x30,0x60,0xc0,0x60,0x30,0x30,0x1c,0x00}, +/* [|] = */ {0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x00}, +/* [}] = */ {0x00,0x00,0xe0,0x30,0x30,0x18,0x0c,0x18,0x30,0x30,0xe0,0x00}, +/* [~] = */ {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xda,0x73,0x00}, +}; + /* ******** IMAGE PROCESSING ************* */ /* used by sequencer */ @@ -1520,3 +1621,251 @@ } } +/***** Stamp info API *****/ +#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val)) + +void stamp_text ( char *text, unsigned short xref, unsigned short yref, void *data, int width, int height, int mode, int *ret_x, int *ret_y ) +{ + unsigned short x, y, textposx; + unsigned char ftlnbt; + RenderResult rres; + float *bpt; + char *rc; + int posx; + int posy; + int i, j, c, lentext; + + if ((!text) || (!data) || (!ret_x) || (!ret_y)) + return; + + if (mode == STAMP_TO_RENDER) + { + width = RE_GetRenderWidth ((Render *) data); + height = RE_GetRenderHeight ((Render *) data); + RE_GetResultImage ((Render *) data, &rres); + } + + lentext = strlen (text); + for (i = 0, j = 0; i < lentext; i++, j++) + { + c = text[i] - 32; + if ((c < 0) || (c > 94)) + c = 0; + + textposx = xref + (j * 8); + if ((textposx + 8) > width) + { + if (mode == STAMP_TO_RENDER) + yref += 12; + else + yref -= 12; + + textposx = xref = 1; + j = 0; + } + + for (y = 0; y < 12; y++) + { + if (mode == STAMP_TO_RENDER) + { + if ((yref + y) > height) + return; + bpt = (float *) rres.rectf + ((((height-1)-yref+y)*width)<<2); + posy = yref + y; + bpt += (4 * textposx); + } + else + { + rc = ((char *) data) + (4 * width * yref) + (4 * y * width); + posy = yref - y; + rc += (4 * textposx); + } + + for (x = 0; x < 8; x++) + { + ftlnbt = fntdat[c][y]; + if (ftlnbt & (0x80 >> x)) + { + if (mode == STAMP_TO_RENDER) + { + if (G.scene->r.scemode & R_STAMP_INFO_INV) + { + if ((bpt[0] < 0.55) && (bpt[0] > 0.45)) + bpt[0] = 1.2 - bpt[0]; + else + bpt[0] = 1 - bpt[0]; + + if ((bpt[1] < 0.55) && (bpt[1] > 0.45)) + bpt[1] = 1.2 - bpt[1]; + else + bpt[1] = 1 - bpt[1]; + + if ((bpt[2] < 0.55) && (bpt[2] > 0.45)) + bpt[2] = 1.2 - bpt[2]; + else + bpt[2] = 1 - bpt[2]; + } + else + { + bpt[0] = G.scene->r.stamp_colorr; + bpt[1] = G.scene->r.stamp_colorg; + bpt[2] = G.scene->r.stamp_colorb; + } + } + else + { + if (G.scene->r.scemode & R_STAMP_INFO_INV) + { + if ((rc[0] < 139) && (rc[0] > 115)) + rc[0] = 279 - rc[0]; + else + rc[0] = 255 - rc[0]; + + if ((rc[1] < 139) && (rc[1] > 115)) + rc[1] = 279 - rc[1]; + else + rc[1] = 255 - rc[1]; + + if ((rc[2] < 139) && (rc[2] > 115)) + rc[2] = 279 - rc[2]; + else + rc[2] = 255 - rc[2]; + } + else + { + rc[0] = FTOCHAR(G.scene->r.stamp_colorr); + rc[1] = FTOCHAR(G.scene->r.stamp_colorg); + rc[2] = FTOCHAR(G.scene->r.stamp_colorb); + } + } + } + + if (mode == STAMP_TO_RENDER) + bpt += 4; + else + rc += 4; + + posx = (4 * textposx) + x; + } + } + } + + (*ret_x) = posx; + (*ret_y) = posy; +} + +void BKE_stamp ( void *data, int winx, int winy, View3D *v3d, int mode ) +{ + Camera *cam; + float seg; + char text[240], sdate[9], stime[15]; + int posx; + int posy; + int day; + int hour; + int min; +#ifndef WIN32 + struct tm *tl; + time_t t; +#endif /* WIN32 */ + + if (!data) + return; + + if ((mode == STAMP_TO_RECT) && (!v3d)) + return; + + posx = 0; + posy = 0; + + if (mode == STAMP_TO_RENDER) + stamp_text (G.sce, 1, 12, data, 0, 0, STAMP_TO_RENDER, &posx, &posy); + else + stamp_text (G.sce, 1, winy - 12, data, winx, winy, STAMP_TO_RECT, &posx, &posy); + +#ifdef WIN32 + _strdate (sdate); +#else /* ! WIN32 */ + t = time (NULL); + tl = localtime (&t); + sprintf (sdate, "%02d-%02d-%02d", tl->tm_mon+1, tl->tm_mday, tl->tm_year - 100); +#endif /* WIN32 */ + + seg = (float)(G.scene->r.cfra - G.scene->r.sfra) / (float) RE_GetRenderFrsSec ((Render *) data); + day = seg / 86400; + hour = (seg / 3600) - (day * 24); + min = (seg / 60) - (hour * 60); + seg = seg - (hour * 3600) - (min * 60); + if (G.stamp.time) + { + sprintf (stime, "%02d:%02d:%0.3f", hour, min, seg); + + if (G.stamp.frame) + { + sprintf (text, "%s f#%i", stime, G.scene->r.cfra); + stamp_text (text, 1, posy, data, winx, winy, mode, &posx, &posy); + } + else + stamp_text (stime, 1, posy, data, winx, winy, mode, &posx, &posy); + } + else if (G.stamp.frame) + { + sprintf (text, "f#%i", G.scene->r.cfra); + stamp_text (text, 1, posy, data, winx, winy, mode, &posx, &posy); + } + + if (mode == STAMP_TO_RENDER) + { + stamp_text (RE_GetRenderStampInfo ((Render *) data), 1, RE_GetRenderHeight ((Render *) data) - 24, data, 0, 0, STAMP_TO_RENDER, &posx, &posy); + + if (G.stamp.date) + stamp_text (sdate, 1, RE_GetRenderHeight ((Render *) data) - 12, data, 0, 0, STAMP_TO_RENDER, &posx, &posy); + + strcpy (text, ((Camera *) G.scene->camera)->id.name); + text[0] = ' '; + text[1] = ' '; + posx = (RE_GetRenderWidth ((Render *) data) / 2) - (strlen (text) * 4); + + if (G.stamp.camera) + stamp_text (text, posx, RE_GetRenderHeight ((Render *) data) - 12, data, 0, 0, STAMP_TO_RENDER, &posx, &posy); + + strcpy (text, G.scene->id.name); + text[0] = ' '; + text[1] = ' '; + posx = RE_GetRenderWidth ((Render *) data) - ((strlen (text) + 1) * 8); + + if (G.stamp.scene) + stamp_text (text, posx, RE_GetRenderHeight ((Render *) data) - 12, data, 0, 0, STAMP_TO_RENDER, &posx, &posy); + } + else + { + stamp_text (G.scene->r.stamp_u_data, 1, 12, data, winx, winy, STAMP_TO_RECT, &posx, &posy); + + if (G.stamp.date) + stamp_text (sdate, 1, 1, data, winx, winy, STAMP_TO_RECT, &posx, &posy); + + if (v3d->persp == V3D_PERSP_USE_THE_CAMERA) + { + cam = (Camera *) G.scene->camera; + strcpy (text, cam->id.name); + text[0] = ' '; + text[1] = ' '; + } + else if (v3d->persp == V3D_PERSP_ORTHO) + strcpy (text, "Ortho View"); + else + strcpy (text, "Perspective"); + + posx = (winx / 2) - (strlen (text) * 4); + if (G.stamp.camera) + stamp_text (text, posx, 1, data, winx, winy, STAMP_TO_RECT, &posx, &posy); + + strcpy (text, G.scene->id.name); + text[0] = ' '; + text[1] = ' '; + + posx = winx - ((strlen (text) + 1) * 8); + if (G.stamp.scene) + stamp_text (text, posx, 1, data, winx, winy, STAMP_TO_RECT, &posx, &posy); + } +} Index: source/blender/makesdna/DNA_scene_types.h =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_scene_types.h,v retrieving revision 1.106 diff -u -u -r1.106 DNA_scene_types.h --- source/blender/makesdna/DNA_scene_types.h 7 Feb 2007 09:17:57 -0000 1.106 +++ source/blender/makesdna/DNA_scene_types.h 12 Feb 2007 21:18:42 -0000 @@ -274,6 +274,17 @@ float GIshadowquality, GIrefinement, GIpower, GIindirpower; float YF_gamma, YF_exposure, YF_raybias, YF_AApixelsize, YF_AAthreshold; + /* stamp info pad. */ + int stamppad; + + /* stamp user text. */ + char stamp_u_data[128]; + + /* stamp RGB color. */ + float stamp_colorr; + float stamp_colorg; + float stamp_colorb; + /* paths to backbufffer, output, ftype */ char backbuf[160], pic[160], ftype[160]; @@ -512,6 +523,8 @@ #define R_COMP_FREE 0x0800 #define R_NO_IMAGE_LOAD 0x1000 #define R_NO_TEX 0x2000 +#define R_STAMP_INFO 0x4000 +#define R_STAMP_INFO_INV 0x8000 /* alphamode */ Index: source/blender/render/extern/include/RE_pipeline.h =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/render/extern/include/RE_pipeline.h,v retrieving revision 1.24 diff -u -u -r1.24 RE_pipeline.h --- source/blender/render/extern/include/RE_pipeline.h 21 Dec 2006 10:41:43 -0000 1.24 +++ source/blender/render/extern/include/RE_pipeline.h 12 Feb 2007 21:18:44 -0000 @@ -133,6 +133,10 @@ /* calling a new render with same name, frees automatic existing render */ struct Render *RE_NewRender (const char *name); struct Render *RE_GetRender(const char *name); +int RE_GetRenderWidth ( struct Render *r ); +int RE_GetRenderHeight ( struct Render *r ); +char *RE_GetRenderStampInfo ( struct Render *r ); +short RE_GetRenderFrsSec ( struct Render *r ); /* use free render as signal to do everything over (previews) */ void RE_FreeRender (struct Render *re); Index: source/blender/render/intern/source/pipeline.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/render/intern/source/pipeline.c,v retrieving revision 1.115 diff -u -u -r1.115 pipeline.c --- source/blender/render/intern/source/pipeline.c 28 Jan 2007 05:43:12 -0000 1.115 +++ source/blender/render/intern/source/pipeline.c 12 Feb 2007 21:18:49 -0000 @@ -877,6 +877,33 @@ return re; } +int RE_GetRenderWidth ( Render *r ) +{ + if (r) + return (r->winx); + return (0); +} + +int RE_GetRenderHeight ( Render *r ) +{ + if (r) + return (r->winy); + return (0); +} + +char *RE_GetRenderStampInfo ( Render *r ) +{ + if (r) + return (r->r.stamp_u_data); +} + +short RE_GetRenderFrsSec ( Render *r ) +{ + if (r) + return (r->r.frs_sec); + return (0); +} + /* if you want to know exactly what has been done */ RenderResult *RE_GetResult(Render *re) { @@ -2005,6 +2032,9 @@ do_render_composite_fields_blur_3d(re); #endif } + + if (re->r.scemode & R_STAMP_INFO) + BKE_stamp ((void *) re, 0, 0, NULL, STAMP_TO_RENDER); /* for UI only */ renderresult_add_names(re->result); Index: source/blender/src/buttons_scene.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/src/buttons_scene.c,v retrieving revision 1.165 diff -u -u -r1.165 buttons_scene.c --- source/blender/src/buttons_scene.c 20 Jan 2007 08:01:55 -0000 1.165 +++ source/blender/src/buttons_scene.c 12 Feb 2007 21:19:05 -0000 @@ -875,6 +875,33 @@ return block; } +/* Note: this is a block menu, need 0 events, otherwise the menu closes */ +static uiBlock *stamp_render_menu ( void *arg_unused ) +{ + uiBlock *block; + + block = uiNewBlock (&curarea->uiblocks, "stamp render", UI_EMBOSS, UI_HELV, curarea->win); + + /* use this for a fake extra empty space around the buttons. */ + uiDefBut (block, LABEL, 0, "", 0, 0, 140, 60, NULL, 0, 0, 0, 0, ""); + + /* Stamp options buttons. */ + uiDefButS (block, TOG, 1, "Date", 10, 10, 59, 19, &G.stamp.date, 0, 1, 0, 1, "Show Date"); + uiDefButS (block, TOG, 1, "Time", 69, 30, 59, 19, &G.stamp.time, 0, 1, 0, 1, "Show time (HH:MM:SS)"); + uiDefButS (block, TOG, 1, "Frame", 10, 30, 59, 19, &G.stamp.frame, 0, 1, 0, 1, "Show current frame"); + uiDefButS (block, TOG, 1, "Camera", 69, 50, 59, 19, &G.stamp.camera, 0, 1, 0, 1, "Show camera name"); + uiDefButS (block, TOG, 1, "Scene", 10, 50, 59, 19, &G.stamp.scene, 0, 1, 0, 1, "Show scene name"); + + uiDefBut (block, LABEL, 0, "Show: ", 10, 70, 118, 19, NULL, 0, 0, 0, 0, ""); + + uiDefBut (block, TEX, B_NOP, "U:", 10, 90, 118, 19, &G.scene->r.stamp_u_data, 0.0, 128.0, 100, 0, ""); + uiDefButBitS (block, TOG, R_STAMP_INFO_INV, B_REDR,"Inverse Color", 10, 110, 87, 19, &G.scene->r.scemode, 0, 0, 0, 0, "Enable/Disable stamp with inverse color"); + if (!(G.scene->r.scemode & R_STAMP_INFO_INV)) + uiDefButF (block, COL, B_NOP, "", 100, 110, 28, 19, &(G.scene->r.stamp_colorr), 0, 0, 0, 0, "Stamp Color"); + + uiBlockSetDirection (block, UI_TOP); + return (block); +} /* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */ static uiBlock *framing_render_menu(void *arg_unused) @@ -1165,6 +1192,11 @@ /* SET BUTTON */ + uiBlockBeginAlign (block); + uiDefButBitS (block, TOG, R_STAMP_INFO, B_REDR, "Stamp", 100, 114, 70, 20, &G.scene->r.scemode, 0, 0, 0, 0, "Enable/Disable stamp info in render"); + uiDefBlockBut (block, stamp_render_menu, NULL, "Stamp Settings", 170, 114, 140, 20, "Display Stamp settings"); + uiBlockEndAlign (block); + uiBlockBeginAlign(block); id= (ID *)G.scene->set; IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->scene), id, &(G.buts->menunr)); Index: source/blender/src/renderwin.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/src/renderwin.c,v retrieving revision 1.116 diff -u -u -r1.116 renderwin.c --- source/blender/src/renderwin.c 20 Dec 2006 22:41:44 -0000 1.116 +++ source/blender/src/renderwin.c 12 Feb 2007 21:19:09 -0000 @@ -1281,6 +1281,10 @@ break; drawview3d_render(v3d, winx, winy); glReadPixels(0, 0, winx, winy, GL_RGBA, GL_UNSIGNED_BYTE, rr->rect32); + + if (G.scene->r.scemode & R_STAMP_INFO) + BKE_stamp ((void *) rr->rect32, winx, winy, v3d, STAMP_TO_RECT); + window_swap_buffers(render_win->win); if(BKE_imtype_is_movie(G.scene->r.imtype)) { @@ -1320,6 +1324,10 @@ else { drawview3d_render(v3d, winx, winy); glReadPixels(0, 0, winx, winy, GL_RGBA, GL_UNSIGNED_BYTE, rr->rect32); + + if (G.scene->r.scemode & R_STAMP_INFO) + BKE_stamp (rr->rect32, winx, winy, v3d, STAMP_TO_RECT); + window_swap_buffers(render_win->win); }