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