diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-01-13 22:16:35 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-01-13 22:16:35 +0300 |
commit | 4cc4a73a9e228e0eee682a5220c3ed77572f02af (patch) | |
tree | a8a3564e0e1891415788fbdd2d03d576b46a1246 /source/blender/blenkernel/intern/image.c | |
parent | 1939ad3f94bfbe9a36a868b85ab6e3c23afeb532 (diff) |
feature request from colin levy, camera lens stamp.
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index d8876705ebb..3d69f51851f 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -54,6 +54,7 @@ #include "DNA_packedFile_types.h" #include "DNA_scene_types.h" +#include "DNA_object_types.h" #include "DNA_camera_types.h" #include "DNA_sequence_types.h" #include "DNA_userdef_types.h" @@ -859,6 +860,7 @@ typedef struct StampData { char time[512]; char frame[512]; char camera[64]; + char cameralens[64]; char scene[64]; char strip[64]; char rendertime[64]; @@ -955,7 +957,7 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix) } if (scene->r.stamp & R_STAMP_CAMERA) { - if (scene->camera) strcpy(text, ((Camera *) scene->camera)->id.name+2); + if (scene->camera) strcpy(text, scene->camera->id.name+2); else strcpy(text, "<none>"); if (do_prefix) sprintf(stamp_data->camera, "Camera %s", text); @@ -964,6 +966,18 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix) stamp_data->camera[0] = '\0'; } + if (scene->r.stamp & R_STAMP_CAMERALENS) { + if (scene->camera && scene->camera->type == OB_CAMERA) { + sprintf(text, "%.2f", ((Camera *)scene->camera->data)->lens); + } + else strcpy(text, "<none>"); + + if (do_prefix) sprintf(stamp_data->cameralens, "Lens %s", text); + else sprintf(stamp_data->cameralens, "%s", text); + } else { + stamp_data->cameralens[0] = '\0'; + } + if (scene->r.stamp & R_STAMP_SCENE) { if (do_prefix) sprintf(stamp_data->scene, "Scene %s", scene->id.name+2); else sprintf(stamp_data->scene, "%s", scene->id.name+2); @@ -1145,6 +1159,18 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2); BLF_position(mono, x, y+3, 0.0); BLF_draw_buffer(mono, stamp_data.camera); + + /* space width. */ + x += w + pad; + } + + if (stamp_data.cameralens[0]) { + BLF_width_and_height(mono, stamp_data.cameralens, &w, &h); h= h_fixed; + + /* extra space for background. */ + buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2); + BLF_position(mono, x, y+3, 0.0); + BLF_draw_buffer(mono, stamp_data.cameralens); } if (stamp_data.scene[0]) { @@ -1195,6 +1221,7 @@ void BKE_stamp_info(Scene *scene, struct ImBuf *ibuf) 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); |