本文整理汇总了Python中maya.cmds.warning方法的典型用法代码示例。如果您正苦于以下问题:Python cmds.warning方法的具体用法?Python cmds.warning怎么用?Python cmds.warning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maya.cmds
的用法示例。
在下文中一共展示了cmds.warning方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: shape_from_element
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import warning [as 别名]
def shape_from_element(element):
"""Return shape of given 'element'
Supports components, meshes, and surfaces
"""
try:
# Get either shape or transform, based on element-type
node = cmds.ls(element, objectsOnly=True)[0]
except:
cmds.warning("Could not find node in %s" % element)
return None
if cmds.nodeType(node) == 'transform':
try:
return cmds.listRelatives(node, shapes=True)[0]
except:
cmds.warning("Could not find shape in %s" % element)
return None
else:
return node
示例2: reset_resolution
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import warning [as 别名]
def reset_resolution():
project = io.find_one({"type": "project"})
try:
resolution_width = project["data"].get(
"resolutionWidth",
# backwards compatibility
project["data"].get("resolution_width", 1920)
)
resolution_height = project["data"].get(
"resolutionHeight",
# backwards compatibility
project["data"].get("resolution_height", 1080)
)
except KeyError:
cmds.warning("No resolution information found for %s"
% project["name"])
return
cmds.setAttr("defaultResolution.width", resolution_width)
cmds.setAttr("defaultResolution.height", resolution_height)
示例3: __init__
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import warning [as 别名]
def __init__( self, parent = BT_GetMayaWindow() ):
super(BT_UIForm, self).__init__(parent)
uicPath = BT_FindUIFile()
if not uicPath:
return None
self.ui = None
if BT_MayaVersionNumber < 2014:
self.ui = uic.loadUi(uicPath, self)
else:
loader = QtUiTools.QUiLoader()
self.ui = loader.load(uicPath, self)
self.ui.loadSelectedButton.clicked.connect(self.loadSelectedSet)
self.ui.connectButton.clicked.connect(self.connectSetup)
self.ui.disconnectButton.clicked.connect(self.disconnectSetup)
self.ui.setToBaseButton.clicked.connect(self.setToBasePose)
self.ui.setToSelectedButton.clicked.connect(self.setToPose)
self.ui.addPoseButton.clicked.connect(self.addPose)
self.ui.deletePoseButton.clicked.connect(self.deletePose)
self.ui.updateSelectedButton.clicked.connect(self.updatePose)
unitResult = BT_SetUnits()
if unitResult:
QtGui.QMessageBox.warning(self, "Blend Transforms", "Units set to centimetres.", "Okay")
self.ui.show()
示例4: updatePose
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import warning [as 别名]
def updatePose(self):
uiSet = str(self.ui.setEdit.text())
ind = self.ui.poseList.currentRow()
currentItem = self.ui.poseList.currentItem().text()
if BT_IsSetupConnected(uiSet):
cmds.warning('Disconnect setup first!')
return False
result = QtGui.QMessageBox.question(self, 'Update Pose', 'Really Update ' +str(currentItem) +' ?',
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
if result != QtGui.QMessageBox.Yes:
return False
if not uiSet:
return False
if ind < 0:
return False
BT_AddPose(set = uiSet, index = ind)
return True
示例5: deletePose
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import warning [as 别名]
def deletePose(self):
uiSet = str(self.ui.setEdit.text())
currentItem = self.ui.poseList.currentItem().text()
if not uiSet:
return False
if BT_IsSetupConnected(uiSet):
cmds.warning('Disconnect setup first!')
return False
result = QtGui.QMessageBox.question(self, 'Delete Pose', 'Really Delete ' +str(currentItem) +' ?',
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
if result != QtGui.QMessageBox.Yes:
return False
poseIndex = self.ui.poseList.currentRow()
BT_DeletePose(set = uiSet, poseIndex = poseIndex)
poses = BT_GetPosesFromSet(uiSet)
self.ui.poseList.clear()
self.ui.poseList.addItems(poses)
return True
示例6: loadSelectedSet
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import warning [as 别名]
def loadSelectedSet(self):
selection = BT_GetSelectedSet()
if not selection:
return False
if not cmds.attributeQuery('Blend_Node', ex = True, n = selection):
cmds.warning('Blend_Node attribute not found! This set might not be connected to a BlendTransforms node yet.')
return False
self.ui.poseList.clear()
self.ui.setEdit.setText(selection)
poses = BT_GetPosesFromSet(selection)
if not poses:
return False
self.ui.poseList.addItems(poses)
return True
示例7: BT_ConnectSetup
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import warning [as 别名]
def BT_ConnectSetup(set = None):
if not set or not cmds.objExists(set):
return False
if BT_IsSetupConnected(set = set):
cmds.warning('Setup already connected!')
return False
btNode = cmds.getAttr(set +'.Blend_Node')
if not btNode or not cmds.objExists(btNode):
return False
transforms = cmds.listConnections(set +'.dagSetMembers')
for i in range(0, len(transforms)):
try:
BT_ConnectOutputs(index = i, node = btNode, transform = transforms[i])
except:
pass
mults = cmds.listConnections(btNode, d = True, type = 'multiplyDivide')
if mults:
cmds.delete(mults)
return True
示例8: BT_DoSetup
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import warning [as 别名]
def BT_DoSetup():
sets = cmds.ls(sl = True, type = 'objectSet')
if len(sets) <= 0:
cmds.warning("Select a set.")
return False
set = sets[0]
unitResult = BT_SetUnits()
if unitResult:
QtGui.QMessageBox.warning(BT_GetMayaWindow(), "Blend Transforms", "Units set to centimetres.", "Okay")
result = BT_Setup(set = set)
if not result:
QtGui.QMessageBox.warning(BT_GetMayaWindow(), "Blend Transforms", "Problem with setup. May already be connected.", "Okay")
return False
print('Success!')
return True
示例9: msgConnect
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import warning [as 别名]
def msgConnect(attribFrom, attribTo, debug=0):
# TODO needs a mode to dump all current connections (overwrite/force)
objFrom, attFrom = attribFrom.split('.')
objTo, attTo = attribTo.split('.')
if debug: print 'msgConnect>>> Locals:', locals()
if not attrExists(attribFrom):
cmds.addAttr(objFrom, longName=attFrom, attributeType='message')
if not attrExists(attribTo):
cmds.addAttr(objTo, longName=attTo, attributeType='message')
# check that both atts, if existing are msg atts
for a in (attribTo, attribFrom):
if cmds.getAttr(a, type=1) != 'message':
cmds.warning('msgConnect: Attr, ' + a + ' is not a message attribute. CONNECTION ABORTED.')
return False
try:
return cmds.connectAttr(attribFrom, attribTo, f=True)
except Exception as e:
print e
return False
示例10: save
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import warning [as 别名]
def save(self):
# We start off by getting the name in the text field
name = self.saveNameField.text()
# If the name is not given, then we will not continue and we'll warn the user
# The strip method will remove empty characters from the string, so that if the user entered spaces, it won't be valid
if not name.strip():
cmds.warning("You must give a name!")
return
# We use our library to save with the given name
self.library.save(name)
# Then we repopulate our UI with the new data
self.populate()
# And finally, lets remove the text in the name field so that they don't accidentally overwrite the file
self.saveNameField.setText('')
示例11: BT_DisconnectSetup
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import warning [as 别名]
def BT_DisconnectSetup(set = None):
if not set:
return False
if not BT_IsSetupConnected(set = set):
cmds.warning('Setup already disconnected!')
return False
btNode = cmds.getAttr(set +'.Blend_Node')
if not btNode or not cmds.objExists(btNode):
return False
numOutputs = cmds.getAttr(btNode +'.output', size = True)
print numOutputs
tempMult = None
for i in range(0, numOutputs):
conns = cmds.listConnections(btNode +'.output[' +str(i) +'].outputT', s = False, d = True)
if conns:
tempMult = cmds.createNode('multiplyDivide')
cmds.disconnectAttr(btNode +'.output[' +str(i) +'].outputT', conns[0] +'.translate')
cmds.connectAttr(btNode +'.output[' +str(i) +'].outputT', tempMult +'.input1')
conns = cmds.listConnections(btNode +'.output[' +str(i) +'].outputR', s = False, d = True)
if conns:
tempMult = cmds.createNode('multiplyDivide')
cmds.disconnectAttr(btNode +'.output[' +str(i) +'].outputR', conns[0] +'.rotate')
cmds.connectAttr(btNode +'.output[' +str(i) +'].outputR', tempMult +'.input1')
conns = cmds.listConnections(btNode +'.output[' +str(i) +'].outputS', s = False, d = True)
if conns:
tempMult = cmds.createNode('multiplyDivide')
cmds.disconnectAttr(btNode +'.output[' +str(i) +'].outputS', conns[0] +'.scale')
cmds.connectAttr(btNode +'.output[' +str(i) +'].outputS', tempMult +'.input1')
cmds.select(cl = True)
return True
示例12: addInfluences
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import warning [as 别名]
def addInfluences(skinCluster, influences):
"""
Add influences to the skin cluster. Expects full path influences. Will
try to reach the bind pose before attached the new influences to the skin
cluster.
:param str skinCluster:
:param list influences:
"""
# get existing influences
existing = cmds.skinCluster(skinCluster, query=True, influence=True)
existing = cmds.ls(existing, l=True)
# try restoring dag pose
try:
cmds.dagPose(existing, restore=True, g=True, bindPose=True)
except:
cmds.warning("Unable to reach dagPose!")
# add influences
for influence in influences:
if influence not in existing:
cmds.skinCluster(
skinCluster,
edit=True,
addInfluence=influence,
weight=0.0
)
示例13: checkbox
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import warning [as 别名]
def checkbox(*_, **kwargs):
cmds.warning("checkbox menu is %i" % int(kwargs['sender'].checkBox))
示例14: fire_callback
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import warning [as 别名]
def fire_callback(name, *args, **kwargs):
"""
Fire the runtimeEvent associated with <name>
Print a warning if the event does not exist
"""
rc = RuntimeEvent.find(name)
if rc:
rc(*args, **kwargs)
else:
cmds.warning("no RuntimeEvent named %s. Create one using RuntimeEvent.create" % name)