From 6d8622ecd09afaac3e4e578e4a694ca8fe696612 Mon Sep 17 00:00:00 2001 From: Thomas Barlow Date: Sun, 31 Dec 2023 01:35:36 +0000 Subject: [PATCH 1/3] Fix #105088: FBX Camera Focus Distance is interpreted as millimeters FBX IO has been converting the Camera `FocusDistance` property from millimeters on import and to millimeters on export, however, this appears to have been incorrect because `FocusDistance` appears to be in meters instead. The FBX SDK used to have deprecated `SetSpecificDistance()` and `GetSpecificDistance()` functions that were documented as accessing Camera Focus Distance in millimeters. The documentation of these functions appears to have been incorrectly attributed to the Camera Focus Distance property itself, which could be accessed directly without the deprecated functions, and appears to be stored in meters. --- io_scene_fbx/export_fbx_bin.py | 2 +- io_scene_fbx/import_fbx.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py index d5a9a1b48..8d1d710f2 100644 --- a/io_scene_fbx/export_fbx_bin.py +++ b/io_scene_fbx/export_fbx_bin.py @@ -686,7 +686,7 @@ def fbx_data_camera_elements(root, cam_obj, scene_data): elem_props_template_set(tmpl, props, "p_double", b"SafeAreaAspectRatio", aspect) # Depth of field and Focus distance. elem_props_template_set(tmpl, props, "p_bool", b"UseDepthOfField", cam_data.dof.use_dof) - elem_props_template_set(tmpl, props, "p_double", b"FocusDistance", cam_data.dof.focus_distance * 1000 * gscale) + elem_props_template_set(tmpl, props, "p_double", b"FocusDistance", cam_data.dof.focus_distance * gscale) # Default to perspective camera. elem_props_template_set(tmpl, props, "p_enum", b"CameraProjectionType", 1 if cam_data.type == 'ORTHO' else 0) elem_props_template_set(tmpl, props, "p_double", b"OrthoZoom", cam_data.ortho_scale) diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py index f306e9039..295b41cee 100644 --- a/io_scene_fbx/import_fbx.py +++ b/io_scene_fbx/import_fbx.py @@ -2169,7 +2169,7 @@ def blen_read_camera(fbx_tmpl, fbx_obj, settings): camera.type = 'ORTHO' if elem_props_get_enum(fbx_props, b'CameraProjectionType', 0) == 1 else 'PERSP' - camera.dof.focus_distance = elem_props_get_number(fbx_props, b'FocusDistance', 10 * 1000) / 1000 * global_scale + camera.dof.focus_distance = elem_props_get_number(fbx_props, b'FocusDistance', 10) * global_scale if (elem_props_get_bool(fbx_props, b'UseDepthOfField', False)): camera.dof.use_dof = True -- 2.30.2 From 88271db4463edfecf28348a71cb313989fd1218d Mon Sep 17 00:00:00 2001 From: Thomas Barlow Date: Tue, 16 Jan 2024 20:42:48 +0000 Subject: [PATCH 2/3] Increase FBX IO version --- io_scene_fbx/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py index 9cfebeae6..7087f1f9a 100644 --- a/io_scene_fbx/__init__.py +++ b/io_scene_fbx/__init__.py @@ -5,7 +5,7 @@ bl_info = { "name": "FBX format", "author": "Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem", - "version": (5, 11, 2), + "version": (5, 11, 3), "blender": (4, 1, 0), "location": "File > Import-Export", "description": "FBX IO meshes, UVs, vertex colors, materials, textures, cameras, lamps and actions", -- 2.30.2 From 24d330503dfa8fd7f81a797f90e94792ccba12bf Mon Sep 17 00:00:00 2001 From: Thomas Barlow Date: Tue, 16 Jan 2024 20:46:48 +0000 Subject: [PATCH 3/3] Increase FBX IO version --- io_scene_fbx/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py index 8f749dc12..6424d3757 100644 --- a/io_scene_fbx/__init__.py +++ b/io_scene_fbx/__init__.py @@ -5,7 +5,7 @@ bl_info = { "name": "FBX format", "author": "Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem", - "version": (5, 11, 4), + "version": (5, 11, 5), "blender": (4, 1, 0), "location": "File > Import-Export", "description": "FBX IO meshes, UVs, vertex colors, materials, textures, cameras, lamps and actions", -- 2.30.2