ep, seq, shot = raw_input( 'enter episode, sequence, shot as ### ### ###: ').split(' ') #test input #ep, seq, shot = ['101', '100', '120'] print 'ep =', ep print 'seq =', seq print 'shot=', shot #os.environ["MAYA_LOCATION"] = "C:\Program Files\Autodesk\Maya2015" import maya.standalone maya.standalone.initialize(name='python') import maya.cmds as mc import sbtvInfo seqInfo = sbtvInfo.Info(ep, seq, shot) seqPath = seqInfo.seqPath seqName = seqInfo.seqName #episode, sequence, shot ID - to be used for output directory essid = r'/'.join([seqInfo.epID, seqInfo.seqID, 'sh_' + shot, '<Layer>']) shotDirMaya = os.path.join(seqPath, 'sh_' + shot, '03_maya') for dept in os.listdir(shotDirMaya): if 'lighting' in dept: litDir = os.path.join(shotDirMaya, dept) else: NameError('lighting directory not found in...%s\n ' % shotDirMaya) print litDir
except: pass #test variables #ep, seq = ['101', '100'] def shotTasks(ma): print('\nOpening... \n %s\n\n' % os.path.split(ma)[-1]) mc.file(ma, force=True, open=True) animCleanup.all() pipelineTools.publish(ma, exportOnly=True) pipelineTools.replaceCharRigs(ma) seqInfo = sbtvInfo.Info(ep, seq) seqName = seqInfo.seqName logFile = os.path.join(seqInfo.seqPath, 'animPrepLog.txt') orig_sys = sys.stdout with open(logFile, 'w') as out: sys.stdout = out #test ma file: #ma = os.path.join( seqInfo.seqPath, r'sh_020\03_maya\02_animation\sq100_020_downpour_anim_003.ma') for ma in seqInfo.getLastAnim(): print ma try: if shot and shot in ma: shotTasks(ma) break except:
def getDeptID(shotMayaDir, department): '''this was built to bypass naming inconsistencies in the maya directory from sequence to sequence''' for deptID in os.listdir(shotMayaDir): if department in deptID: return deptID #sets dept to lighting dir name, regardless of prefix else: NameError('lighting directory not found in...%s\n ' % shotMayaDir) # # Get source PUBLISH info # import sbtvInfo seqInfo = sbtvInfo.Info(ep, seq, srcShot) seqPath = seqInfo.seqPath seqName = seqInfo.seqName srcMayaDir = os.path.join(seqPath, 'sh_' + srcShot, '03_maya') srcLitDir = os.path.join(srcMayaDir, getDeptID(srcMayaDir, 'lighting')) srcAnimDir = os.path.join(srcMayaDir, getDeptID(srcMayaDir, 'animation')) import pipelineTools srcMAFile = pipelineTools.findPUBLISH(srcLitDir) srcAnimPub = pipelineTools.findPUBLISH(srcAnimDir) srcLong = os.path.join(srcLitDir, srcMAFile) print '\nCopying from:\n%s ' % srcLong #