diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-04-30 09:26:09 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-04-30 09:26:09 +0400 |
commit | c4c22d4e9f5f0ab11412a1d22b3f405411389379 (patch) | |
tree | 27bcf173f0c32acddc0d89175b69115dc74b6a49 /source/blender/blenkernel/intern | |
parent | abcdf9573afd4c7ca81d9b1a1f6767e0fe81bdf3 (diff) |
- pass the camera to the render stamp function.
- add BKE_write_ibuf_stamp() since saving environment maps & screen shots shouldn't have stamp.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 29 |
2 files changed, 20 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 94fbcd9ccb4..6813d5d18a6 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1905,7 +1905,9 @@ static void dag_scene_flush_layers(Scene *sce, int lay) } /* ensure cameras are set as if they are on a visible layer, because - they ared still used for rendering or setting the camera view */ + * they ared still used for rendering or setting the camera view + * + * XXX, this wont work for local view / unlocked camera's */ if(sce->camera) { node= dag_get_node(sce->theDag, sce->camera); node->scelay |= lay; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index c44634fed34..bb99843b3b3 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -880,7 +880,7 @@ typedef struct StampData { char rendertime[64]; } StampData; -static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix) +static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int do_prefix) { char text[256]; struct tm *tl; @@ -959,14 +959,14 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix) } if (scene->r.stamp & R_STAMP_CAMERA) { - BLI_snprintf(stamp_data->camera, sizeof(stamp_data->camera), do_prefix ? "Camera %s":"%s", scene->camera ? scene->camera->id.name+2 : "<none>"); + BLI_snprintf(stamp_data->camera, sizeof(stamp_data->camera), do_prefix ? "Camera %s":"%s", camera ? camera->id.name+2 : "<none>"); } else { stamp_data->camera[0] = '\0'; } if (scene->r.stamp & R_STAMP_CAMERALENS) { - if (scene->camera && scene->camera->type == OB_CAMERA) { - BLI_snprintf(text, sizeof(text), "%.2f", ((Camera *)scene->camera->data)->lens); + if (camera && camera->type == OB_CAMERA) { + BLI_snprintf(text, sizeof(text), "%.2f", ((Camera *)camera->data)->lens); } else strcpy(text, "<none>"); @@ -1006,7 +1006,7 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix) } } -void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, int height, int channels) +void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels) { struct StampData stamp_data; float w, h, pad; @@ -1017,7 +1017,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i if (!rect && !rectf) return; - stampdata(scene, &stamp_data, 1); + stampdata(scene, camera, &stamp_data, 1); /* TODO, do_versions */ if(scene->r.stamp_font_id < 8) @@ -1199,14 +1199,14 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i BLF_buffer(mono, NULL, NULL, 0, 0, 0); } -void BKE_stamp_info(Scene *scene, struct ImBuf *ibuf) +void BKE_stamp_info(Scene *scene, Object *camera, struct ImBuf *ibuf) { struct StampData stamp_data; if (!ibuf) return; /* fill all the data values, no prefix */ - stampdata(scene, &stamp_data, 0); + stampdata(scene, camera, &stamp_data, 0); 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); @@ -1244,7 +1244,7 @@ int BKE_alphatest_ibuf(ImBuf *ibuf) return FALSE; } -int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality) +int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality) { int ok; (void)subimtype; /* quies unused warnings */ @@ -1339,9 +1339,6 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int } BLI_make_existing_file(name); - - if(scene && scene->r.stamp & R_STAMP_ALL) - BKE_stamp_info(scene, ibuf); ok = IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat); if (ok == 0) { @@ -1351,6 +1348,14 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int return(ok); } +int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality) +{ + if(scene && scene->r.stamp & R_STAMP_ALL) + BKE_stamp_info(scene, camera, ibuf); + + return BKE_write_ibuf(ibuf, name, imtype, subimtype, quality); +} + void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames) { |