本文整理汇总了Python中maya.OpenMaya.MGlobal.displayError方法的典型用法代码示例。如果您正苦于以下问题:Python MGlobal.displayError方法的具体用法?Python MGlobal.displayError怎么用?Python MGlobal.displayError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maya.OpenMaya.MGlobal
的用法示例。
在下文中一共展示了MGlobal.displayError方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: moveObjectToOrigin
# 需要导入模块: from maya.OpenMaya import MGlobal [as 别名]
# 或者: from maya.OpenMaya.MGlobal import displayError [as 别名]
def moveObjectToOrigin(objectName=""):
if not objectName:
MGlobal.displayError("Please provide ObjectName")
return False
localPivot = cmds.xform(objectName , q=True, rotatePivot=True)
worldPivot = cmds.xform(objectName , q=True, rotatePivot=True, worldSpace=True)
posx = 0.0
posy = 0.0
posz = 0.0
if worldPivot[0] == localPivot[0]:
posx = worldPivot[0]
else:
posx = worldPivot[0] - localPivot[0]
if worldPivot[1] == localPivot[1]:
posy = worldPivot[1]
else:
posy = worldPivot[1] - localPivot[1]
if worldPivot[2] == localPivot[2]:
posz = worldPivot[2]
else:
posz = worldPivot[2] - localPivot[2]
cmds.move(-posx, -posy, -posz, objectName, absolute=True)
示例2: uninitializePlugin
# 需要导入模块: from maya.OpenMaya import MGlobal [as 别名]
# 或者: from maya.OpenMaya.MGlobal import displayError [as 别名]
def uninitializePlugin( mobject ):
mplugin = OpenMayaMPx.MFnPlugin( mobject )
try:
mplugin.deregisterNode( MirrorNode.NODE_ID )
mplugin.deregisterNode( ControlPairNode.NODE_ID )
mplugin.deregisterCommand( CreateMirrorNode.CMD_NAME )
mplugin.deregisterCommand( CreateMirrorNode.CMD_NAME.lower() )
except:
MGlobal.displayError( "Failed to unload zooMirror plugin:" )
raise
示例3: initializePlugin
# 需要导入模块: from maya.OpenMaya import MGlobal [as 别名]
# 或者: from maya.OpenMaya.MGlobal import displayError [as 别名]
def initializePlugin( mobject ):
mplugin = OpenMayaMPx.MFnPlugin( mobject, 'macaronikazoo', '1' )
try:
mplugin.registerNode( MirrorNode.NODE_TYPE_NAME, MirrorNode.NODE_ID, MirrorNode.Creator, MirrorNode.Init )
mplugin.registerNode( ControlPairNode.NODE_TYPE_NAME, ControlPairNode.NODE_ID, ControlPairNode.Creator, ControlPairNode.Init )
mplugin.registerCommand( CreateMirrorNode.CMD_NAME, CreateMirrorNode.Creator, CreateMirrorNode.SyntaxCreator )
mplugin.registerCommand( CreateMirrorNode.CMD_NAME.lower(), CreateMirrorNode.Creator, CreateMirrorNode.SyntaxCreator )
except:
MGlobal.displayError( "Failed to load zooMirror plugin:" )
raise
示例4: movePivotToBottomCenter
# 需要导入模块: from maya.OpenMaya import MGlobal [as 别名]
# 或者: from maya.OpenMaya.MGlobal import displayError [as 别名]
def movePivotToBottomCenter(objectName=""):
if not objectName:
MGlobal.displayError("Please provide ObjectName")
return False
boxMin = cmds.getAttr(objectName + ".boundingBoxMin")[0]
boxMax = cmds.getAttr(objectName + ".boundingBoxMax")[0]
posx = (boxMax[0] + boxMin[0]) / 2
posy = boxMin[1]
posz = (boxMax[2] + boxMin[2]) / 2
bottomCenter = [posx, posy, posz]
cmds.xform(objectName, piv=bottomCenter, ws=True)
return True
示例5: Path
# 需要导入模块: from maya.OpenMaya import MGlobal [as 别名]
# 或者: from maya.OpenMaya.MGlobal import displayError [as 别名]
SPACE_LOCAL = rigUtils.SPACE_LOCAL
SPACE_OBJECT = rigUtils.SPACE_OBJECT
Axis = rigUtils.Axis
CONTROL_DIRECTORY = None
if CONTROL_DIRECTORY is None:
#try to determine the directory that contains the control macros
for f in Path( __file__ ).up().files( recursive=True ):
if f.hasExtension( 'shape' ):
if f.name().startswith( 'control' ):
CONTROL_DIRECTORY = f.up()
break
if CONTROL_DIRECTORY is None:
MGlobal.displayError( "WARNING: Cannot determine the directory that contains the .control files - please open '%s' and set the CONTROL_DIRECTORY variable appropriately" % __file__ )
AX_X, AX_Y, AX_Z, AX_X_NEG, AX_Y_NEG, AX_Z_NEG = map( Axis, range( 6 ) )
DEFAULT_AXIS = AX_X
AXIS_ROTATIONS = { AX_X: (0, 0, -90),
AX_Y: (0, 0, 0),
AX_Z: (90, 0, 0),
AX_X_NEG: (0, 0, 90),
AX_Y_NEG: (180, 0, 0),
AX_Z_NEG: (-90, 0, 0) }
class ShapeDesc(object):
'''
store shape preferences about a control
示例6: error
# 需要导入模块: from maya.OpenMaya import MGlobal [as 别名]
# 或者: from maya.OpenMaya.MGlobal import displayError [as 别名]
def error(msg, showLineNumber=False):
#return mel.error(msg, showLineNumber)
return MGlobal.displayError(msg)