在自动化渲染的时候,有时候需要在渲染之前去清空渲染元素,特别是改变这些元素的输出路径,如以下所示:
renderEleMgr = maxOps.GetCurRenderElementMgr()
for i = 0 to (renderEleMgr.NumRenderElements() - 1) do
(
element = renderEleMgr.getrenderelement i
strFilePath = renderEleMgr.GetRenderElementFilename i
leafFileName = pathConfig.stripPathToLeaf strFilePath
customizePath = "C:/" + leafFileName
renderEleMgr.SetRenderElementFilename i customizePath
for i = 0 to (renderEleMgr.NumRenderElements() - 1) do
(
element = renderEleMgr.getrenderelement i
strFilePath = renderEleMgr.GetRenderElementFilename i
leafFileName = pathConfig.stripPathToLeaf strFilePath
customizePath = "C:/" + leafFileName
renderEleMgr.SetRenderElementFilename i customizePath
)
这个脚本在3ds Max2014里脚本执行,一些都OK。 可是到了用命令行渲染时就失败,用-preRender的选项。
到了3ds Max2016才好啊。哎,看来3ds Max2014的bug啊。