python 来自https://stackoverflow.com/questions/19677109/script-for-automatically-loading-reference-fil

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 来自https://stackoverflow.com/questions/19677109/script-for-automatically-loading-reference-fil相关的知识,希望对你有一定的参考价值。

import maya.cmds as cmds
import os

def openFileAndRemapRefs():
    multipleFilters = "Maya Files (*.ma *.mb);;Maya ASCII (*.ma);;Maya Binary (*.mb);;All Files (*.*)"

    # Choose file to open
    filename = cmds.fileDialog2(fileFilter=multipleFilters, dialogStyle=2, fileMode=1)

    # Open file with no reference loaded
    cmds.file( filename[0], open=True, force=True );

    # Dir containing the references
    refDir = 'C:/References'

    # A list of any references found in the scene
    references = cmds.ls(type='reference')

    # For each reference found in scene, load it with the path leading up to it replaced
    for ref in references:
        refFilepath = cmds.referenceQuery(ref, f=True)
        refFilename = os.path.basename( refFilepath )       
        print 'Reference ' + ref + ' found at: ' + cmds.referenceQuery(ref, f=True)   
        cmds.file( os.path.join(refDir, refFilename), loadReference=ref, options='v=0;')

openFileAndRemapRefs()

以上是关于python 来自https://stackoverflow.com/questions/19677109/script-for-automatically-loading-reference-fil的主要内容,如果未能解决你的问题,请参考以下文章

python 来自Python的通知

python 来自Python的Git pull

python 来自Python的os文件系统

一封来自“Python”的信

来自 Black Hat Python 书的 Python 嗅探

“路径 python3(来自 --python=python3)不存在”错误