[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23869] trunk/blender: stamp font size and added rendertime stamp option
Campbell Barton
ideasman42 at gmail.com
Thu Oct 15 21:18:42 CEST 2009
Revision: 23869
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23869
Author: campbellbarton
Date: 2009-10-15 21:18:40 +0200 (Thu, 15 Oct 2009)
Log Message:
-----------
stamp font size and added rendertime stamp option
Modified Paths:
--------------
trunk/blender/release/scripts/ui/buttons_render.py
trunk/blender/source/blender/blenkernel/intern/image.c
trunk/blender/source/blender/makesdna/DNA_scene_types.h
trunk/blender/source/blender/makesrna/intern/rna_scene.c
Modified: trunk/blender/release/scripts/ui/buttons_render.py
===================================================================
--- trunk/blender/release/scripts/ui/buttons_render.py 2009-10-15 18:27:41 UTC (rev 23868)
+++ trunk/blender/release/scripts/ui/buttons_render.py 2009-10-15 19:18:40 UTC (rev 23869)
@@ -422,6 +422,7 @@
col = split.column()
col.itemR(rd, "stamp_time", text="Time")
col.itemR(rd, "stamp_date", text="Date")
+ col.itemR(rd, "stamp_render_time", text="RenderTime")
col.itemR(rd, "stamp_frame", text="Frame")
col.itemR(rd, "stamp_scene", text="Scene")
col.itemR(rd, "stamp_camera", text="Camera")
Modified: trunk/blender/source/blender/blenkernel/intern/image.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/image.c 2009-10-15 18:27:41 UTC (rev 23868)
+++ trunk/blender/source/blender/blenkernel/intern/image.c 2009-10-15 19:18:40 UTC (rev 23869)
@@ -964,6 +964,7 @@
char camera[64];
char scene[64];
char strip[64];
+ char rendertime[64];
} StampData;
static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix)
@@ -1087,6 +1088,20 @@
} else {
stamp_data->strip[0] = '\0';
}
+
+ {
+ Render *re= RE_GetRender(scene->id.name);
+ RenderStats *stats= re ? RE_GetStats(re):NULL;
+
+ if (stats && (scene->r.stamp & R_STAMP_RENDERTIME)) {
+ BLI_timestr(stats->lastframetime, text);
+
+ if (do_prefix) sprintf(stamp_data->rendertime, "RenderTime %s", text);
+ else sprintf(stamp_data->rendertime, "%s", text);
+ } else {
+ stamp_data->rendertime[0] = '\0';
+ }
+ }
}
// XXX - Bad level call.
@@ -1116,8 +1131,13 @@
return;
stampdata(scene, &stamp_data, 1);
- stamp_font_begin(12);
+ /* TODO, do_versions */
+ if(scene->r.stamp_font_id < 8)
+ scene->r.stamp_font_id= 12;
+
+ stamp_font_begin(scene->r.stamp_font_id);
+
BLF_buffer(rectf, rect, width, height, channels);
BLF_buffer_col(scene->r.fg_stamp[0], scene->r.fg_stamp[1], scene->r.fg_stamp[2], 1.0);
pad= BLF_width("--");
@@ -1166,8 +1186,23 @@
BLF_position(x, y, 0.0);
BLF_draw_buffer(stamp_data.date);
+
+ /* the extra pixel for background. */
+ y -= 4;
}
+ /* Top left corner, below File, Date or Note */
+ if (stamp_data.rendertime[0]) {
+ BLF_width_and_height(stamp_data.rendertime, &w, &h);
+ y -= h;
+
+ /* and space for background. */
+ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-3, w+3, y+h+3);
+
+ BLF_position(x, y, 0.0);
+ BLF_draw_buffer(stamp_data.rendertime);
+ }
+
x= 0;
y= 0;
Modified: trunk/blender/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_scene_types.h 2009-10-15 18:27:41 UTC (rev 23868)
+++ trunk/blender/source/blender/makesdna/DNA_scene_types.h 2009-10-15 19:18:40 UTC (rev 23869)
@@ -866,7 +866,8 @@
#define R_STAMP_MARKER 0x0080
#define R_STAMP_FILENAME 0x0100
#define R_STAMP_SEQSTRIP 0x0200
-#define R_STAMP_ALL (R_STAMP_TIME|R_STAMP_FRAME|R_STAMP_DATE|R_STAMP_CAMERA|R_STAMP_SCENE|R_STAMP_NOTE|R_STAMP_MARKER|R_STAMP_FILENAME|R_STAMP_SEQSTRIP)
+#define R_STAMP_RENDERTIME 0x0400
+#define R_STAMP_ALL (R_STAMP_TIME|R_STAMP_FRAME|R_STAMP_DATE|R_STAMP_CAMERA|R_STAMP_SCENE|R_STAMP_NOTE|R_STAMP_MARKER|R_STAMP_FILENAME|R_STAMP_SEQSTRIP|R_STAMP_RENDERTIME)
/* alphamode */
#define R_ADDSKY 0
Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c 2009-10-15 18:27:41 UTC (rev 23868)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c 2009-10-15 19:18:40 UTC (rev 23869)
@@ -1280,14 +1280,6 @@
{0, "THREADS_AUTO", 0, "Auto-detect", "Automatically determine the number of threads, based on CPUs"},
{R_FIXED_THREADS, "THREADS_FIXED", 0, "Fixed", "Manually determine the number of threads"},
{0, NULL, 0, NULL, NULL}};
-
- static EnumPropertyItem stamp_font_size_items[] = {
- {1, "STAMP_FONT_TINY", 0, "Tiny", ""},
- {2, "STAMP_FONT_SMALL", 0, "Small", ""},
- {3, "STAMP_FONT_MEDIUM", 0, "Medium", ""},
- {0, "STAMP_FONT_LARGE", 0, "Large", ""},
- {4, "STAMP_FONT_EXTRALARGE", 0, "Extra Large", ""},
- {0, NULL, 0, NULL, NULL}};
static EnumPropertyItem image_type_items[] = {
{0, "", 0, "Image", NULL},
@@ -2005,23 +1997,28 @@
RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_SEQSTRIP);
RNA_def_property_ui_text(prop, "Stamp Sequence Strip", "Include the name of the foreground sequence strip in image metadata");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ prop= RNA_def_property(srna, "stamp_render_time", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_RENDERTIME);
+ RNA_def_property_ui_text(prop, "Stamp Render Time", "Include the render time in the stamp image");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
prop= RNA_def_property(srna, "stamp_note_text", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "stamp_udata");
RNA_def_property_ui_text(prop, "Stamp Note Text", "Custom text to appear in the stamp note");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
+
prop= RNA_def_property(srna, "render_stamp", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_DRAW);
RNA_def_property_ui_text(prop, "Render Stamp", "Render the stamp info text in the rendered image");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
- prop= RNA_def_property(srna, "stamp_font_size", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "stamp_font_id");
- RNA_def_property_enum_items(prop, stamp_font_size_items);
- RNA_def_property_ui_text(prop, "Stamp Font Size", "Size of the font used when rendering stamp text");
+ prop= RNA_def_property(srna, "stamp_font_size", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "stamp_font_id");
+ RNA_def_property_range(prop, 8, 64);
+ RNA_def_property_ui_text(prop, "Font Size", "Size of the font used when rendering stamp text");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
+
prop= RNA_def_property(srna, "stamp_foreground", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "fg_stamp");
RNA_def_property_array(prop, 4);
More information about the Bf-blender-cvs
mailing list