Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-10-15 23:18:40 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-10-15 23:18:40 +0400
commit5fff9cf6603d4d3d78c0edccc4d6661795c1a1e4 (patch)
tree41b95042d637b7f6a12e76dfe80df5f0408cb1ef /source
parent66725a189e277744f134e4c098c6dbecd979689f (diff)
stamp font size and added rendertime stamp option
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/image.c37
-rw-r--r--source/blender/makesdna/DNA_scene_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_scene.c25
3 files changed, 49 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 09d150341b2..efe53f6f8ef 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -964,6 +964,7 @@ typedef struct StampData {
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 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix)
} 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,7 +1131,12 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
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);
@@ -1166,6 +1186,21 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
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;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index d2e88408f6b..91f8e8d5c41 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -866,7 +866,8 @@ typedef struct Scene {
#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
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 59850216060..b9fd2926ca3 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1280,14 +1280,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
{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 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
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);