Struggling with FBX export and presets

Hi,
I’m stuck on something that should be really obvious. I need to make a little window with some buttons that will export some fbx based on certain presets,

but for some reason, Maya refuses to do his job:

the first thing I tried was to load an external preset

preset_anim = "C:/Users/nsira/Dropbox/3D/MAYA/ExportUtility/FBX_presets/animations.fbxexportpreset"
# Load the preset from the file
preset = cmds.FBXLoadExportPresetFile(f=preset_anim )

# Export the selected objects as FBX using the preset
cmds.FBXExport(f=output_path, s=True, p=preset)

but I get this error:

# Error: RuntimeError: FBXLoadExportPresetFile: Error bad syntax.
# Use syntax: FBXLoadExportPresetFile -f "filepath"

after giving up on the external file I tried using a preset already in my collection, but even so, it doesn’t work

# Export the selected objects as FBX using the preset
cmds.FBXExport(f=output_path, s=True, p="animations")

even in this case, I get this message:

# Error: RuntimeError: Use syntax: FBXExport -f "filename" [-s]

I’ve tried almost everything, even using the correspondent mel command but still doesn’t work.
Has somebody any idea on how to use this FBXExport command? I haven’t found any proper documentation.

Run it through mel, yeah I know, horrible but thats the most reliable way we’ve found to get FBX to behave in this instance:

mel.eval('FBXResetImport')
mel.eval('FBXLoadExportPresetFile -f "%s"' % preset)
2 Likes

yeah Like @Mark-J says we stick with python wrapped mel commands, pymel in our case:

preset="C:/path/to/preset/file.xml"
pm.mel.FBXLoadImportPresetFile(f=preset)
pm.mel.FBXLoadExportPresetFile(f=preset)
1 Like