[Bf-extensions-cvs] [0f8265a] dxf_import: FBX IO: Minor changes/fixes to cameras.

Bastien Montagne noreply at git.blender.org
Fri Aug 15 12:38:31 CEST 2014


Commit: 0f8265a816fe191550d796a5719dc827bc9f02d7
Author: Bastien Montagne
Date:   Thu Aug 14 17:55:40 2014 +0200
Branches: dxf_import
https://developer.blender.org/rBA0f8265a816fe191550d796a5719dc827bc9f02d7

FBX IO: Minor changes/fixes to cameras.

===================================================================

M	io_scene_fbx/export_fbx_bin.py
M	io_scene_fbx/import_fbx.py

===================================================================

diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index 857b8a8..d8c6438 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -649,7 +649,7 @@ def fbx_data_camera_elements(root, cam_obj, scene_data):
     elem_props_template_set(tmpl, props, "p_color", b"BackgroundColor", (0.0, 0.0, 0.0))
     elem_props_template_set(tmpl, props, "p_bool", b"DisplayTurnTableIcon", True)
 
-    elem_props_template_set(tmpl, props, "p_double", b"AspectRatioMode", 1.0)  # FixedRatio
+    elem_props_template_set(tmpl, props, "p_enum", b"AspectRatioMode", 2)  # FixedResolution
     elem_props_template_set(tmpl, props, "p_double", b"AspectWidth", float(render.resolution_x))
     elem_props_template_set(tmpl, props, "p_double", b"AspectHeight", float(render.resolution_y))
     elem_props_template_set(tmpl, props, "p_double", b"PixelAspectRatio",
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index 7e85608..353c294 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -1355,10 +1355,14 @@ def blen_read_camera(fbx_tmpl, fbx_obj, global_scale):
 
     camera = bpy.data.cameras.new(name=elem_name_utf8)
 
+    camera.type = 'ORTHO' if elem_props_get_enum(fbx_props, b'CameraProjectionType', 0) == 1 else 'PERSP'
+
     camera.lens = elem_props_get_number(fbx_props, b'FocalLength', 35.0)
     camera.sensor_width = elem_props_get_number(fbx_props, b'FilmWidth', 32.0 * M2I) / M2I
     camera.sensor_height = elem_props_get_number(fbx_props, b'FilmHeight', 32.0 * M2I) / M2I
 
+    camera.ortho_scale = elem_props_get_number(fbx_props, b'OrthoZoom', 1.0)
+
     filmaspect = camera.sensor_width / camera.sensor_height
     # film offset
     camera.shift_x = elem_props_get_number(fbx_props, b'FilmOffsetX', 0.0) / (M2I * camera.sensor_width)



More information about the Bf-extensions-cvs mailing list