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


Python mel.eval方法代碼示例

本文整理匯總了Python中maya.mel.eval方法的典型用法代碼示例。如果您正苦於以下問題:Python mel.eval方法的具體用法?Python mel.eval怎麽用?Python mel.eval使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在maya.mel的用法示例。


在下文中一共展示了mel.eval方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: parse_active_scene

# 需要導入模塊: from maya import mel [as 別名]
# 或者: from maya.mel import eval [as 別名]
def parse_active_scene():
    """Parse active scene for arguments for capture()

    *Resolution taken from render settings.

    """

    time_control = mel.eval("$gPlayBackSlider = $gPlayBackSlider")

    return {
        "start_frame": cmds.playbackOptions(minTime=True, query=True),
        "end_frame": cmds.playbackOptions(maxTime=True, query=True),
        "width": cmds.getAttr("defaultResolution.width"),
        "height": cmds.getAttr("defaultResolution.height"),
        "compression": cmds.optionVar(query="playblastCompression"),
        "filename": (cmds.optionVar(query="playblastFile")
                     if cmds.optionVar(query="playblastSaveToFile") else None),
        "format": cmds.optionVar(query="playblastFormat"),
        "off_screen": (True if cmds.optionVar(query="playblastOffscreen")
                       else False),
        "show_ornaments": (True if cmds.optionVar(query="playblastShowOrnaments")
                       else False),
        "quality": cmds.optionVar(query="playblastQuality"),
        "sound": cmds.timeControl(time_control, q=True, sound=True) or None
    } 
開發者ID:bumpybox,項目名稱:pyblish-bumpybox,代碼行數:27,代碼來源:capture.py

示例2: doControlAction

# 需要導入模塊: from maya import mel [as 別名]
# 或者: from maya.mel import eval [as 別名]
def doControlAction(self, destinationList, *args):
        """ Action to do when creating a control
            Do action as user wants:
                1 = New control
                2 = Add shape
                3 = Replace shapes
        """
        if self.cvAction == 1: #new control
            pass
        else:
            if destinationList:
                if self.cvAction == 2: #add shape
                    self.ctrls.transferShape(True, False, self.cvCurve, destinationList, True)
                elif self.cvAction == 3: #replace shapes
                    self.ctrls.transferShape(True, True, self.cvCurve, destinationList, True)
            else:
                cmds.delete(self.cvCurve)
                mel.eval("warning \""+self.langDic[self.langName]['e011_notSelShape']+"\";") 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:20,代碼來源:dpBaseControlClass.py

示例3: dpMain

# 需要導入模塊: from maya import mel [as 別名]
# 或者: from maya.mel import eval [as 別名]
def dpMain(self, *args):
        """ Main function.
            Check existen nodes and call the scripted function.
        """
        callAction = False
        self.allGrp = self.dpFindAllGrpBySelection()
        if self.allGrp:
            callAction = True
        else:
            allGrpList = self.dpCountAllGrp()
            if allGrpList:
                if len(allGrpList) > 1:
                    self.allGrp = cmds.confirmDialog(title=self.langDic[self.langName]["m166_selAllControls"], message=self.langDic[self.langName]["m168_wichAllGrp"], button=allGrpList)
                else:
                    self.allGrp = self.dpCheckAllGrp(self.allGrp)
                if self.allGrp:
                    callAction = True
                else:
                    self.allGrp = self.dpFindAllGrp()
                    if self.allGrp:
                        callAction = True
        if callAction:
            self.dpSelectAllCtrls(self.allGrp)
        else:
            mel.eval("warning \""+self.langDic[self.langName]["e019_notFoundAllGrp"]+"\";") 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:27,代碼來源:dpSelectAllControls.py

示例4: dpLoadBSNode

# 需要導入模塊: from maya import mel [as 別名]
# 或者: from maya.mel import eval [as 別名]
def dpLoadBSNode(self, *args):
        """ Load selected object as blendShapeNode
        """
        selectedList = cmds.ls(selection=True)
        if selectedList:
            if cmds.objectType(selectedList[0]) == "blendShape":
                cmds.textField(self.bsNodeTextField, edit=True, text=selectedList[0])
                self.dpLoadBSTgtList(selectedList[0])
                self.bsNode = selectedList[0]
            elif cmds.objectType(selectedList[0]) == "transform":
                meshList = cmds.listRelatives(selectedList[0], children=True, shapes=True, noIntermediate=True, type="mesh")
                if meshList:
                    bsNodeList = cmds.listConnections(meshList[0], type="blendShape")
                    if bsNodeList:
                        self.dpLoadBSTgtList(bsNodeList[0])
                        self.bsNode = bsNodeList[0]
                    else:
                        mel.eval("warning \""+self.langDic[self.langName]["e018_selectBlendShape"]+"\";")
                else:
                    mel.eval("warning \""+self.langDic[self.langName]["e018_selectBlendShape"]+"\";")
            else:
                mel.eval("warning \""+self.langDic[self.langName]["e018_selectBlendShape"]+"\";")
        else:
            mel.eval("warning \""+self.langDic[self.langName]["e018_selectBlendShape"]+"\";") 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:26,代碼來源:dpFacialControl.py

