[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2610] trunk/py/scripts/addons/ io_scene_fbx/export_fbx.py: patch [#25979] fixes for addons/io_scene_fbx, io_scene_x3d

Campbell Barton ideasman42 at gmail.com
Mon Nov 14 10:37:38 CET 2011


Revision: 2610
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2610
Author:   campbellbarton
Date:     2011-11-14 09:37:37 +0000 (Mon, 14 Nov 2011)
Log Message:
-----------
patch [#25979] fixes for addons/io_scene_fbx, io_scene_x3d
from Filiciss Muhgue (filiciss)

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-13 19:52:23 UTC (rev 2609)
+++ trunk/py/scripts/addons/io_scene_fbx/export_fbx.py	2011-11-14 09:37:37 UTC (rev 2610)
@@ -849,21 +849,28 @@
         aspect = width / height
 
         data = my_cam.blenObject.data
+        # film width & height from mm to inches
+        filmwidth = data.sensor_width * 0.0393700787
+        filmheight = data.sensor_height * 0.0393700787
+        filmaspect = filmwidth / filmheight
+        # film offset
+        offsetx = filmwidth * data.shift_x
+        offsety = filmaspect * filmheight * data.shift_y
 
         fw('\n\tModel: "Model::%s", "Camera" {' % my_cam.fbxName)
         fw('\n\t\tVersion: 232')
         loc, rot, scale, matrix, matrix_rot = write_object_props(my_cam.blenObject, None, my_cam.parRelMatrix())
 
         fw('\n\t\t\tProperty: "Roll", "Roll", "A+",0')
-        fw('\n\t\t\tProperty: "FieldOfView", "FieldOfView", "A+",%.6f' % math.degrees(data.angle))
+        fw('\n\t\t\tProperty: "FieldOfView", "FieldOfView", "A+",%.6f' % math.degrees(data.angle_y))
 
         fw('\n\t\t\tProperty: "FieldOfViewX", "FieldOfView", "A+",1'
            '\n\t\t\tProperty: "FieldOfViewY", "FieldOfView", "A+",1'
            )
 
-        # fw('\n\t\t\tProperty: "FocalLength", "Real", "A+",14.0323972702026')
-        fw('\n\t\t\tProperty: "OpticalCenterX", "Real", "A+",%.6f' % data.shift_x)  # not sure if this is in the correct units?
-        fw('\n\t\t\tProperty: "OpticalCenterY", "Real", "A+",%.6f' % data.shift_y)  # ditto
+        fw('\n\t\t\tProperty: "FocalLength", "Number", "A+",%.6f' % data.lens)
+        fw('\n\t\t\tProperty: "FilmOffsetX", "Number", "A+",%.6f' % offsetx)
+        fw('\n\t\t\tProperty: "FilmOffsetY", "Number", "A+",%.6f' % offsety)
 
         fw('\n\t\t\tProperty: "BackgroundColor", "Color", "A+",0,0,0'
            '\n\t\t\tProperty: "TurnTable", "Real", "A+",0'
@@ -872,7 +879,7 @@
            '\n\t\t\tProperty: "UseMotionBlur", "bool", "",0'
            '\n\t\t\tProperty: "UseRealTimeMotionBlur", "bool", "",1'
            '\n\t\t\tProperty: "ResolutionMode", "enum", "",0'
-           '\n\t\t\tProperty: "ApertureMode", "enum", "",2'
+           '\n\t\t\tProperty: "ApertureMode", "enum", "",3' # horizontal - Houdini compatible
            '\n\t\t\tProperty: "GateFit", "enum", "",2'
            '\n\t\t\tProperty: "CameraFormat", "enum", "",0'
            )
@@ -889,7 +896,7 @@
 
         Definition at line 234 of file kfbxcamera.h. '''
 
-        fw('\n\t\t\tProperty: "PixelAspectRatio", "double", "",2'
+        fw('\n\t\t\tProperty: "PixelAspectRatio", "double", "",1'
            '\n\t\t\tProperty: "UseFrameColor", "bool", "",0'
            '\n\t\t\tProperty: "FrameColor", "ColorRGB", "",0.3,0.3,0.3'
            '\n\t\t\tProperty: "ShowName", "bool", "",1'
@@ -901,15 +908,11 @@
 
         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", "",%.6f' % filmwidth)
+        fw('\n\t\t\tProperty: "FilmHeight", "double", "",%.6f' % filmheight)
+        fw('\n\t\t\tProperty: "FilmAspectRatio", "double", "",%.6f' % filmaspect)
 
-        # 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)
-
         fw('\n\t\t\tProperty: "FilmSqueezeRatio", "double", "",1'
            '\n\t\t\tProperty: "FilmFormatIndex", "enum", "",0'
            '\n\t\t\tProperty: "ViewFrustum", "bool", "",1'



More information about the Bf-extensions-cvs mailing list