当前位置: 首页>>代码示例>>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;未经允许,请勿转载。