【发布时间】:2019-09-07 20:51:24
【问题描述】:
一旦没有找到属性,我想结束整个脚本。目前,我有以下代码。我显示一个对话框并使用sys.exit() 结束脚本,但我想知道是否有一个 cmds 对话框可以在没有sys.exit() 的情况下自动为您执行此操作,
def check_attr(attr):
if not cmds.select(cmds.ls(attr)):
cmds.confirmDialog(title= 'Attribute not found ', message = attr+' attribute was not found', button =['OK'])
sys.exit()
我的问题:是否存在停止脚本的 cmds...对话框?
【问题讨论】:
-
你的意思是像: cmds.error() 吗?并且没有错误的对话框预设,但你可以包装你的。
-
你也可以在 Maya 中使用 PySide2 或 PyQt5,这样你就可以使用 QMessageBox :stackoverflow.com/questions/40227047/…
-
@DrWeeny 我的意思是类似 cmds.exitDialog("error message") 它只是退出,但我认为对话框没有那个功能