[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2743] trunk/py/scripts/addons/ io_anim_nuke_chan: Updated to use the sensor size in blender 2.61
Michael Krupa
kroopson at wp.pl
Tue Dec 6 14:38:18 CET 2011
Revision: 2743
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2743
Author: kroopson
Date: 2011-12-06 13:38:12 +0000 (Tue, 06 Dec 2011)
Log Message:
-----------
Updated to use the sensor size in blender 2.61
Modified Paths:
--------------
trunk/py/scripts/addons/io_anim_nuke_chan/export_nuke_chan.py
trunk/py/scripts/addons/io_anim_nuke_chan/import_nuke_chan.py
Modified: trunk/py/scripts/addons/io_anim_nuke_chan/export_nuke_chan.py
===================================================================
--- trunk/py/scripts/addons/io_anim_nuke_chan/export_nuke_chan.py 2011-12-06 12:24:18 UTC (rev 2742)
+++ trunk/py/scripts/addons/io_anim_nuke_chan/export_nuke_chan.py 2011-12-06 13:38:12 UTC (rev 2743)
@@ -73,13 +73,21 @@
# if we have a camera, add the focal length
if obj.type == 'CAMERA':
- # I've found via the experiments that this is a blenders
- # default sensor size (in mm)
- sensor_x = 32.0
- # the vertical sensor size we get by multiplying the sensor_x by
- # resolution ratio
- sensor_y = sensor_x * res_ratio
+ sensor_x = 0
+ sensor_y = 0
+ if hasattr(obj.data, "sensor_width"): # Preserve compatibility
+ if obj.data.sensor_fit == 'VERTICAL':
+ sensor_x = obj.data.sensor_width
+ sensor_y = obj.data.sensor_height
+ else:
+ sensor_x = obj.data.sensor_width
+ sensor_y = sensor_x * res_ratio
+ else:
+ sensor_x = 32 # standard blender's sensor size
+ sensor_y = sensor_x * res_ratio
+
cam_lens = obj.data.lens
+
# calculate the vertical field of view
# we know the vertical size of (virtual) sensor, the focal length
# of the camera so all we need to do is to feed this data to
Modified: trunk/py/scripts/addons/io_anim_nuke_chan/import_nuke_chan.py
===================================================================
--- trunk/py/scripts/addons/io_anim_nuke_chan/import_nuke_chan.py 2011-12-06 12:24:18 UTC (rev 2742)
+++ trunk/py/scripts/addons/io_anim_nuke_chan/import_nuke_chan.py 2011-12-06 13:38:12 UTC (rev 2743)
@@ -106,9 +106,19 @@
# check if the object is camera and fov data is present
if obj.type == 'CAMERA' and len(data) > 7:
v_fov = float(data[7])
- sensor_v = 32.0
- sensor_h = sensor_v * res_ratio
- lenslen = ((sensor_h / 2.0) / tan(radians(v_fov / 2.0)))
+ sensor_x = 0
+ sensor_y = 0
+ if hasattr(obj.data, "sensor_width"): # Preserve compatibility
+ if obj.data.sensor_fit == 'VERTICAL':
+ sensor_x = obj.data.sensor_width
+ sensor_y = obj.data.sensor_height
+ else:
+ sensor_x = obj.data.sensor_width
+ sensor_y = sensor_x * res_ratio
+ else:
+ sensor_x = 32 # standard blender's sensor size
+ sensor_y = sensor_x * res_ratio
+ lenslen = ((sensor_y / 2.0) / tan(radians(v_fov / 2.0)))
obj.data.lens = lenslen
obj.data.keyframe_insert("lens")
filehandle.close()
More information about the Bf-extensions-cvs
mailing list