Fix #105088: FBX Camera Focus Distance is interpreted as millimeters #105124

Merged
Thomas Barlow merged 4 commits from Mysteryem/blender-addons:fix_105088_fbx_camera_focus_distance_mm into main 2024-01-16 21:48:22 +01:00
3 changed files with 3 additions and 3 deletions

View File

@ -5,7 +5,7 @@
bl_info = { bl_info = {
"name": "FBX format", "name": "FBX format",
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem", "author": "Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem",
"version": (5, 11, 4), "version": (5, 11, 5),
"blender": (4, 1, 0), "blender": (4, 1, 0),
"location": "File > Import-Export", "location": "File > Import-Export",
"description": "FBX IO meshes, UVs, vertex colors, materials, textures, cameras, lamps and actions", "description": "FBX IO meshes, UVs, vertex colors, materials, textures, cameras, lamps and actions",

View File

@ -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) elem_props_template_set(tmpl, props, "p_double", b"SafeAreaAspectRatio", aspect)
# Depth of field and Focus distance. # 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_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. # 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_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) elem_props_template_set(tmpl, props, "p_double", b"OrthoZoom", cam_data.ortho_scale)

View File

@ -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.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)): if (elem_props_get_bool(fbx_props, b'UseDepthOfField', False)):
camera.dof.use_dof = True camera.dof.use_dof = True