[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2587] trunk/py/scripts/addons/ io_scene_fbx/export_fbx.py: write out camera sensor width and height into FBX
Campbell Barton
ideasman42 at gmail.com
Sun Nov 6 03:47:06 CET 2011
Revision: 2587
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2587
Author: campbellbarton
Date: 2011-11-06 02:47:04 +0000 (Sun, 06 Nov 2011)
Log Message:
-----------
write out camera sensor width and height into FBX
Modified Paths:
--------------
trunk/py/scripts/addons/io_scene_fbx/export_fbx.py
Modified: trunk/py/scripts/addons/io_scene_fbx/export_fbx.py
===================================================================
--- trunk/py/scripts/addons/io_scene_fbx/export_fbx.py 2011-11-05 09:25:30 UTC (rev 2586)
+++ trunk/py/scripts/addons/io_scene_fbx/export_fbx.py 2011-11-06 02:47:04 UTC (rev 2587)
@@ -235,6 +235,9 @@
if global_matrix is None:
global_matrix = Matrix()
+ global_scale = 1.0
+ else:
+ global_scale = global_matrix.median_scale
# Use this for working out paths relative to the export location
base_src = os.path.dirname(bpy.data.filepath)
@@ -896,12 +899,14 @@
'\n\t\t\tProperty: "ShowTimeCode", "bool", "",0'
)
- fw('\n\t\t\tProperty: "NearPlane", "double", "",%.6f' % data.clip_start)
- fw('\n\t\t\tProperty: "FarPlane", "double", "",%.6f' % data.clip_end)
+ fw('\n\t\t\tProperty: "NearPlane", "double", "",%.6f' % (data.clip_start * global_scale))
+ fw('\n\t\t\tProperty: "FarPlane", "double", "",%.6f' % (data.clip_end * global_scale))
- fw('\n\t\t\tProperty: "FilmWidth", "double", "",1.0'
- '\n\t\t\tProperty: "FilmHeight", "double", "",1.0'
- )
+ # film width & weight from mm to inches
+ # we could be clever and try use auto/width/hight but for now write
+ # as is.
+ fw('\n\t\t\tProperty: "FilmWidth", "double", "",%.6f' % (global_scale * (data.sensor_width * 0.0393700787)))
+ fw('\n\t\t\tProperty: "FilmHeight", "double", "",%.6f' % (global_scale * (data.sensor_height * 0.0393700787)))
fw('\n\t\t\tProperty: "FilmAspectRatio", "double", "",%.6f' % aspect)
More information about the Bf-extensions-cvs
mailing list