本文整理汇总了Python中maya.OpenMaya.MGlobal.displayWarning方法的典型用法代码示例。如果您正苦于以下问题:Python MGlobal.displayWarning方法的具体用法?Python MGlobal.displayWarning怎么用?Python MGlobal.displayWarning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maya.OpenMaya.MGlobal
的用法示例。
在下文中一共展示了MGlobal.displayWarning方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: exportObjectAsAssFile
# 需要导入模块: from maya.OpenMaya import MGlobal [as 别名]
# 或者: from maya.OpenMaya.MGlobal import displayWarning [as 别名]
def exportObjectAsAssFile(location="", objectName=""):
if objectName == "":
MGlobal.displayWarning("No object exported!!!")
return False
else:
cmds.select(objectName, r=True)
cmds.file(location + "/" + objectName, type="mayaBinary", force=True, exportSelected=True)
return True
示例2: exportObjectAsMbFile
# 需要导入模块: from maya.OpenMaya import MGlobal [as 别名]
# 或者: from maya.OpenMaya.MGlobal import displayWarning [as 别名]
def exportObjectAsMbFile(location="", objectName=""):
if objectName == "":
MGlobal.displayWarning("No object exported!!!")
return False
else:
print(objectName)
cmds.select(objectName, replace=True)
cmds.file(location + "/" + objectName, exportSelected=True, type="mayaBinary", constructionHistory=False, force=True)
return True
示例3: ikHandle
# 需要导入模块: from maya.OpenMaya import MGlobal [as 别名]
# 或者: from maya.OpenMaya.MGlobal import displayWarning [as 别名]
def ikHandle(*args, **kwargs):
"""
Modifications:
- always converts to PyNodes in create mode, even though results are
non-unique short names
"""
import nodetypes
from maya.OpenMaya import MGlobal
res = cmds.ikHandle(*args, **kwargs)
# unfortunately, ikHandle returns non-unique names... however, it
# doesn't support a parent option - so we can just throw a '|' in front
# of the first return result (the ikHandle itself) to get a unique name
# We then need to track through it's connections to find the endEffector...
if kwargs.get('query', kwargs.get('q', False)):
if kwargs.get('endEffector', kwargs.get('ee', False)):
res = _factories.toPyNode(res)
elif kwargs.get('jointList', kwargs.get('jl', False)):
res = _factories.toPyNodeList(res)
elif (not kwargs.get('edit', kwargs.get('e', False))
and isinstance(res, list) and len(res) == 2
and all(isinstance(x, basestring) for x in res)):
handleName, effectorName = res
# ikHandle doesn't support a parent kwarg, so result should always be
# grouped under the world...
handleNode = _factories.toPyNode('|' + handleName)
# unfortunately, effector location is a little harder to predict. but
# can find it by following connections...
effectorNode = handleNode.attr('endEffector').inputs()[0]
if effectorNode.nodeName() == effectorName:
res = [handleNode, effectorNode]
else:
MGlobal.displayWarning(
"Warning: returned ikHandle %r was connected to effector %r, "
"which did not match returned effector name %r"
% (handleName, effectorNode.shortName(), effectorName))
return res