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
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2015-04-21 19:33:33 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-04-21 19:37:06 +0300
commit58c511fb0149339b8942bb2124c215fd70219b63 (patch)
treef00698314b76f2ff59dbda31b3defc45040ce408 /source/blender/blenkernel/intern
parent3091ea49fec8b85b602aa94f229992f78c335b7a (diff)
Stamp refactoring:
Write those on render result during rendering, so we can cleanly write a render result image after rendering.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/image.c56
1 files changed, 37 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index a09c42e9178..88a96ddef18 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2028,26 +2028,45 @@ void BKE_image_stamp_buf(
#undef BUFF_MARGIN_Y
}
-void BKE_imbuf_stamp_info(Scene *scene, Object *camera, struct ImBuf *ibuf)
+void BKE_render_result_stamp_info(Scene *scene, Object *camera, struct RenderResult *rr)
{
- struct StampData stamp_data;
+ struct StampData *stamp_data;
+
+ if (!(scene && scene->r.stamp & R_STAMP_ALL))
+ return;
+
+ if (!rr->stamp_data) {
+ stamp_data = MEM_callocN(sizeof(StampData), "RenderResult.stamp_data");
+ }
+ else {
+ stamp_data = rr->stamp_data;
+ }
- if (!ibuf) return;
+ stampdata(scene, camera, stamp_data, 0);
- /* fill all the data values, no prefix */
- stampdata(scene, camera, &stamp_data, 0);
+ if (!rr->stamp_data) {
+ rr->stamp_data = stamp_data;
+ }
+}
- if (stamp_data.file[0]) IMB_metadata_change_field(ibuf, "File", stamp_data.file);
- if (stamp_data.note[0]) IMB_metadata_change_field(ibuf, "Note", stamp_data.note);
- if (stamp_data.date[0]) IMB_metadata_change_field(ibuf, "Date", stamp_data.date);
- if (stamp_data.marker[0]) IMB_metadata_change_field(ibuf, "Marker", stamp_data.marker);
- if (stamp_data.time[0]) IMB_metadata_change_field(ibuf, "Time", stamp_data.time);
- if (stamp_data.frame[0]) IMB_metadata_change_field(ibuf, "Frame", stamp_data.frame);
- if (stamp_data.camera[0]) IMB_metadata_change_field(ibuf, "Camera", stamp_data.camera);
- if (stamp_data.cameralens[0]) IMB_metadata_change_field(ibuf, "Lens", stamp_data.cameralens);
- if (stamp_data.scene[0]) IMB_metadata_change_field(ibuf, "Scene", stamp_data.scene);
- if (stamp_data.strip[0]) IMB_metadata_change_field(ibuf, "Strip", stamp_data.strip);
- if (stamp_data.rendertime[0]) IMB_metadata_change_field(ibuf, "RenderTime", stamp_data.rendertime);
+
+void BKE_imbuf_stamp_info(RenderResult *rr, struct ImBuf *ibuf)
+{
+ struct StampData *stamp_data = rr->stamp_data;
+
+ if (!ibuf || !stamp_data) return;
+
+ if (stamp_data->file[0]) IMB_metadata_change_field(ibuf, "File", stamp_data->file);
+ if (stamp_data->note[0]) IMB_metadata_change_field(ibuf, "Note", stamp_data->note);
+ if (stamp_data->date[0]) IMB_metadata_change_field(ibuf, "Date", stamp_data->date);
+ if (stamp_data->marker[0]) IMB_metadata_change_field(ibuf, "Marker", stamp_data->marker);
+ if (stamp_data->time[0]) IMB_metadata_change_field(ibuf, "Time", stamp_data->time);
+ if (stamp_data->frame[0]) IMB_metadata_change_field(ibuf, "Frame", stamp_data->frame);
+ if (stamp_data->camera[0]) IMB_metadata_change_field(ibuf, "Camera", stamp_data->camera);
+ if (stamp_data->cameralens[0]) IMB_metadata_change_field(ibuf, "Lens", stamp_data->cameralens);
+ if (stamp_data->scene[0]) IMB_metadata_change_field(ibuf, "Scene", stamp_data->scene);
+ if (stamp_data->strip[0]) IMB_metadata_change_field(ibuf, "Strip", stamp_data->strip);
+ if (stamp_data->rendertime[0]) IMB_metadata_change_field(ibuf, "RenderTime", stamp_data->rendertime);
}
bool BKE_imbuf_alpha_test(ImBuf *ibuf)
@@ -2242,15 +2261,14 @@ int BKE_imbuf_write_as(ImBuf *ibuf, const char *name, ImageFormatData *imf,
return ok;
}
-int BKE_imbuf_write_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, struct ImageFormatData *imf)
+int BKE_imbuf_write_stamp(Scene *scene, struct RenderResult *rr, ImBuf *ibuf, const char *name, struct ImageFormatData *imf)
{
if (scene && scene->r.stamp & R_STAMP_ALL)
- BKE_imbuf_stamp_info(scene, camera, ibuf);
+ BKE_imbuf_stamp_info(rr, ibuf);
return BKE_imbuf_write(ibuf, name, imf);
}
-
static void do_makepicstring(
char *string, const char *base, const char *relbase, int frame, const char imtype,
const ImageFormatData *im_format, const short use_ext, const short use_frames,