示例5: dpLoadGeoToAttach

# 需要導入模塊: from maya import mel [as 別名]
# 或者: from maya.mel import eval [as 別名]
def dpLoadGeoToAttach(self, geoName=None, geoFromUI=None, *args):
        """ Load selected object a geometry to attach rivet.
        """
        if geoName:
            selectedList = [geoName]
        elif geoFromUI:
            selectedList = [cmds.textField(self.geoToAttachTF, query=True, text=True)]
        else:
            selectedList = cmds.ls(selection=True)
        if selectedList:
            if self.dpCheckGeometry(selectedList[0]):
                self.geoToAttach = selectedList[0]
                cmds.textField(self.geoToAttachTF, edit=True, text=self.geoToAttach)
                self.dpLoadUVSet(self.geoToAttach)
        else:
            mel.eval("warning \"Select a geometry in order use it to attach rivets, please.\";") 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:18,代碼來源:dpRivet.py

示例6: dpCheckGeometry

# 需要導入模塊: from maya import mel [as 別名]
# 或者: from maya.mel import eval [as 別名]
def dpCheckGeometry(self, item, *args):
        isGeometry = False
        if item:
            if cmds.objExists(item):
                childList = cmds.listRelatives(item, children=True)
                if childList:
                    self.itemType = cmds.objectType(childList[0])
                    if self.itemType == "mesh" or self.itemType == "nurbsSurface":
                        if self.itemType == "mesh":
                            self.meshNode = childList[0]
                        isGeometry = True
                    else:
                        mel.eval("warning \""+item+" is not a geometry.\";")
                else:
                    mel.eval("warning \"Select the transform node instead of "+item+" shape, please.\";")
            else:
                mel.eval("warning \""+item+" does not exists, maybe it was deleted, sorry.\";")
        else:
            mel.eval("warning \"Not found "+item+"\";")
        return isGeometry 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:22,代碼來源:dpRivet.py

示例7: verifyGuideModuleIntegrity

# 需要導入模塊: from maya import mel [as 別名]
# 或者: from maya.mel import eval [as 別名]
def verifyGuideModuleIntegrity(self, *args):
        """ This function verify the integrity of the current module.
            Returns True if Ok and False if Fail.
        """
        # conditionals to be elegible as a rigged guide module:
        if cmds.objExists(self.moduleGrp):
            if cmds.objExists(self.moduleGrp+'.guideBase'):
                if cmds.getAttr(self.moduleGrp+'.guideBase') == 1:
                    return True
                else:
                    try:
                        self.deleteModule()
                        mel.eval('warning \"'+ self.langDic[self.langName]['e000_GuideNotFound'] +' - '+ self.moduleGrp +'\";')
                    except:
                        pass
                    return False 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:18,代碼來源:dpBaseClass.py

示例8: global_reload

# 需要導入模塊: from maya import mel [as 別名]
# 或者: from maya.mel import eval [as 別名]
def global_reload():
    """ filter all loaded spore modules in the script dir and
    reload each of them. this is a convenience function for developing """

    import inspect

    windowed = mel.eval('$temp1=$gMainWindow')
    if windowed:
        scripts_dir = os.path.dirname(__file__)
        for key, module in sys.modules.iteritems():

            try:
                module_path = inspect.getfile(module)
            except TypeError:
                continue

            if module_path == __file__:
                continue

            if module_path.startswith(scripts_dir):
                reload(module) 
開發者ID:wiremas,項目名稱:spore,代碼行數:23,代碼來源:dispatcher.py

示例9: __init__

# 需要導入模塊: from maya import mel [as 別名]
# 或者: from maya.mel import eval [as 別名]
def __init__(self):

        # set environment
        self.set_environment()

        # initialize global services
        self.spore_globals = settings.SporeGlobals()

        # initialize ui only in gui mode
        windowed = mel.eval('$temp1=$gMainWindow')
        if windowed:
            self.spore_manager = manager.SporeManager()
            self.spore_reporter = reporter.Reporter()

        #  self.spore_globals = self.parse_prefs()
        self.logger = self.get_logger()
        self.menu = self.build_menu()
        self.callbacks = self.add_callbacks()
        self.set_tracking_dir() 
開發者ID:wiremas,項目名稱:spore,代碼行數:21,代碼來源:dispatcher.py

示例10: getChannelBoxMenu

# 需要導入模塊: from maya import mel [as 別名]
# 或者: from maya.mel import eval [as 別名]
def getChannelBoxMenu():
    """
    Get ChannelBox, convert the main channel box to QT and return the QMenu 
    which is part of the channel box' children.

    :return: Maya's main channel box menu
    :rtype: QMenu
    """
    channelBox = getChannelBox()
    
    for child in channelBox.children():
        if type(child) == QMenu:
            cmd = "generateChannelMenu {0} 1".format(qtToMaya(child))
            mel.eval(cmd)
            return child


# ---------------------------------------------------------------------------- 
開發者ID:robertjoosten,項目名稱:maya-channel-box-plus,代碼行數:20,代碼來源:ui.py

