I'm trying to make a script to do a bunch of cleanup operations on the scene before exporting it to fbx.
How can I select all Mesh/Poly models in the scene to delete them ? I tried using the isKindOf GeometryClass but bones are selected as well ...
I'm also trying to change all object display property to "By layer", but I can't get it to show up in the Maxscript listener.
Here is exactly what I need to do :
- Hide by category > none
- Unhide all
- Unfreeze all
- Set display property to "By layer"
- Delete all 3d Mesh/Poly object from the scene
- Export to fbx
Finally, is there a way to run this script on multiple Max file through the command line ?
Thanks
This is what I ended up using (ExportAnimationFbx.ms) :
filename=maxops.mxsCmdLineArgs[#filename]
loadmaxfile filename
hideByCategory.none()
unhide objects
unfreeze objects
objects.displayByLayer = on
delete (for obj in objects where isKindOf obj.baseObject Editable_Mesh or isKindOf obj.baseObject Editable_Poly or isKindOf obj Plane collect obj)
exportFileName = maxops.mxsCmdLineArgs[#exportfilename]
--Geometry------------------------------------------------------------------------
FBXExporterSetParam "SmoothingGroups" false
FBXExporterSetParam "NormalsPerPoly" false
FBXExporterSetParam "TangentSpaceExport" false
FBXExporterSetParam "SmoothMeshExport" false
FBXExporterSetParam "Preserveinstances" false
FBXExporterSetParam "SelectionSetExport" false
FBXExporterSetParam "GeomAsBone" true
FBXExporterSetParam "ColladaTriangulate" false
FBXExporterSetParam "PreserveEdgeOrientation" false
--Animation------------------------------------------------------------------------
FBXExporterSetParam "Animation" true
FBXExporterSetParam "ExportAnimationOnly" false
FBXExporterSetParam "BakeAnimation" true
FBXExporterSetParam "Skin" true
--Cameras------------------------------------------------------------------------
FBXExporterSetParam "Cameras" false
--Lights------------------------------------------------------------------------
FBXExporterSetParam "Lights" false
--Embed Media--------------------------------------------------------------------
FBXExporterSetParam "EmbedTextures" false
--Units----------------------------------------------------------------------------
--Axis Conversion-----------------------------------------------------------------
FBXExporterSetParam "AxisConversionMethod" "Fbx_Root" --"None", "Animation", or "Fbx_Root".
FBXExporterSetParam "UpAxis" "Z"
--UI----------------------------------------------------------------
FBXExporterSetParam "ShowWarnings" true
FBXExporterSetParam "GenerateLog" false
--FBX File Format----------------------------------------------------------------
FBXExporterSetParam "ASCII" false
FBXExporterSetParam "FileVersion" "FBX201400"
exportFile (exportFileName) #noprompt selectedOnly:false using:FBXEXP
And this is the command I loop through in my batch file :
"C:\Program Files\Autodesk\3ds Max 2019\3dsmaxbatch.exe" ExportAnimationFbx.ms -mxsString filename:"myfoldername\maxfilename.max" -mxsString exportfilename:"assetname.fbx"