[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34302] trunk/blender: feature request from colin levy, camera lens stamp.

Campbell Barton ideasman42 at gmail.com
Thu Jan 13 20:16:37 CET 2011


Revision: 34302
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34302
Author:   campbellbarton
Date:     2011-01-13 19:16:35 +0000 (Thu, 13 Jan 2011)
Log Message:
-----------
feature request from colin levy, camera lens stamp.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_render.py
    trunk/blender/source/blender/blenkernel/intern/image.c
    trunk/blender/source/blender/blenlib/intern/math_rotation.c
    trunk/blender/source/blender/makesdna/DNA_scene_types.h
    trunk/blender/source/blender/makesrna/intern/rna_scene.c
    trunk/blender/source/blender/nodes/intern/CMP_util.h

Modified: trunk/blender/release/scripts/ui/properties_render.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_render.py	2011-01-13 19:01:27 UTC (rev 34301)
+++ trunk/blender/release/scripts/ui/properties_render.py	2011-01-13 19:16:35 UTC (rev 34302)
@@ -588,6 +588,7 @@
         col.prop(rd, "use_stamp_frame", text="Frame")
         col.prop(rd, "use_stamp_scene", text="Scene")
         col.prop(rd, "use_stamp_camera", text="Camera")
+        col.prop(rd, "use_stamp_lens", text="Lens")
         col.prop(rd, "use_stamp_filename", text="Filename")
         col.prop(rd, "use_stamp_marker", text="Marker")
         col.prop(rd, "use_stamp_sequencer_strip", text="Seq. Strip")

Modified: trunk/blender/source/blender/blenkernel/intern/image.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/image.c	2011-01-13 19:01:27 UTC (rev 34301)
+++ trunk/blender/source/blender/blenkernel/intern/image.c	2011-01-13 19:16:35 UTC (rev 34302)
@@ -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 @@
 	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 @@
 	}
 
 	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 @@
 		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,7 +1159,19 @@
 		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]) {
 		BLF_width_and_height(mono, stamp_data.scene, &w, &h); h= h_fixed;
@@ -1195,6 +1221,7 @@
 	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);

Modified: trunk/blender/source/blender/blenlib/intern/math_rotation.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_rotation.c	2011-01-13 19:01:27 UTC (rev 34301)
+++ trunk/blender/source/blender/blenlib/intern/math_rotation.c	2011-01-13 19:16:35 UTC (rev 34302)
@@ -1650,7 +1650,7 @@
 	}
 }
 
-/* lense/angle conversion (radians) */
+/* lens/angle conversion (radians) */
 float lens_to_angle(float lens)
 {
 	return 2.0f * atan(16.0f/lens);

Modified: trunk/blender/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_scene_types.h	2011-01-13 19:01:27 UTC (rev 34301)
+++ trunk/blender/source/blender/makesdna/DNA_scene_types.h	2011-01-13 19:16:35 UTC (rev 34302)
@@ -946,7 +946,8 @@
 #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

Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c	2011-01-13 19:01:27 UTC (rev 34301)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c	2011-01-13 19:16:35 UTC (rev 34302)
@@ -2777,6 +2777,11 @@
 	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);

Modified: trunk/blender/source/blender/nodes/intern/CMP_util.h
===================================================================
--- trunk/blender/source/blender/nodes/intern/CMP_util.h	2011-01-13 19:01:27 UTC (rev 34301)
+++ trunk/blender/source/blender/nodes/intern/CMP_util.h	2011-01-13 19:16:35 UTC (rev 34302)
@@ -164,7 +164,7 @@
 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 */




More information about the Bf-blender-cvs mailing list