Page MenuHome

Added an option to disable space transforms for object rotation
ClosedPublic

Authored by Michael Freundorfer (mordecai) on Jun 19 2020, 5:32 PM.

Details

Summary

I added an option to the fbx exporter 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 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 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. With this patch and Unitys new import option it feels like the first time that using fbx between Unity and Blender works without issues regarding axis conversion.

I also changed the bake_space_transform naming in the UI back to "Bake Transform" to differentiate the two options. But there may be better names for these two options.

Diff Detail

Event Timeline

Michael Freundorfer (mordecai) requested review of this revision.Jun 19 2020, 5:32 PM
Michael Freundorfer (mordecai) created this revision.
Bastien Montagne (mont29) requested changes to this revision.Nov 20 2020, 3:19 PM
Bastien Montagne (mont29) added inline comments.
io_scene_fbx/__init__.py
431

"Apply Global Transform" or "Apply Space Transform" ? better not reuse same exact name for a different option, can be confusing for users.

432

global

433

object transforms

This revision now requires changes to proceed.Nov 20 2020, 3:19 PM

Updated the option names and fixed the tooltip.

I decided on "Use Space Transform" because it decides if the space transform is used at all and "Apply Transform" for if the space transform applied to the mesh data, etc. ("Apply Space Transform" was too long with the warning icon at the end)

This revision is now accepted and ready to land.Nov 25 2020, 12:13 PM