我需要打开一些来自其他艺术家的大型/凌乱的玛雅场景。它总是提示很多警告并使Maya冻结很长时间。我尝试使用 python 编写一个自定义的"打开文件"来抑制警告消息。但它似乎并没有真正完全"静音"脚本编辑器。比方说,当我打开文件后打开Hypershade窗口时,警告再次提示,因为我有很多缺少纹理。我现在使用的脚本是:
import maya.cmds as cmds
import maya.mel as mel
filename = cmds.fileDialog2(fileMode=1)
reporter = mel.eval( 'string $tmp = $gCommandReporter;' )
cmds.scriptEditorInfo(reporter,suppressWarnings=True,suppressInfo=1,se=1,ch=1)
cmds.disableIncorrectNameWarning()
cmds.file( filename[0], i=True );
谢谢
所以基本上这是有效的:
import maya.cmds as cmds
cmds.scriptEditorInfo(suppressWarnings=0,suppressInfo=0,se=0)
我无法让它工作的原因是我使用 Maya 的 Charcoal 编辑器来编写 python。它不知何故不会抑制警告。卸载后一切都很好。