Search code examples
pythonfbx

manager.GetIOSettings() -> None in Mac Python FBX SDK bindings


Fresh install of the python bindings for the FBX SDK on a Mac, into site-packages of an anaconda python 2.7.12 installation. Success when importing fbx and FbxCommon. Success creating manager, scene, and importer objects for an fbx file import. here's the code

import fbx

manager = fbx.FbxManager.Create()
iosettings = manager.GetIOSettings()
scene = fbx.FbxScene.Create(manager, "")
importer = fbx.FbxImporter.Create(manager, "")

fname = 'test.fbx'
if not importer.Initialize(fname, -1, iosettings):
    print "INITIALIZE ", importer.GetStatus().GetErrorString()
if not importer.Import(scene):
    print "IMPORT ", importer.GetStatus().GetErrorString()

But... manager.GetIOSettings() returns None rather than something usable. I am still able to import some files (others, with errors, are for another question), so maybe this is not a showstopper, but still...

Any ideas about iosettings?


Solution

  • If the manager does not have an IOSettings, you can create one for it:

    if not manager.GetIOSettings():
        ios = fbx.FbxIOSettings.Create(manager, fbx.IOSROOT)
        manager.SetIOSettings(ios)
    

    (discovered in the FbxCommon.py file from the python SDK bindings)