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 current_refresh_button_clicked(self): import copy_tool.copy_main as copy_main opc = util.outputPathConf(self.inputpath) shot_path = opc.publishshotpath if self.debug: current_path = os.path.join(shot_path, "publish", "test_charSet") else: current_path = os.path.join(shot_path, "publish", "charSet") copy_main.copy_main(current_path)
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
def execExportCam(self, inputpath, camScale): opc = util.outputPathConf(inputpath, test=testRun) opc.createCamOutputDir() batch.camExport(opc.publishfullpath, opc.sequence + opc.shot + '_cam', camScale, inputpath) camFiles = os.listdir(opc.publishfullpath) for camFile in camFiles: srcFile = os.path.join(opc.publishfullpath, camFile) dstDir = os.path.join(opc.publishfullpath, '..') try: shutil.copy(srcFile, dstDir) except: pass
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)
def back_starter(a, inputpath, camScale, test): print '##############' * 5 print inputpath print camScale print '##############' * 5 opc = util.outputPathConf(inputpath, test=test) opc.createCamOutputDir() batch.camExport(opc.publishfullpath, opc.sequence + opc.shot + '_cam', camScale, inputpath) camFiles = os.listdir(opc.publishfullpath) for camFile in camFiles: srcFile = os.path.join(opc.publishfullpath, camFile) dstDir = os.path.join(opc.publishfullpath, '..') try: shutil.copy(srcFile, dstDir) except: pass 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')
def execExportCam(self, cameraName, inputpath): #CameraName=CameraA opc = util.outputPathConf(inputpath, True, test=testRun) opc.createOutputDir(cameraName) nsCamera = [] output = opc.publishfullcampath cameraSetup = import_module('setting.cameraASetup') batch.camExport(output, 'camera', inputpath) camFiles = os.listdir(opc.publishfullcampath) for camFile in camFiles: srcFile = os.path.join(opc.publishfullpath, camFile) dstDir = os.path.join(opc.publishfullpath, '..') try: shutil.copy(srcFile, dstDir) except: pass ns = [] ns.append('BG') ns.append('chara') ns.append('empty') count = 0 for camFile in camFiles: camanimOutput = opc.publishfullcampath + '/' + camFile camOutput = opc.publishfullpath + '/' + ns[count] + '_cloCamera1.ma' batch.camAttach(cameraSetup.assetCamera, ns[count], camanimOutput, camOutput) opc.makeCurrentDir() count = count + 1 opc.makeCurrentDir()
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==================='
def open_publish_dir_button_clicked(self): import util opc = util.outputPathConf(self.inputpath) shot_path = opc.publishshotpath publish_path = os.path.join(shot_path, "publish") subprocess.call("explorer {}".format(publish_path.replace("/", "\\")))