Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2015-06-15 17:31:12 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-06-15 17:31:12 +0300
commit15ec348c417d7fc7dd47216d55b1b16926cb67e4 (patch)
tree907611ded69470349f3627ea2e449e66d25e30a6 /io_scene_fbx/fbx_utils.py
parent6ee73835f0f448008ff69a2ac8eb0b6a20567c62 (diff)
Fix T45080: Scale of exported .fbx is wrong in 2.75.
Man... this scaling issue becomes ridiculous! Tried to fix it again also regarding (what is supposed to be) FBX scale/units handling. Since we store Blender's unit system (with 1BU == 1m in case of none) as the UnitScaleFactor element, we actually *do not* have to also scale objects themselves... In theory. Since I have to wait hours here to get my UE4 repo updated and rebuild the monster, comitting this now, we'll see later for FBXSDK behavior.
Diffstat (limited to 'io_scene_fbx/fbx_utils.py')
-rw-r--r--io_scene_fbx/fbx_utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/io_scene_fbx/fbx_utils.py b/io_scene_fbx/fbx_utils.py
index 4cf46ffb..05420998 100644
--- a/io_scene_fbx/fbx_utils.py
+++ b/io_scene_fbx/fbx_utils.py
@@ -198,6 +198,14 @@ else:
pass
+# 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...
+# Note that when no default unit is available, we assume 'meters' (and hence scale by 100).
+def units_blender_to_fbx_factor(scene):
+ return 100.0 if (scene.unit_settings.system == 'NONE') else (100.0 * scene.unit_settings.scale_length)
+
+
# Note: this could be in a utility (math.units e.g.)...
UNITS = {