當前位置: 首頁>>代碼示例>>Python>>正文


Python cmds.warning方法代碼示例

本文整理匯總了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 
開發者ID:getavalon,項目名稱:core,代碼行數:25,代碼來源:util.py

示例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) 
開發者ID:getavalon,項目名稱:core,代碼行數:23,代碼來源:commands.py

示例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() 
開發者ID:duncanskertchly,項目名稱:BlendTransforms,代碼行數:31,代碼來源:BlendTransforms.py

示例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 
開發者ID:duncanskertchly,項目名稱:BlendTransforms,代碼行數:23,代碼來源:BlendTransforms.py

示例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 
開發者ID:duncanskertchly,項目名稱:BlendTransforms,代碼行數:24,代碼來源:BlendTransforms.py

示例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 
開發者ID:duncanskertchly,項目名稱:BlendTransforms,代碼行數:20,代碼來源:BlendTransforms.py

示例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 
開發者ID:duncanskertchly,項目名稱:BlendTransforms,代碼行數:27,代碼來源:BlendTransforms.py

示例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 
開發者ID:duncanskertchly,項目名稱:BlendTransforms,代碼行數:22,代碼來源:BlendTransforms.py

示例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 
開發者ID:chrisevans3d,項目名稱:uExport,代碼行數:23,代碼來源:uExport.py

示例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('') 
開發者ID:dgovil,項目名稱:PythonForMayaSamples,代碼行數:18,代碼來源:controllerLibrary.py

示例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 
開發者ID:duncanskertchly,項目名稱:BlendTransforms,代碼行數:41,代碼來源:BlendTransforms.py

示例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
            ) 
開發者ID:robertjoosten,項目名稱:maya-skinning-tools,代碼行數:30,代碼來源:influence.py

示例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)) 
開發者ID:theodox,項目名稱:mGui,代碼行數:4,代碼來源:menu_loader.py

示例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) 
開發者ID:theodox,項目名稱:mGui,代碼行數:13,代碼來源:runtimeCommands.py


注:本文中的maya.cmds.warning方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。