[Closed] FBX Export
I’m working on an FBX exporter in maxscript, and I can’t seem to get it to step through an array and spit out individual FBX files for each node in the array. I’m using a for loop, so I’m not sure what the problem is. Here’s what I’ve got:
fn FBX_Export =
(
individualFBXs = #()
if $herp != undefined then append individualFBXs $herp
if $derp != undefined then append individualFBXs $derp
if $slurp != undefined then append individualFBXs $slurp
for n in 1 to individualFBXs.count do
(
--Geometry------------------------------------------------------------------------
FBXExporterSetParam "SmoothingGroups" true
FBXExporterSetParam "NormalsPerPoly" false
FBXExporterSetParam "TangentSpaceExport" true
FBXExporterSetParam "SmoothMeshExport" false
FBXExporterSetParam "Preserveinstances" false
FBXExporterSetParam "SelectionSetExport" false
FBXExporterSetParam "GeomAsBone" false
FBXExporterSetParam "ColladaTriangulate" true
FBXExporterSetParam "PreserveEdgeOrientation" true
--Animation------------------------------------------------------------------------
FBXExporterSetParam "Animation" false
--Cameras------------------------------------------------------------------------
FBXExporterSetParam "Cameras" false
--Lights------------------------------------------------------------------------
FBXExporterSetParam "Lights" false
--Embed Media--------------------------------------------------------------------
FBXExporterSetParam "EmbedTextures" false
--Units----------------------------------------------------------------------------
--Axis Conversion-----------------------------------------------------------------
FBXExporterSetParam "AxisConversionMethod" "None"
FBXExporterSetParam "UpAxis" "Y"
--UI----------------------------------------------------------------
FBXExporterSetParam "ShowWarnings" true
FBXExporterSetParam "GenerateLog" false
--FBX File Format----------------------------------------------------------------
FBXExporterSetParam "ASCII" true
FBXExporterSetParam "FileVersion" "FBX201200"
-- Path and file name stuff
makeDir (maxFilePath + "FBX")
FBXSavePath = (maxFilePath + "FBX\\" + $.name)
exportFile FBXSavePath #noPrompt selectedOnly:true using:FBXEXP
)
FBX_Export ()
Hey DustinBrown,
The reason is because you need so select the objects you want to export if you are using the ‘selectedOnly’ flag. I don’t have a copy of max at the moment so I can’t check, but if possible it would be better to feed the fbx exporter an array of objects to export, rather than selecting the objects to export. I can’t remember if this is possible though.
Also, no need to put the fbx export settings in the loop. This is quite inefficient.
fn FBX_Export =
(
individualFBXs = #()
if $herp != undefined then append individualFBXs $herp
if $derp != undefined then append individualFBXs $derp
if $slurp != undefined then append individualFBXs $slurp
--lol, herp derp did make me chuckle ;)
--No need to put this in a loop.
--Geometry------------------------------------------------------------------------
FBXExporterSetParam "SmoothingGroups" true
FBXExporterSetParam "NormalsPerPoly" false
FBXExporterSetParam "TangentSpaceExport" true
FBXExporterSetParam "SmoothMeshExport" false
FBXExporterSetParam "Preserveinstances" false
FBXExporterSetParam "SelectionSetExport" false
FBXExporterSetParam "GeomAsBone" false
FBXExporterSetParam "ColladaTriangulate" true
FBXExporterSetParam "PreserveEdgeOrientation" true
--Animation------------------------------------------------------------------------
FBXExporterSetParam "Animation" false
--Cameras------------------------------------------------------------------------
FBXExporterSetParam "Cameras" false
--Lights------------------------------------------------------------------------
FBXExporterSetParam "Lights" false
--Embed Media--------------------------------------------------------------------
FBXExporterSetParam "EmbedTextures" false
--Units----------------------------------------------------------------------------
--Axis Conversion-----------------------------------------------------------------
FBXExporterSetParam "AxisConversionMethod" "None"
FBXExporterSetParam "UpAxis" "Y"
--UI----------------------------------------------------------------
FBXExporterSetParam "ShowWarnings" true
FBXExporterSetParam "GenerateLog" false
--FBX File Format----------------------------------------------------------------
FBXExporterSetParam "ASCII" true
FBXExporterSetParam "FileVersion" "FBX201200"
for n in individualFBXs do
(
-- Path and file name stuff
makeDir (maxFilePath + "FBX")
--Do you need to put .fbx on the end of this? I'm not near a copy of max at the moment so i cant tell.
FBXSavePath = (maxFilePath + "FBX\\" + n.name)
--You need to select the objects because fbx exporter is only exporting selected items.
select n
exportFile FBXSavePath #noPrompt selectedOnly:true using:FBXEXP
)
FBX_Export ()
Excellent, I had the same thought over the weekend – that I need to select the things I want to export. Cheers!