def exportAssetCache(self): """docstring for fname""" baseDir = self.fileNameForCache( True ) #TODO add filename and see best way to detect asset exportedAsset = [] steps = self.steps_spb.value() for n in mn.ls( sl = True ): baseName = n.name.split( ':' )[0] if baseName in exportedAsset: continue a = ass.getAssetFromNode(n, self._selectedProject) cacFile = cfl.CacheFile( baseDir + '/' + baseName + '.abc', [n] ) cacFile.exportAsset( a, False, False, steps ) exportedAsset.append( baseName ) if self.copyToServer_chb.isChecked(): serverFile = cfl.CacheFile( cacFile.path.replace( prj.BASE_PATH, self.serverPath ) ) serverFile.newVersion() cacFile.copy( serverFile.path ) selShot = self._selectedShot if self.sendMail: ml.mailFromTool( 'new_cache', { '<ProjectName>': selShot.project.name, '<SequenceName>': selShot.sequence.name, '<ShotName>': selShot.name, '<AssetName>': ','.join( exportedAsset ), '<UserName>': os.getenv('username')}, os.getenv('username') + '@bitt.com', self.mailsPath , self.mailServer, self.mailPort ) self._fillCacheList()
def exportCaches( rigs, sho ): """docstring for exportCaches""" baseDir = sho.animCachesPath exportedAsset = [] steps = 1.0 nods = [] for n in rigs: no = mc.ls( n + ':*', s = True, dag = True, ni = True ) if no: nods.append( no[0] ) nods = mn.Nodes( nods ) for n in nods: baseName = n.name.split( ':' )[0] if baseName in exportedAsset: continue a = ass.getAssetFromNode( n, sho.project ) cacFile = cfl.CacheFile( baseDir + '/' + baseName + '.abc', [n] ) cacFile.exportAsset( a, False, False, steps ) exportedAsset.append( baseName )