关闭

4.3 - Maya Commands: Errors and Warnings

238人阅读 评论(0) 收藏 举报
分类:

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")
    
    





0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:474630次
    • 积分:10814
    • 等级:
    • 排名:第1696名
    • 原创:609篇
    • 转载:98篇
    • 译文:0篇
    • 评论:97条
    文章分类
    最新评论