From 578a37005a58e20cb28d8485cd20201448cca3bd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 14 Nov 2011 09:37:37 +0000 Subject: patch [#25979] fixes for addons/io_scene_fbx, io_scene_x3d from Filiciss Muhgue (filiciss) --- io_scene_fbx/export_fbx.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/io_scene_fbx/export_fbx.py b/io_scene_fbx/export_fbx.py index 6b2e4043..af4c7e6a 100644 --- a/io_scene_fbx/export_fbx.py +++ b/io_scene_fbx/export_fbx.py @@ -849,21 +849,28 @@ def save_single(operator, scene, filepath="", 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 @@ def save_single(operator, scene, filepath="", '\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 @@ def save_single(operator, scene, filepath="", 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,14 +908,10 @@ def save_single(operator, scene, filepath="", 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)) - - # 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: "FilmWidth", "double", "",%.6f' % filmwidth) + fw('\n\t\t\tProperty: "FilmHeight", "double", "",%.6f' % filmheight) + fw('\n\t\t\tProperty: "FilmAspectRatio", "double", "",%.6f' % filmaspect) fw('\n\t\t\tProperty: "FilmSqueezeRatio", "double", "",1' '\n\t\t\tProperty: "FilmFormatIndex", "enum", "",0' -- cgit v1.2.3