Home Technical Talk

[Help] difficulties with I/O in FBX SDK python binding

polycounter lvl 7
Offline / Send Message
brianchenito polycounter lvl 7
I've been trying to build a very simple script to import and export a fbx file in the Python binding of the Autodesk 2015 FBX SDK, but I'm encountering some problems.

If i load a very simple .fbx into the script ( containing a skinned mesh and several bones), the script appears to read global settings fine- I can access system units and coordinates through Scene.GetGlobalSettings(), but I am not certain it is loading in the mesh. The outputted file contains nothing in scene- the bones and mesh are absent. Is there something wrong with my initialization or IOSettings? any help would be appreciated.

import fbx
FBXSOURCELOCATION= ('C:/Users/Brian/Desktop/Fbx test cases/Ward/showcase.FBX')#canbe set to whatever
FBXSAVELOCATION=(' C:/Users/Brian/Desktop/Fbx test cases/Ward/test.fbx')

MasterManager= fbx.FbxManager.Create()
IOSettings= fbx.FbxIOSettings.Create(MasterManager,fbx.IOSROOT)
MasterManager.SetIOSettings(IOSettings)

Importer = fbx.FbxImporter.Create(MasterManager,'myImporter')# create importer
Importsucess= (Importer.Initialize(FBXSOURCELOCATION, -1, MasterManager.GetIOSettings()))

if Importsucess== False:
print("Import error:",Importer.GetStatus().GetErrorString())
if Importsucess== True:
print(FBXSOURCELOCATION,"sucessfully imported")

Scene= fbx.FbxScene.Create(MasterManager,'myScene')
Importer.Import(Scene)

Exporter = fbx.FbxExporter.Create(MasterManager,'myExporter')# create importer
Exportsucess= (Exporter.Initialize(FBXSAVELOCATION,-1, MasterManager.GetIOSettings() ))

if Exportsucess== False:
print("Export error:",Exporter.GetStatus().GetErrorString())

if Exportsucess== True:
print(FBXSAVELOCATION,"sucessfully exported")

Exporter.Export(Scene)
Sign In or Register to comment.