导出前场景清理
Scene cleanup before export
我正在尝试制作一个脚本,以便在将其导出到 fbx 之前在场景中执行大量清理操作。
如何select删除场景中所有Mesh/Poly个模型?
我尝试使用 isKindOf GeometryClass 但骨骼也被 selected ...
我也在尝试将所有对象显示 属性 更改为 "By layer",但我无法让它显示在 Maxscript 侦听器中。
这正是我需要做的:
- 按类别隐藏 > none
- 全部取消隐藏
- 全部解冻
- 将显示 属性 设置为 "By layer"
- 从场景中删除所有 3d Mesh/Poly 对象
- 导出为 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\Autodeskds Max 2019dsmaxbatch.exe" ExportAnimationFbx.ms -mxsString filename:"myfoldername\maxfilename.max" -mxsString exportfilename:"assetname.fbx"
对于初始场景设置:
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. If you're using max 2018.4 or newer, this series of blog posts 将引导您完成 3ds max 命令行访问。
我正在尝试制作一个脚本,以便在将其导出到 fbx 之前在场景中执行大量清理操作。
如何select删除场景中所有Mesh/Poly个模型? 我尝试使用 isKindOf GeometryClass 但骨骼也被 selected ...
我也在尝试将所有对象显示 属性 更改为 "By layer",但我无法让它显示在 Maxscript 侦听器中。
这正是我需要做的:
- 按类别隐藏 > none
- 全部取消隐藏
- 全部解冻
- 将显示 属性 设置为 "By layer"
- 从场景中删除所有 3d Mesh/Poly 对象
- 导出为 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\Autodeskds Max 2019dsmaxbatch.exe" ExportAnimationFbx.ms -mxsString filename:"myfoldername\maxfilename.max" -mxsString exportfilename:"assetname.fbx"
对于初始场景设置:
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. If you're using max 2018.4 or newer, this series of blog posts 将引导您完成 3ds max 命令行访问。