コード例 #1
0
def back_starter(a, charaName, inputpath, namespace, exporttype, topnode,
                 assetpath, test, yeti, stepValue):

    print '##############' * 5

    print charaName
    print inputpath
    print namespace
    print exporttype
    print topnode
    print assetpath
    print test
    print yeti
    print stepValue

    print '##############' * 5

    opc = util.outputPathConf(inputpath, test=test)
    opc.createOutputDir(charaName)

    abcOutput = opc.publishfullabcpath + '/' + charaName + '.abc'
    charaOutput = opc.publishfullpath + '/' + charaName + '.abc'

    abcSet = ['ABCset']
    nsChara = namespace

    batch.abcExport(nsChara, abcSet, abcOutput, inputpath, yeti, stepValue)

    abcFiles = os.listdir(opc.publishfullabcpath)

    if len(abcFiles) == 0:
        opc.removeDir()
        print 'abc not found'
        return
    print abcFiles
    allOutput = []
    for abc in abcFiles:
        ns = abc.replace(charaName + '_', '').replace('.abc', '')
        if '___' in ns:
            ns = ns.replace('___', ':')

        abcOutput = opc.publishfullabcpath + '/' + abc
        charaOutput = opc.publishfullpath + '/' + abc.replace('abc', 'ma')
        batch.abcAttach(assetpath, ns, ns + ':' + topnode, abcOutput,
                        charaOutput)
        allOutput.append([abc.replace('abc', 'ma'), abc])
    opc.makeCurrentDir()

    for output in allOutput:
        print '#' * 20
        print output
        charaOutput = opc.publishcurrentpath + '/' + output[0]
        abcOutput = opc.publishcurrentpath + '/abc/' + output[1]
        batch.repABC(charaOutput, abcOutput)

    return 0
コード例 #2
0
    def execExport(self, charaName, inputpath):
        opc = util.outputPathConf(inputpath, test=testRun)
        opc.createOutputDir(charaName)

        abcOutput = opc.publishfullabcpath + '/' + charaName + '.abc'
        hairOutput = opc.publishfullpath + '/' + 'hair.abc'
        charaOutput = opc.publishfullpath + '/' + charaName + '.abc'
        cameraOutput = opc.publishfullpath + '/' + 'camera.abc'

        charaSetup = import_module('setting.' + charaName + 'Setup')
        batch.abcExport(charaSetup.nsChara, charaSetup.abcSet, abcOutput,
                        inputpath)

        abcFiles = os.listdir(opc.publishfullabcpath)
        if len(abcFiles) == 0:
            opc.removeDir()
            return
        print abcFiles
        allOutput = []
        for abc in abcFiles:
            ns = abc.replace(charaName + '_', '').replace('.abc', '')
            hairOutput = opc.publishfullpath + '/' + 'hair_' + ns + '.ma'
            if '___' in ns:
                ns = ns.replace('___', ':')
            if charaSetup.assetHair != '':
                batch.hairExport(charaSetup.assetHair, ns,
                                 ns + ':' + charaSetup.topNode, hairOutput,
                                 inputpath)

            abcOutput = opc.publishfullabcpath + '/' + abc
            charaOutput = opc.publishfullpath + '/' + abc.replace('abc', 'ma')
            batch.abcAttach(charaSetup.assetChara, ns,
                            ns + ':' + charaSetup.topNode, abcOutput,
                            charaOutput)
            allOutput.append([abc.replace('abc', 'ma'), abc])
        opc.makeCurrentDir()

        for output in allOutput:
            charaOutput = opc.publishcurrentpath + '/' + output[0]
            abcOutput = opc.publishcurrentpath + '/abc/' + output[1]
            batch.repABC(charaOutput, abcOutput)
