Search Unity

Feedback Please Update Blender FBX import script

Discussion in 'Asset Importing & Exporting' started by Spy-Shifty, Jun 2, 2019.

  1. Spy-Shifty

    Spy-Shifty

    Joined:
    May 5, 2011
    Posts:
    546
    Dear Unity Devteam,

    the import options of Unity for Blender are not perfect. Often we have problems with the orientation of the model. Especially where the mesh is used directly as a base object or when applying rotations ... The mesh is then rotated by 90 degrees on the x-axis.

    This a common issue when using Blender. The only way to solve this issue is to use the FBX export function with advanced setting manually rather than directly using .blend files.

    The main issue is that Unity does not use the latest FBX export version (FBX 7.4 binary)

    In this version, we have the ability to "Apply Transform", which bake space transform into object data.
    This option fixes the rotation issue for Blender. Many problems would be solved...

    Basically, the following changes should be made to the file: "BlenderToFBX.py" (only tested with Blender 2.79)
    Code (Boo):
    1.  
    2.         #use export_fbx_bin for FBX 7.4 binary
    3.         import io_scene_fbx.export_fbx_bin
    4.         # 2.59 and later
    5.         kwargs = io_scene_fbx.export_fbx_bin.defaults_unity3d()
    6.         kwargs["bake_space_transform"] = True #Apply Transform
    7.         kwargs["primary_bone_axis"] = '-Z'  #Solves bone orientation issues
    8.         kwargs["secondary_bone_axis"] = 'X' #Solves bone orientation issues
    9.         kwargs["apply_scale_options"] = 'FBX_SCALE_ALL'  #apply the correct scaling
    10.         io_scene_fbx.export_fbx_bin.save(FakeOp(), bpy.context, filepath=outfile, **kwargs)


    I have attached the modified BlenderToFBX file.
    Replace the "BlenderToFBX.py" file under:
    <Path to Unity>/Editor/Data/Tools



    Hope that Unity will consider this in the next release cycle.
     

    Attached Files:

    Last edited: Jun 2, 2019
    Mantra-Games, Siccity and MarkHenryC like this.