4.3 - Maya Commands: Errors and Warnings

来源:互联网 发布:jabra elite sport软件 编辑:程序博客网 时间:2024/06/07 03:55

import maya.cmds as cmdsimport maya.OpenMaya as om#Errorsprint("start")cmds.error("This is an error") # the procedure will be interruptedprint("end")# the end will not be printedprint("start")om.MGlobal.displayError("This is a displayError") # the code  will not be interruptedprint("end")#Warningcmds.warning("This is a warning")om.MGlobal.displayWarning("This is a displayWarning")# Infoprint("This is print statement")om.MGlobal.displayInfo("This is a displayInfo") # the Info will be displayed in maya


import maya.cmds as cmdsimport maya.OpenMaya as omsel = 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