示例11: __init__

# 需要導入模塊: from maya import mel [as 別名]
# 或者: from maya.mel import eval [as 別名]
def __init__(self, total, message=None):
        # set numeration variables
        self._value = 0
        self._total = total
        self._message = message

        # get progress bar
        self._bar = None
        self._batch = cmds.about(batch=True)

        if not self._batch:
            self._bar = mel.eval("$tmp = $gMainProgressBar")
            cmds.progressBar(
                self._bar,
                edit=True,
                isInterruptable=False,
                status=self.message,
                minValue=0,
                maxValue=total
            ) 
開發者ID:robertjoosten,項目名稱:maya-skinning-tools,代碼行數:22,代碼來源:progress.py

示例12: shelf

# 需要導入模塊: from maya import mel [as 別名]
# 或者: from maya.mel import eval [as 別名]
def shelf():
    """
    Add a new shelf in Maya with all the tools that are provided in the
    SHELF_TOOLS variable. If the tab exists it will be deleted and re-created
    from scratch.
    """
    # get top shelf
    gShelfTopLevel = mel.eval("$tmpVar=$gShelfTopLevel")

    # get top shelf names
    shelves = cmds.tabLayout(gShelfTopLevel, query=1, ca=1)
    
    # delete shelf if it exists
    if SHELF_NAME in shelves:
        cmds.deleteUI(SHELF_NAME)

    # create shelf
    cmds.shelfLayout(SHELF_NAME, parent=gShelfTopLevel)
    
    # add modules
    for tool in SHELF_TOOLS:
        if tool.get("image1"):
            cmds.shelfButton(style="iconOnly", parent=SHELF_NAME, **tool)
        else:
            cmds.shelfButton(style="textOnly", parent=SHELF_NAME, **tool) 
開發者ID:robertjoosten,項目名稱:maya-skinning-tools,代碼行數:27,代碼來源:install.py

示例13: loadUiType

# 需要導入模塊: from maya import mel [as 別名]
# 或者: from maya.mel import eval [as 別名]
def loadUiType(uiFile):
    """
    Pyside lacks the "loadUiType" command, so we have to convert the ui file to py code in-memory first
    and then execute it in a special frame to retrieve the form_class.
    http://tech-artists.org/forum/showthread.php?3035-PySide-in-Maya-2013 (ChrisE)
    """
    parsed = xml.parse(uiFile)
    widget_class = parsed.find('widget').get('class')
    form_class = parsed.find('class').text

    with open(uiFile, 'r') as f:
        o = StringIO()
        frame = {}

        pysideuic.compileUi(f, o, indent=0)
        pyc = compile(o.getvalue(), '<string>', 'exec')
        exec pyc in frame

        #Fetch the base_class and form class based on their type in the xml from designer
        form_class = frame['Ui_%s'%form_class]
        base_class = eval('QtWidgets.%s'%widget_class)
    return form_class, base_class 
開發者ID:chrisevans3d,項目名稱:uExport,代碼行數:24,代碼來源:uExport.py

示例14: getStatusLine

# 需要導入模塊: from maya import mel [as 別名]
# 或者: from maya.mel import eval [as 別名]
def getStatusLine():
    """
    Get the QWidget of Maya's status line. 
    
    :return: QWidget of Maya's status line
    :rtype: QWidget
    """
    gStatusLine = mel.eval("$tmpVar=$gStatusLine")
    return mayaToQT(gStatusLine)

# ---------------------------------------------------------------------------- 
開發者ID:robertjoosten,項目名稱:maya-command-search,代碼行數:13,代碼來源:utils.py

示例15: dpAddSelect

# 需要導入模塊: from maya import mel [as 別名]
# 或者: from maya.mel import eval [as 別名]
def dpAddSelect(self, *args):
        """ Add selected items to target textscroll list
        """
        # declare variables
        selMeshList = []
        # get selection
        selList = cmds.ls(selection=True)
        # check if there is any selected object in order to continue
        if selList:
            # find meshes transforms
            for item in selList:
                if not item in selMeshList:
                    if self.dpCheckGeometry(item):
                        selMeshList.append(item)
                    else:
                        return
            if selMeshList:
                # get current list
                currentList = cmds.textScrollList(self.targetScrollList, query=True, allItems=True)
                if currentList:
                    # clear current list
                    cmds.textScrollList(self.targetScrollList, edit=True, removeAll=True)
                    # avoid repeated items
                    for item in selMeshList:
                        if not item in currentList:
                            currentList.append(item)
                    # refresh textScrollList
                    cmds.textScrollList(self.targetScrollList, edit=True, append=currentList)
                else:
                    # add selected items in the empyt target scroll list
                    cmds.textScrollList(self.targetScrollList, edit=True, append=selMeshList)
            else:
                mel.eval("warning \""+self.langDic[self.langName]["i055_tgtSelect"]+"\";")
        else:
            mel.eval("warning \""+self.langDic[self.langName]["i055_tgtSelect"]+"\";") 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:37,代碼來源:dpTargetMirror.py


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