[Bf-gamedev] New FBX Exporter

Simon Broggi simon.broggi at gmail.com
Wed Jun 18 17:41:50 CEST 2014


Just changed my Unity installation to automatically use the new exporter.
To do this change the Tools/Unity-BlenderToFBX.py in the Unity installation.
Here's the edited script that works for me (lines added marked
with  #changed to use binary fbx exporter) :

blender249 = True

try: import Blender
except:
blender249 = False
import bpy

if blender249:
try: import export_fbx
except:
print('error: export_fbx not found.')
Blender.Quit()
else:
try:
import io_scene_fbx.export_fbx
import io_scene_fbx.export_fbx_bin #changed to use binary fbx exporter
except:
print('error: io_scene_fbx.export_fbx not found.')
# This might need to be bpy.Quit()
raise

# Find the Blender output file
import os
outfile = os.getenv("UNITY_BLENDER_EXPORTER_OUTPUT_FILE")

# Do the conversion
print("Starting blender to FBX conversion " + outfile)

if blender249:
mtx4_x90n = Blender.Mathutils.RotationMatrix(-90, 4, 'x')
export_fbx.write(outfile,
EXP_OBS_SELECTED=False,
EXP_MESH=True,
EXP_MESH_APPLY_MOD=True,
EXP_MESH_HQ_NORMALS=True,
EXP_ARMATURE=True,
EXP_LAMP=True,
EXP_CAMERA=True,
EXP_EMPTY=True,
EXP_IMAGE_COPY=False,
ANIM_ENABLE=True,
ANIM_OPTIMIZE=False,
ANIM_ACTION_ALL=True,
GLOBAL_MATRIX=mtx4_x90n)
else:
# blender 2.58 or newer
import math
from mathutils import Matrix
# -90 degrees
mtx4_x90n = Matrix.Rotation(-math.pi / 2.0, 4, 'X')
 print("moo")
 class FakeOp:
def report(self, tp, msg):
print("%s: %s" % (tp, msg))
 exportObjects = ['ARMATURE', 'EMPTY', 'MESH']
 minorVersion = bpy.app.version[1];
if minorVersion <= 58:
# 2.58
io_scene_fbx.export_fbx.save(FakeOp(), bpy.context, filepath=outfile,
global_matrix=mtx4_x90n,
use_selection=False,
object_types=exportObjects,
mesh_apply_modifiers=True,
ANIM_ENABLE=True,
ANIM_OPTIMIZE=False,
ANIM_OPTIMIZE_PRECISSION=6,
ANIM_ACTION_ALL=True,
batch_mode='OFF',
BATCH_OWN_DIR=False)
else:
# 2.59 and later
kwargs = io_scene_fbx.export_fbx_bin.defaults_unity3d() #changed to use
binary fbx exporter
io_scene_fbx.export_fbx.save(FakeOp(), bpy.context, filepath=outfile,
**kwargs)
# HQ normals are not supported in the current exporter

print("Finished blender to FBX conversion " + outfile)


On Fri, Jun 6, 2014 at 3:18 AM, Mitchell Stokes <mogurijin at gmail.com> wrote:

> We have a new binary FBX exporter in Blender thanks to the efforts of
> Bastien Montagne. You can find more information in this recent
> code.blender.org post:
> http://code.blender.org/index.php/2014/06/supporting-game-developers-with-blender-2-71/
>
> We've run various tests ourselves, but we'd really like to get feedback
> from people actually using Blender to create assets for use in engines such
> as Unity, UDK, UE4, or just about any engine that accepts FBX files. To
> this end, we highly encourage users to test out recent development builds
> (found at http://builder.blender.org/) and play around with the new
> exporter. Use it, abuse it, throw your complicated production files at it,
> and then let us know what breaks via the bug tracker (
> https://developer.blender.org/).
>
> --Mitchell Stokes
>
> _______________________________________________
> Bf-gamedev mailing list
> Bf-gamedev at blender.org
> http://lists.blender.org/mailman/listinfo/bf-gamedev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-gamedev/attachments/20140618/f8f9ef9d/attachment.htm 


More information about the Bf-gamedev mailing list