FBX plugin doesn't use scripted scale setting
I'm trying to create a one-click export for FBX using the scripting commands listed here:
http://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=GUID-76CF67F4-BBBB-48C6-AE48-6EF6975CB870
I have this block of MEL :
//units settings FBXExportScaleFactor 1.0 ; FBXProperty Export|AdvOptGrp|UnitsGrp|DynamicScaleConversion -v false; FBXProperty Export|AdvOptGrp|UnitsGrp|UnitsSelector -v "Meters"; currentUnit -linear "m";
FBXPushSettings;
which is followed by:
FBXExport -f $exportName -s ;
"$exportName" is the output path I want.
It runs fine. However the scale of the exported file is not correct.
If you export a FBX manually and set the scale (under advanced settings> Units) incorrectly and then use the exporter script it will use the scale set in the previous export. If I run the script twice - the second export will be the correct scale.
Also if I open Maya and immediately use the export script it will spit out this error:
// Error: Syntax Error: bad value for this property. Use a valid enum item. //
This seems to be caused by the FBX plugin not being properly initialized when you start Maya. The value it's complaining about is "Meters".
EDIT: Also I put in debug print commands that execute after the export
print ("file units " + ` currentUnit -q -linear` + "\r\n"); print ("scaleFactor " + `FBXExportScaleFactor -q` + "\r\n"); print ("convertUnit " + `FBXExportConvertUnitString -q` + "\r\n"); print ("unitsSelector " + `FBXProperty Export|AdvOptGrp|UnitsGrp|UnitsSelector -q` + "\r\n");
These show the scale values as being set correctly by the code even though the exported file is not the right scale