导出前的场景清理

时间:2018-10-15 08:20:46

标签: 3dsmax maxscript

我试图制作一个脚本,以便在将其导出到fbx之前在场景中进行一系列清理操作。

如何选择场景中的所有网格/多边形模型以将其删除? 我尝试使用isKindOf GeometryClass,但是也选择了骨骼...

我还试图将所有对象的显示属性更改为“按层”,但是我无法使其显示在Maxscript侦听器中。

这正是我需要做的:

  1. 按类别隐藏>无
  2. 取消全部隐藏
  3. 解冻所有
  4. 将显示属性设置为“按图层”
  5. 从场景中删除所有3d网格/多边形对象
  6. 导出到fbx

最后,是否可以通过命令行在多个Max文件上运行此脚本?

谢谢


这就是我最终使用的(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

这是我在批处理文件中循环通过的命令:

"C:\Program Files\Autodesk\3ds Max 2019\3dsmaxbatch.exe" ExportAnimationFbx.ms -mxsString filename:"myfoldername\maxfilename.max" -mxsString exportfilename:"assetname.fbx"

1 个答案:

答案 0 :(得分:0)

对于初始场景设置:

hideByCategory.none()
unhide objects
unfreeze objects
objects.displayByLayer = on
delete (for obj in objects where isKindOf obj Editable_Mesh or isKindOf obj Editable_Poly collect obj)

关于FBX导出,请参考this How to control Max's FBX exporter post。如果您使用的是max 2018.4或更高版本,this series of blog posts将引导您完成3ds max命令行访问。