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>2011-01-13 22:16:35 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-13 22:16:35 +0300
commit4cc4a73a9e228e0eee682a5220c3ed77572f02af (patch)
treea8a3564e0e1891415788fbdd2d03d576b46a1246 /source
parent1939ad3f94bfbe9a36a868b85ab6e3c23afeb532 (diff)
feature request from colin levy, camera lens stamp.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/image.c29
-rw-r--r--source/blender/blenlib/intern/math_rotation.c2
-rw-r--r--source/blender/makesdna/DNA_scene_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_scene.c5
-rw-r--r--source/blender/nodes/intern/CMP_util.h2
5 files changed, 37 insertions, 4 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);
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 6799fef3b5c..28a37d9675a 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -1650,7 +1650,7 @@ void vec_apply_track(float vec[3], short axis)
}
}
-/* lense/angle conversion (radians) */
+/* lens/angle conversion (radians) */
float lens_to_angle(float lens)
{
return 2.0f * atan(16.0f/lens);
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index de589f27abc..93fe0f0b4e5 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -946,7 +946,8 @@ typedef struct Scene {
#define R_STAMP_FILENAME 0x0100
#define R_STAMP_SEQSTRIP 0x0200
#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)
+#define R_STAMP_CAMERALENS 0x0800
+#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|R_STAMP_CAMERALENS)
/* alphamode */
#define R_ADDSKY 0
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 13a46e08814..3372055ee3e 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2777,6 +2777,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERA);
RNA_def_property_ui_text(prop, "Stamp Camera", "Include the name of the active camera in image metadata");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ prop= RNA_def_property(srna, "use_stamp_lens", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERALENS);
+ RNA_def_property_ui_text(prop, "Stamp Lens", "Include the name of the active cameras lens in image metadata");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
prop= RNA_def_property(srna, "use_stamp_scene", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_SCENE);
diff --git a/source/blender/nodes/intern/CMP_util.h b/source/blender/nodes/intern/CMP_util.h
index 1f91ee8a457..df583767f76 100644
--- a/source/blender/nodes/intern/CMP_util.h
+++ b/source/blender/nodes/intern/CMP_util.h
@@ -164,7 +164,7 @@ void convolve(CompBuf* dst, CompBuf* in1, CompBuf* in2);
extern void node_ID_title_cb(void *node_v, void *unused_v);
-/* utility functions used by glare, tonemap and lense distortion */
+/* utility functions used by glare, tonemap and lens distortion */
/* soms macros for color handling */
typedef float fRGB[4];
/* clear color */