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


Python cmds.internalVar方法代碼示例

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


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

示例1: read

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import internalVar [as 別名]
def read(cls):
        """ Load history

        Return:
            history(list): list of commands

        """

        mayaScriptDir = cmds.internalVar(userScriptDir=True)
        historyPath = os.path.join(mayaScriptDir, "rushHistory.txt")
        if os.path.exists(historyPath):
            try:
                historyFile = open(historyPath, 'r')
                history = historyFile.read().splitlines()
                historyFile.close()
                return history
            except IOError:
                return []
        else:
            return [] 
開發者ID:minoue,項目名稱:rush,代碼行數:22,代碼來源:Rush.py

示例2: userPrefDir

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import internalVar [as 別名]
def userPrefDir():
    return cmds.internalVar(userPrefDir=True) 
開發者ID:liorbenhorin,項目名稱:pipeline,代碼行數:4,代碼來源:maya_warpper.py

示例3: get_data_folder

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import internalVar [as 別名]
def get_data_folder():
        from maya import cmds
        return cmds.internalVar(userPrefDir=True) 
開發者ID:luckylyk,項目名稱:hotbox_designer,代碼行數:5,代碼來源:applications.py

示例4: loadConfig

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import internalVar [as 別名]
def loadConfig():
    """ Load config file

    Return:
        config(list): List of path module paths

    """
    configFilePath = os.path.normpath(os.path.join(
        cmds.internalVar(userScriptDir=True), 'rush.json'))

    defaultModulePath = os.path.normpath(os.path.join(
        cmds.internalVar(userScriptDir=True), 'rush', 'module'))

    config = [defaultModulePath]

    # Use only default module path if config file does not exist
    if not os.path.exists(configFilePath):
        print("Additional config file not found: %s" % configFilePath)
        return config

    # Open and load config file in use home dir and append it to the
    # config list
    try:
        fileData = open(configFilePath, 'r')
        extraConfig = json.load(fileData)
        additionalPaths = extraConfig["path"]
        fileData.close()
    except IOError:
        print("Failed to load config file")

    config.extend(additionalPaths)

    return config 
開發者ID:minoue,項目名稱:rush,代碼行數:35,代碼來源:__init__.py

示例5: save

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import internalVar [as 別名]
def save(self):
        """ Write history

        """

        mayaScriptDir = cmds.internalVar(userScriptDir=True)
        historyPath = os.path.join(mayaScriptDir, "rushHistory.txt")
        try:
            historyFile = open(historyPath, 'w')
            for line in self.history:
                historyFile.write(line + "\n")
            historyFile.close()
        except IOError:
            pass 
開發者ID:minoue,項目名稱:rush,代碼行數:16,代碼來源:Rush.py

示例6: exportControl

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import internalVar [as 別名]
def exportControl(curves, name):
    '''Export a control curve
    '''

    if not isinstance(curves, (list, tuple)):
        curves = [curves]

    grp = mc.group(em=True, name=name)

    for each in curves:
        ml_parentShape.parentShape(each, grp)

    mc.delete(grp, constructionHistory=True)

    tempFile = mc.internalVar(userTmpDir=True)
    tempFile+='tempControlExport.ma'

    mc.select(grp)
    mc.file(tempFile, force=True, typ='mayaAscii', exportSelected=True)

    with open(tempFile, 'r') as f:
        contents = f.read()

    ctrlLines = ['//ML Control Curve: '+name]

    record = False
    for line in contents.splitlines():
        if line.startswith('select'):
            break
        if line.strip().startswith('rename'): #skip the uuid commands
            continue
        if line.startswith('createNode transform'):
            record = True
            ctrlLines.append('string $ml_tempCtrlName = `createNode transform -n "'+name+'_#"`;')
        elif line.startswith('createNode nurbsCurve'):
            ctrlLines.append('createNode nurbsCurve -p $ml_tempCtrlName;')
        elif record:
            ctrlLines.append(line)


    with open(controlFilePath(name), 'w') as f:
        f.write('\n'.join(ctrlLines))

    return grp 
開發者ID:morganloomis,項目名稱:ml_tools,代碼行數:46,代碼來源:ml_controlLibrary.py


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