4.3 - Maya Commands: Errors and Warnings

import maya.cmds as cmds
import maya.OpenMaya as om

#Errors
print("start")
cmds.error("This is an error") # the procedure will be interrupted
print("end")# the end will not be printed

print("start")
om.MGlobal.displayError("This is a displayError") # the code  will not be interrupted
print("end")

#Warning
cmds.warning("This is a warning")
om.MGlobal.displayWarning("This is a displayWarning")

# Info
print("This is print statement")
om.MGlobal.displayInfo("This is a displayInfo") # the Info will be displayed in maya


import maya.cmds as cmds
import maya.OpenMaya as om



sel = cmds.ls(sl=True)

num_sel = len(sel)
    

if num_sel >= 2:
    for s in sel:
        print(s)
elif num_sel == 1:
    om.MGlobal.displayError("Please select at least two objects")
else:
    om.MGlobal.displayError("no object selected")
    
    





阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/seamanj/article/details/49912443
个人分类: maya python
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