Os dialog style breaks fbxmaya

Hello-

I recently found while scripting an fbx exporter and running cmds.file(type = FBX export…), it will fail if your file dialog is set to os native, even if you suppress the prompt. It will delete the file type FBX export. I have no idea why.

The only solution I found is force re-importing fbxmaya right before calling mel.eval(fbx export -s)

This seems kinda janky, does anyone have a solution or understand why.

thanks,

Thomas

We found this out as far back as whichever version of Maya first introduced the new non-native dialog, as we hated it (and we used a lot of custom native dialog extensions like DirectFolders).

I never investigated why it happened but I did figure out it simply changes the file type string from FBX export to simply Fbx - so now we just use "Fbx" when setting the type and it seems to be fine.

I also prefer the OS native dialog because of Direct Folders specificaly

Our pipeline does not import FBX via cmds.file() but instead we wrap the MEL FBXImport command in python mel.eval(f"FBXImport -f {file_path}"). Maybe that will work with Native OS ?

Using FBXImport is preferred because we get full control over import options and are not beholden to whatever preferences the current user last chose in the Maya import dialog.

RTFM here

You don’t need to wrap the FBX____ commands in MEL, as they are accessible in Python cmds by default. The only slightly unintuitive part is that it still expects MEL style flags :unamused_face:

For example:

cmds.FBXImport("-f", file_path)
cmds.FBXExportInAscii("-v", True)

which is kinda clunky, but preferable to using mel.eval imo.

1 Like

yeah, im now using mel.eval(f’FBXExport . . . ) and it works. Running FBXProperties is also a gold mine.

Our exporter involves using cmds.file to open scenes and import references, and the bug occurs when a dialog is raised (the bug being switching the user’s dialog style to maya default and deleting FBX export). using pmpt = False fixed it. A little jank, but it works.

Thanks guys