forked from bartvdbraak/blender
stamp font size and added rendertime stamp option
This commit is contained in:
parent
66725a189e
commit
5fff9cf660
@ -422,6 +422,7 @@ class RENDER_PT_stamp(RenderButtonsPanel):
|
||||
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")
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user