def readCachesInDisk(): path=playblasterFunctions.pipeInfo()['folder'].replace('wip','out') cacheFiles={} for o in os.listdir(path): info=playblasterFunctions.pipeInfo(o) if info: if info['extension']=='.abc': cacheFiles[info['description']]=path + info['fileName'] + info['extension'] return cacheFiles
def refreshCachesInDiskWindow(): if cmds.textScrollList('cachesExportedList', ex=True): cmds.textScrollList('cachesExportedList', e=True, ra=True) if playblasterFunctions.pipeInfo(): cachesDescription=[] for o in readCachesInDisk(): cachesDescription.append(o) cmds.textScrollList('cachesExportedList', e=True, ra=True) cmds.textScrollList('cachesExportedList', e=True, a=cachesDescription) cmds.button('publishCachesButton', e=True, en=True) cmds.button('importCachesButton', e=True, en=True) else: cmds.button('publishCachesButton', e=True, en=False) cmds.button('importCachesButton', e=True, en=False)
def publishSelectedCaches(*args): cachesdict=readCachesInDisk() filestoQueu=[] selection = cmds.textScrollList('cachesExportedList', q=True, si=True) if selection: for o in selection: filestoQueu.append(cachesdict[o]) userChoice = cmds.confirmDialog(db='ok', b= ['ok', 'cancel'], cb='cancel', t="Warning:", m=" it's about to publish this caches: " + ', '.join(selection) + ", \nare you sure??") if userChoice == 'ok': removeCachesInScene() cmds.file(save=True) fileInfo = playblasterFunctions.pipeInfo() sceneFullName = fileInfo['folder'] + fileInfo['fileName'] + fileInfo['extension'] outFullName = playblasterFunctions.getPaths(description=fileInfo['description'], fileType='scene', prodState='out') shutil.copy(sceneFullName, outFullName) filestoQueu.append(outFullName) playblasterFunctions.sendToDropbox(filestoQueu,4)
def refreshUI(*args): sceneInfo=playblasterFunctions.pipeInfo() refreshCachesInDiskWindow() if not sceneInfo: cmds.textField('projectField',tx='', e=True, en=False) cmds.textField('seqField',tx='', e=True, en=False) cmds.textField('shotField',tx='', e=True, en=False) cmds.textScrollList('charsList',ra=True, e=True, en=False) cmds.textScrollList('propsList',ra=True, e=True, en=False) cmds.button('doAbcs', en=False, e=True) else: cmds.textField('projectField',tx=sceneInfo['project'], e=True) cmds.textField('seqField',tx=sceneInfo['seq'], e=True) cmds.textField('shotField',tx=sceneInfo['shot'], e=True) cmds.textScrollList('charsList', e=True, en=True) cmds.textScrollList('propsList', e=True, en=True) setCharsInList() setPropsInList() cmds.button('doAbcs', en=True, e=True)
def abcWriter(startFrame,endFrame,description,flags=('uvWrite', 'worldSpace', 'writeVisibility', 'writeUVSets')): '''esta funcion ''' outName=playblasterFunctions.confirm(path=playblasterFunctions.getPaths(description=description, fileType='abc', prodState='out'), message= 'Ooops, seems there is previous cache for ' + description.capitalize() + '.\nDo you want to overwrite it?') if outName: if os.path.exists(os.path.dirname(outName)) != True: os.makedirs(os.path.dirname(outName)) stringFlags=' -' + ' -'.join(flags) command = "-frameRange "+ str(startFrame) + " " + str(endFrame) + stringFlags + ' -root ' + description + ':geo' + " -file " + outName cacheFile = cmds.AbcExport(j=command) cacheDescription=playblasterFunctions.pipeInfo(outName) return outName, cacheDescription['description'] else: return None
def abcExporterUI(*args): deleteWindow('abcExporter') sceneInfo=playblasterFunctions.pipeInfo() props=abcExporterFunctions.elemsLister()['props'] chars=abcExporterFunctions.elemsLister()['chars'] cachesDescription=[] for o in abcExporterFunctions.readCachesInDisk(): cachesDescription.append(o) cmds.window('abcExporter', title="abc Exporter UI", tlb=True, s=False) #layout horizontal que centre todas los items de la herramienta dejando un margen a ambos lados cmds.rowLayout('safeSidesLayout', adjustableColumn=2, numberOfColumns=3) cmds.separator(st='none',p='safeSidesLayout') cmds.columnLayout('mainLayout', adjustableColumn=1, p='safeSidesLayout') cmds.separator(st='none',p='safeSidesLayout') cmds.rowLayout('infoLayout', adjustableColumn=3, numberOfColumns=4, p='mainLayout') cmds.columnLayout('projectLayout', p='infoLayout') cmds.text(label='Project:') cmds.textField('projectField',tx=sceneInfo['project'], w=50, ed=False) cmds.columnLayout('seqLayout', p='infoLayout') cmds.text(label='Seq:') cmds.textField('seqField',tx=sceneInfo['seq'], w=50, ed=False) cmds.columnLayout('shotLayout', p='infoLayout') cmds.text(label='Shot:') cmds.textField('shotField',tx=sceneInfo['shot'], w=50, ed=False) cmds.symbolButton(image='refresh.png', p='infoLayout', c= abcExporterFunctions.refreshUI) cmds.separator(h=15, st='shelf',p='mainLayout') tabs = cmds.tabLayout('tabsLayout',innerMarginWidth=5, innerMarginHeight=5, p='mainLayout') tab1=cmds.columnLayout('tab1Layout', adjustableColumn=1) cmds.separator(h=10, st='none',p='tab1Layout') cmds.text(label='CHARS', al='left') cmds.columnLayout('charsLayout', adjustableColumn=1) cmds.textScrollList('charsList', w=180, h=75, a=chars, allowMultiSelection=True, dcc="cmds.textScrollList('charsList', e=True, da=True)", p='charsLayout') cmds.rowLayout('charsPlusMinLayout', numberOfColumns=3, adjustableColumn=2, p='charsLayout') cmds.button(label='+', w=40, p='charsPlusMinLayout', c=abcExporterFunctions.addSelectedChars) cmds.button(label='clear list',w=80, p='charsPlusMinLayout',c="cmds.textScrollList('charsList',ra=True, e=True)") cmds.button(label='-', w=40, p='charsPlusMinLayout',c=abcExporterFunctions.removeChar) cmds.separator(h=10, st='none',p='tab1Layout') cmds.text(label='PROPS', al='left',p='tab1Layout') cmds.columnLayout('propsLayout', adjustableColumn=1,p='tab1Layout') cmds.textScrollList('propsList', w=180,h=100, a=props, allowMultiSelection=True, dcc="cmds.textScrollList('propsList', e=True, da=True)", p='propsLayout') cmds.rowLayout('propsPlusMinLayout', numberOfColumns=3, adjustableColumn=2, p='propsLayout') cmds.button(label='+', w=40, p='propsPlusMinLayout', c=abcExporterFunctions.addSelectedProps) cmds.button(label='clear list', w=80, p='propsPlusMinLayout',c="cmds.textScrollList('propsList',ra=True, e=True)") cmds.button(label='-', w=40, p='propsPlusMinLayout', c=abcExporterFunctions.removeProp) cmds.separator(h=30, st='shelf', p='tab1Layout') cmds.button('doAbcs',label='create alembics from lists', p='tab1Layout', c=abcExporterFunctions.doTheCaches) cmds.setParent( '..' ) cmds.setParent( '..' ) cmds.setParent( '..' ) tab2 = cmds.columnLayout('cachesExportedLayout', adjustableColumn=4) cmds.separator(st='none',h=10) cmds.text(l='Those caches have been exported for this shot') cmds.separator(st='none',h=10) cmds.textScrollList('cachesExportedList', w=180, h=220, allowMultiSelection=True, a=cachesDescription, dcc="cmds.textScrollList('cachesExportedList', e=True, da=True)", p='cachesExportedLayout') cmds.separator(st='none',h=5) cmds.separator(h=25, st='shelf') cmds.button('importCachesButton',label='Import Selected Caches', c=abcExporterFunctions.importCacheToScene) cmds.separator(st='none',h=3) cmds.button('publishCachesButton',label='Publish Selected', c=abcExporterFunctions.publishSelectedCaches) cmds.setParent( '..' ) cmds.tabLayout( tabs, edit=True, bs='none', tp='north',tabLabel=((tab1, 'Caches Exporter'), (tab2, 'Caches In Disk'))) cmds.showWindow('abcExporter')