[maxScript] FBX export option control

I want to make painless FBX export buttons for the art team that enforces the required export settings.

Being used to Maya/python My first thought was to pass the export options in the button command script, but not every option seems exposed via max script.:(:

the preferred approach appears to be to keep saved presets and load them.

the MaxScript command for loading a preset is

FBXExporterSetParam "LoadExportPresetFile" <full path to preset file>

The 3ds_Max_FBX_Plug-in_Help lists the preset file locations as follows:
C:\Documents and Settings<username>\My Documents\3dsMax\FBX\Presets (Windows XP)
C:\Users<username>\Documents\3dsMax\FBX\Presets (Vista)
C:\Users<username>\My Documents\3dsMax\FBX\Presets (Windows 7)

to generate the path to the preset file I came up with

--build path to preset file

fbxPresetDir="C:\Users\\" + sysInfo.username + "\Documents\3dsMax\FBX\3dsMax2013_X64\Presets\2013.1\export\\"
fbxPresetFile="User defined.fbxexportpreset"
fbxPresetPath=fbxPresetDir+fbxPresetFile

--set the preset file
FBXExporterSetParam "LoadExportPresetFile" fbxPresetPath

which seems cumbersome but successfully loads the intended preset file.

Now I’m faced with the task of distributing the preset files to the team…

all of this seems a bit cumbersome and indirect, compared to the MEL equivalent.

…am I missing a simple way to pass options to an exportFile() command?
is there a smarter way?

You looked at the scripting section of the help, right? The settings you need aren’t avalaible through ‘FBXExporterSetParam’?

Yeah, you should be able to set most (all?) fbx export options directly, eg:


	FBXExporterSetParam "ASCII" true
	FBXExporterSetParam "Animation" true
	FBXExporterSetParam "AxisConversionMethod" #animation
	FBXExporterSetParam "SmoothingGroups" true
	FBXExporterSetParam "UpAxis" "Z"
	
	exportFile (fbx) #noPrompt selectedOnly:False using:FBXEXP

Doc link: FBX Export Dialog Access

I also had to do this but it seems (at least in 2012) the maxscript hooks for the settings are broken - even though explicitly setting things, if the user manually sets them to something else on a manual export these settings don’t get overwritten when changed via maxscript. In the end I had to make a callback that effectively pushes all the buttons on the UI instead.

yeah, I am probably over-complicating the problem.
TBH I have not yet made precise survey of the options we need.

I just worried when I noticed that when you look at all the FBX properties using

FBXExporterGetParam "FBXProperties"

not all of the parameters returned can be accessed with FBXExporterGetParam
while they do all seem to be exposed in the presets file.

I’ll just get explicit about what we need and make sure those options can eb set.

(Maya) We use two preset files that are distributed through source control to the project directories (not //user/documents…). One for animated objects, one for not-animated. After loading them, we modify a couple settings that aren’t read from the preset (bake start, bake end, etc). After export, we do any namespace modifications to the nodes in the ASCII fbx file with regex.

Turns out that the property names returned in the script listener using FBXExporterGetParam “FBXProperties”
are not the same names you must use with FBXExporterSetParam

“BakeComplexAnimation” vs “BakeAnimation” for example…fun!

for anyone keeping score, the approach suggested by Theodox & LoTekk is spot on.

Thanks all.

I just played with this a little. I can’t seem to get ANYTHING to actually change any of the gui values. What i tried was both loading a preset as described in the first post as well as using various FBXExporterSetParam calls. When i went to export manually, the gui would not reflect any of these changes. So are they actually changed when i load a preset? (I’d be fine with loading a preset if the individual paramsetting is borked)

Regards,
Thorsten

I’m pretty sure loading the presets is overriding what you are seeing in the gui. We have a preset for mesh and animation and they wouldn’t export properly if we relied on the gui being updated.

Hey,
so just for clarification, is there a way to check that the presets have been successfully loaded and used if it isn’t applied in GUI (except the final result mesh) ?

I’m just getting started with MaxScript (I’m a Maya guy usually), so it’s a bit premature to post. But since there’s no answer yet in this thread: isn’t the info from FBXExporterGetParam “FBXProperties” what it would take to manipulate the GUI? Doesn’t MAXscript give a way to bang on the interface elements if you have their paths?

@podfish:

FBXExporterGetParam “FBXProperties” is not as useful as it seems (see post #7 )

For setting FBX params in max script, the answers in post #2 and #3 are what I went with.

Autodesk page for FBX exporter help:
http://download.autodesk.com/us/fbx/2013/3ds_Max_FBX_Plug-in_Help/index.html

AutoDesk Help page listing all FBX params:
http://download.autodesk.com/us/fbx/2013/3ds_Max_FBX_Plug-in_Help/index.html?url=files/GUID-318651B2-8DF5-4833-8C26-5CD43052D7D3.htm,topicNumber=d30e5903