コード例 #3
0
def back_starter(**kwargs):
    argsdic = kwargs
    inputpath = argsdic['inputpath']
    project = argsdic['project']
    charaName = argsdic['chara']
    exporttype = argsdic['exporttype']
    exportitem = argsdic['exportitem']
    topnode = argsdic['topnode']
    assetpath = argsdic['assetpath']
    stepValue = argsdic['stepValue']
    env_load = argsdic['env_load']
    testmode = argsdic['testmode']
    if exporttype == 'anim':
        isAnim = True
    else:
        isAnim = False

    opc = util.outputPathConf(inputpath, isAnim=isAnim, test=testmode)

    if exporttype == 'camera':
        opc.createCamOutputDir()
    else:
        opc.createOutputDir(charaName)
    abcOutput = opc.publishfullabcpath + '/' + charaName + '.abc'
    charaOutput = opc.publishfullpath + '/' + charaName + '.abc'
    argsdic['abcOutput'] = abcOutput
    argsdic['output'] = opc.publishfullanimpath

    if exporttype == 'anim':
        batch.animExport(**argsdic)
        animFiles = os.listdir(opc.publishfullanimpath)
        if charaName == "camera_base" or charaName == "camera_simple":
            os.rmdir(output)
            if len(os.listdir(os.path.dirname(output)))==0:
                os.rmdir(output)
                os.rmdir(os.path.dirname(output))
                if os.path.dirname(output).split("/")[-1]=="v001":
                    os.rmdir(os.path.dirname(os.path.dirname(output)))
            opc.makeCurrentDir()
            return
        if len(animFiles)==0:
            opc.removeDir()
            return
        for animFile in animFiles:
            ns = animFile.replace('anim_', '').replace('.ma', '')
            animOutput = opc.publishfullanimpath + '/' + animFile
            charaOutput = opc.publishfullpath + '/' + ns + '.ma'
            argsdic['animOutput'] = animOutput
            argsdic['charaOutput'] = charaOutput
            # argsdic['ns'] = ns.replace("__", ":")
            argsdic['ns'] = ns
            batch.animAttach(**argsdic)

        opc.makeCurrentDir()

        for animFile in animFiles:
            if animFile[:5] != 'anim_':continue
            if animFile[-3:] != '.ma':continue
            ns = animFile.replace('anim_', '').replace('.ma', '')
            argsdic['ns'] = ns
            # argsdic['ns'] = ns.replace("_", ":")
            argsdic['animPath'] = (opc.publishcurrentpath + '/anim/' + animFile)
            argsdic['scene'] = (opc.publishcurrentpath + '/' + ns + '.ma')
            batch.animReplace(**argsdic)             

    elif exporttype == 'abc':
        # opc.createOutputDir(charaName)
        batch.abcExport(**argsdic)
        abcFiles = os.listdir(opc.publishfullabcpath)
        print opc.publishfullabcpath
        if len(abcFiles) == 0:
            opc.removeDir()
            print 'abc not found'
            return
        allOutput = []
        for abc in abcFiles:
            ns = abc.replace(charaName + '_', '').replace('.abc', '')
            if '___' in ns:
                ns = ns.replace('___', ':')
            abcOutput = opc.publishfullabcpath + '/' + abc
            charaOutput = opc.publishfullpath + '/' + abc.replace('abc', 'ma')
            argsdic['Ntopnode'] = ns + ':' + argsdic['topnode']
            argsdic['ns'] = ns
            argsdic['attachPath'] = charaOutput
            argsdic['abcOutput'] = abcOutput
            batch.abcAttach(**argsdic)
            allOutput.append([abc.replace('abc', 'ma'), abc])
        opc.makeCurrentDir()
        for output in allOutput:
            argsdic['charaOutput'] = opc.publishcurrentpath + '/' + output[0]
            argsdic['abcOutput'] = opc.publishcurrentpath + '/abc/' + output[1]
            batch.repABC(**argsdic)

    elif exporttype == 'camera':
        argsdic['publishPath'] = opc.publishfullpath #ディレクトリ名
        oFilename = opc.sequence + opc.shot + '_cam'
        argsdic['camOutput'] = '{}/{}.abc'.format(opc.publishfullcampath, oFilename) #フルパスとファイル名
        batch.camExport(**argsdic)
        camFiles = os.listdir(opc.publishfullcampath)
        if len(camFiles) == 0:
            print 'camera not found'
            return
        for camFile in camFiles:
            srcFile = os.path.join(opc.publishfullpath, camFile)
            if srcFile.split('.')[-1] == 'ma':
                dstDir = os.path.join(opc.publishfullpath, '..')
                try:
                    shutil.copy(srcFile, dstDir)
                except:
                    pass
        opc.makeCurrentDir()

    elif exporttype == 'abc_anim':
        batch.animExport(**argsdic)
        animFiles = os.listdir(opc.publishfullanimpath)
        if charaName == "camera_base" or charaName == "camera_simple":
            os.rmdir(output)
            if len(os.listdir(os.path.dirname(output)))==0:
                os.rmdir(output)
                os.rmdir(os.path.dirname(output))
                if os.path.dirname(output).split("/")[-1]=="v001":
                    os.rmdir(os.path.dirname(os.path.dirname(output)))
            opc.makeCurrentDir()
            return
        if len(animFiles)==0:
            opc.removeDir()
            return
        batch.abcExport(**argsdic)
        abcFiles = os.listdir(opc.publishfullabcpath)
        if len(abcFiles) == 0:
            opc.removeDir()
            print 'abc not found'
            return
        allOutput = []
        for abc in abcFiles:
            ns = abc.replace(charaName + '_', '').replace('.abc', '')
            if '___' in ns:
                ns = ns.replace('___', ':')
            abcOutput = opc.publishfullabcpath + '/' + abc
            charaOutput = opc.publishfullpath + '/' + abc.replace('abc', 'ma')
            argsdic['Ntopnode'] = ns + ':' + argsdic['topnode']
            argsdic['ns'] = ns
            argsdic['attachPath'] = charaOutput
            argsdic['abcOutput'] = abcOutput
            batch.abcAttach(**argsdic)
            allOutput.append([abc.replace('abc', 'ma'), abc])

        opc.makeCurrentDir()

        for animFile in animFiles:
            ns = animFile.replace('anim_', '').replace('.ma', '')
            animOutput = opc.publishfullanimpath + '/' + animFile
            charaOutput = opc.publishfullpath + '/' + ns + '.ma'
            argsdic['animOutput'] = animOutput
            argsdic['charaOutput'] = charaOutput
            argsdic['ns'] = ns
            batch.animAttach(**argsdic)

        for output in allOutput:
            argsdic['charaOutput'] = opc.publishcurrentpath + '/' + output[0]
            argsdic['abcOutput'] = opc.publishcurrentpath + '/abc/' + output[1]
            batch.repABC(**argsdic)


    print 'Output directry: {}'.format(opc.publishfullpath.replace('/','\\'))
    print '=================END==================='