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 <bastien@blender.org>2020-11-25 14:26:09 +0300
committerBastien Montagne <bastien@blender.org>2020-11-25 14:26:09 +0300
commit1a9a9d008dea3fab2bdfd04a57bcdd364ae5d0b8 (patch)
tree19c270226650894d4035602d5ab5d2bbac743738 /io_scene_fbx
parent46590bb7800eea5aa1826f6e9305d7e0320829be (diff)
FBX export: Add an option to disable global space transform.
Allow to disable the rotation matrix that is applied to the object transforms during export. With this option disabled only the axis system is written to the fbx file, but the object transforms are left as-is. This leaves it up to the importer on the other side to apply the space transform during import. Unity has added an import option to apply space transform on import in its latest version, but the current version of setting the axis system in the fbx file and applying the matrix causes unexpected behaviour. Most users will expect that Blender has a forward direction of -Y and an up direction of +Z (Suzanne is looking in the -Y direction and the "front" view is coming from the -Y direction). But if you set the axis conversion to -Y and +Z the exporter will apply a 180° rotation because it assumes a forward direction of +Y. When done this way, using the new Unity import setting, the mesh will be imported correctly in Unity, but the rotation of the root objects will contain that 180° rotation. Using the +Y and +Z axes during export will import everything without any rotations, but what the user expects to be forward will now be pointing the other direction in Unity. When we just write the axis system as -Y and +Z to the fbx file and leave the rotations of the root objects untouched, we can effectively define any foward axis and have it still be imported correctly, because every conversion will be done on Unitys side. Reviewed By: mont29 Differential Revision: https://developer.blender.org/D8078
Diffstat (limited to 'io_scene_fbx')
-rw-r--r--io_scene_fbx/__init__.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index e5fa3284..71ae6ec3 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -21,7 +21,7 @@
bl_info = {
"name": "FBX format",
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
- "version": (4, 21, 3),
+ "version": (4, 22, 0),
"blender": (2, 90, 0),
"location": "File > Import-Export",
"description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
@@ -426,6 +426,13 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
"(Blender uses FBX scale to detect units on import, "
"but many other applications do not handle the same way)",
)
+
+ use_space_transform: BoolProperty(
+ name="Use Space Transform",
+ description="Apply global space transform to the object rotations. When disabled "
+ "only the axis space is written to the file and all object transforms are left as-is",
+ default=True,
+ )
bake_space_transform: BoolProperty(
name="Apply Transform",
description="Bake space transform into object data, avoids getting unwanted rotations to objects when "
@@ -623,7 +630,8 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
global_matrix = (axis_conversion(to_forward=self.axis_forward,
to_up=self.axis_up,
- ).to_4x4())
+ ).to_4x4()
+ if self.use_space_transform else Matrix())
keywords = self.as_keywords(ignore=("check_existing",
"filter_glob",
@@ -727,6 +735,7 @@ class FBX_PT_export_transform(bpy.types.Panel):
layout.prop(operator, "axis_up")
layout.prop(operator, "apply_unit_scale")
+ layout.prop(operator, "use_space_transform")
row = layout.row()
row.prop(operator, "bake_space_transform")
row.label(text="", icon='ERROR')