def execExportAnim(self, charaName, inputpath): opc = util.outputPathConf(inputpath, True, test=testRun) opc.createOutputDir(charaName) output = opc.publishfullanimpath charaSetup = import_module('setting.' + charaName + 'Setup') # regex = ["*_Cntrl","*_Cntrl_01","*_Cntrl_02","*_Cntrl_03","*_Cntrl_04","*Attr_CntrlShape","*Wire","*All_Grp","*_ctrl"] regex = charaSetup.regex regex = ','.join(regex) batch.animExport(output, 'anim', charaSetup.nsChara, regex, inputpath) animFiles = os.listdir(opc.publishfullanimpath) 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' batch.animAttach(charaSetup.assetChara, ns, animOutput, charaOutput) opc.makeCurrentDir() for animFile in animFiles: batch.animReplace(ns, opc.publishcurrentpath + '/anim/' + animFile, opc.publishcurrentpath + '/' + ns + '.ma')
def back_starter(**kwargs): argsdic = kwargs inputpath = argsdic['inputpath'] project = argsdic['project'] charaName = argsdic['chara'] nsChara = argsdic['namespace'] exporttype = argsdic['exporttype'] exportitem = argsdic['exportitem'] topnode = argsdic['topnode'] assetpath = argsdic['assetpath'] stepValue = argsdic['stepValue'] env_load = argsdic['env_load'] framerange_output = argsdic['framgerange_output'] testmode = argsdic['testmode'] opc = util.outputPathConf(inputpath, isAnim=True, test=testmode) opc.createOutputDir(charaName) # abcOutput = opc.publishfullabcpath + '/' + charaName + '.abc' charaOutput = opc.publishfullpath + '/' + charaName + '.abc' output = opc.publishfullanimpath import pdb pdb.set_trace() batch.animExport(output, exporttype, nsChara, exportitem, inputpath, env_load, project, framerange_output) animFiles = os.listdir(opc.publishfullanimpath) 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' batch.animAttach(assetpath, ns, animOutput, charaOutput, env_load, project) opc.makeCurrentDir() for animFile in animFiles: if animFile[:5] != 'anim_': continue if animFile[-3:] != '.ma': continue ns = animFile.replace('anim_', '').replace('.ma', '') batch.animReplace(ns, opc.publishcurrentpath + '/anim/' + animFile, opc.publishcurrentpath + '/' + ns + '.ma', env_load, project) print '=================END===================' return 0
def execExportAnim(self, charaName, inputpath, namespace, exporttype, topnode): opc = util.outputPathConf(inputpath, True, test=testRun) opc.createOutputDir(charaName) abcOutput = opc.publishfullabcpath + '/' + charaName + '.abc' charaOutput = opc.publishfullpath + '/' + charaName + '.abc' # charaSetup = import_module('setting.'+charaName+'Setup') abcSet = ['ABCset'] nsChara = namespace regex = [] output = opc.publishfullanimpath regex = ','.join(regex) batch.animExport(output, 'anim', nsChara, regex, inputpath) animFiles = os.listdir(opc.publishfullanimpath) 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' batch.animAttach(assetChara, ns, animOutput, charaOutput) opc.makeCurrentDir() for animFile in animFiles: if animFile[:5] != 'anim_': continue if animFile[-3:] != '.ma': continue ns = animFile.replace('anim_', '').replace('.ma', '') batch.animReplace(ns, opc.publishcurrentpath + '/anim/' + animFile, opc.publishcurrentpath + '/' + ns + '.ma')
import util import batch # scenePath = 'P:\\Project\\mem2\\shots\\roll05\\s139T\\c059\\work\\okano\\tknTest.ma' scenePath = 'P:\\Project\\mem2\\shots\\roll05\\s139T\\GEN\\work\\okano\\50_FX\\maya\\scenes\\aaa.mb' opc = util.outputPathConf(scenePath) opc.createOutputDir('TKN') output = opc.publishfullpath regex = [ "*_Cntrl", "*_Cntrl_01", "*_Cntrl_02", "*_Cntrl_03", "*_Cntrl_04", "*Attr_CntrlShape", "*Wire", "*All_Grp", "*_ctrl" ] regex = ','.join(regex) batch.animExport(output, 'anim', regex, scenePath)
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==================='