diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-05-19 16:42:24 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-05-19 16:42:24 +0300 |
commit | 87e95103c5165634eead5e6a2cdb7c68079f26db (patch) | |
tree | 7347265f45b098a5cb5df3e69cedbed6f27268fd /io_scene_fbx/export_fbx_bin.py | |
parent | f30fc86ab552f193b891bbb68317b0c123e73b75 (diff) |
FBX Export: Hopefully fix once and for all default scale issue.
Now, we consider default BU as 1 meter (100 FBX units), instead of 1 FBX unit (1cm)...
Diffstat (limited to 'io_scene_fbx/export_fbx_bin.py')
-rw-r--r-- | io_scene_fbx/export_fbx_bin.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py index e1ed2edf..ff8581c8 100644 --- a/io_scene_fbx/export_fbx_bin.py +++ b/io_scene_fbx/export_fbx_bin.py @@ -2602,7 +2602,7 @@ def fbx_header_elements(root, scene_data, time=None): props = elem_properties(global_settings) up_axis, front_axis, coord_axis = RIGHT_HAND_AXES[scene_data.settings.to_axes] # Currently not sure about that, but looks like default unit of FBX is cm... - #~ scale_factor = (1.0 if scene.unit_settings.system == 'NONE' else scene.unit_settings.scale_length) * 100 * scene_data.settings.global_scale + scale_factor_org = 100.0 if (scene.unit_settings.system == 'NONE') else (100.0 * scene.unit_settings.scale_length) scale_factor = scene_data.settings.global_scale elem_props_set(props, "p_integer", b"UpAxis", up_axis[0]) elem_props_set(props, "p_integer", b"UpAxisSign", up_axis[1]) @@ -2613,7 +2613,7 @@ def fbx_header_elements(root, scene_data, time=None): elem_props_set(props, "p_integer", b"OriginalUpAxis", -1) elem_props_set(props, "p_integer", b"OriginalUpAxisSign", 1) elem_props_set(props, "p_double", b"UnitScaleFactor", scale_factor) - elem_props_set(props, "p_double", b"OriginalUnitScaleFactor", 1.0) + elem_props_set(props, "p_double", b"OriginalUnitScaleFactor", scale_factor_org) elem_props_set(props, "p_color_rgb", b"AmbientColor", (0.0, 0.0, 0.0)) elem_props_set(props, "p_string", b"DefaultCamera", "Producer Perspective") @@ -2825,8 +2825,9 @@ def save_single(operator, scene, filepath="", # Scale/unit mess. FBX can store the 'reference' unit of a file in its UnitScaleFactor property # (1.0 meaning centimeter, afaik). We use that to reflect user's default unit as set in Blender with scale_length. # However, we always get values in BU (i.e. meters), so we have to reverse-apply that scale in global matrix... - if scene.unit_settings.system != 'NONE': - global_matrix = global_matrix * Matrix.Scale(1.0 / scene.unit_settings.scale_length, 4) + # Note that when no default unit is available, we assume 'meters' (and hence scale by 100). + scale_correction = 100.0 if (scene.unit_settings.system == 'NONE') else (100.0 * scene.unit_settings.scale_length) + global_matrix = global_matrix * Matrix.Scale(scale_correction, 4) global_scale = global_matrix.median_scale global_matrix_inv = global_matrix.inverted() # For transforming mesh normals. |