Beispiel #1
0
def loadUnloadLightRig( path = '' ):
	"""docstring for loadUnloadLightRig"""
	if path == '':
		fil = mfl.mayaFile( PYFILEDIR + '/LightRig.ma'  )
	else:
		fil = mfl.mayaFile( path )
	if mc.objExists( 'LightRig:LR' ):
		refNode = mc.referenceQuery( fil.path, rfn = True )
		mc.file( referenceNode  = refNode, removeReference = True  )
	else:
		mc.file( fil.path, r = True, type = "mayaAscii", gl = True, loadReferenceDepth = "all",rnn = True, namespace = 'LightRig', options = "v=0;" )
Beispiel #2
0
	def exportSet(self):
		"""export selection"""
		pat = QtGui.QFileDialog.getSaveFileName(self, 'Save Set', self._selectedShot.setsPath, selectedFilter='*.ma')
		if pat:
			print 'patSSS',pat
			maFile = mfl.mayaFile( str( pat[0] ) )
			maFile.newVersion()
			mc.file( str( maFile.path ), preserveReferences=True, type='mayaAscii', exportSelected =True, prompt=True, force=True )
			if self.copyToServer_chb.isChecked():
				serverFile = mfl.mayaFile( maFile.path.replace( prj.BASE_PATH, self.serverPath ) )
				serverFile.newVersion()
				maFile.copy( serverFile.path )
Beispiel #3
0
	def copyAssetFromServer(self, asset):
		"""main function to copy asset from server"""
		filePath = str( asset.path )
		if asset.path.endswith( '.ma' ):# MAYA FILE
			#COPY TEXTURES AND REFERENCES RECURSIVE
			if self.serverPath in filePath:
				localFile = mfl.mayaFile( filePath.replace( self.serverPath, prj.BASE_PATH + '/' ) )
				localFile.newVersion()
				asset.copy( localFile.path )
				if self.changeInternalPaths:
					print 'in changeInternalPaths'
					deps, textures = self.getDependenciesToCopy( localFile )
					self.changeIntPaths( [localFile.path ], self.serverPath, prj.BASE_PATH + '/' )
					toCopy = self.filesToCopy( deps, self.serverPath, prj.BASE_PATH + '/' )
					if toCopy:
						print toCopy
					"""
						dia = trhC.MultiProgressDialog( toCopy, self.serverPath, prj.BASE_PATH + '/', self )
						dia.show()
						res = dia.exec_()
						if res:
							self.changeIntPaths( toCopy, self.serverPath, prj.BASE_PATH + '/' )
							if self.autoMakeTx:
								for t in textures:
									self.makeTxForTexture( t, self.serverPath, prj.BASE_PATH + '/' )
					"""
			else:
				serverFile = mfl.mayaFile( filePath.replace( prj.BASE_PATH + '/', self.serverPath ) )
				asset.newVersion()
				serverFile.copy( asset.path )
				if self.changeInternalPaths:
					deps, textures = self.getDependenciesToCopy( asset )
					self.changeIntPaths( [asset.path ], self.serverPath, prj.BASE_PATH + '/' )
					toCopy = self.filesToCopy( deps, self.serverPath, prj.BASE_PATH + '/' )
					if toCopy:
						dia = trhC.MultiProgressDialog( toCopy, self.serverPath, prj.BASE_PATH + '/', self )
						dia.show()
						res = dia.exec_()
						if res:
							self.changeIntPaths( toCopy, self.serverPath, prj.BASE_PATH + '/' )
							if self.autoMakeTx:
								for t in textures:
									self.makeTxForTexture( t, self.serverPath, prj.BASE_PATH + '/' )
		else:
			if self.serverPath in filePath:
				localFile = fl.File( filePath.replace( self.serverPath, prj.BASE_PATH + '/' ) )
				localFile.newVersion()
				asset.copy( str( localFile.path ))
			else:
				localFile = fl.File( filePath.replace( prj.BASE_PATH + '/', self.serverPath ) )
				asset.newVersion()
				localFile.copy( str( asset.path ))
Beispiel #4
0
def makeAssetForShot():
	"""make selected asset for this shot, move to assets shot folder and change path to new location"""
	curFile = prj.shotOrAssetFromFile(mfl.currentFile())
	if curFile.type == 'shot':
		allreadyDup = []
		for obj in mn.ls( sl = True ):
			referenceNode = mc.referenceQuery( obj.name, rfn = True )
			refFile = mfl.mayaFile( mc.referenceQuery( obj.name, f = True ) )
			print refFile
			asst = prj.shotOrAssetFromFile( refFile )
			if asst.type == 'asset':
				newFile = mfl.mayaFile( curFile.assetsPath + refFile.path.split( 'Assets' )[-1] )
				newFile.newVersion()
				newFile = refFile.copy( curFile.assetsPath + refFile.path.split( 'Assets' )[-1] )
				mc.file( newFile.path, loadReference = referenceNode )
Beispiel #5
0
	def copyAssetToServer(self, asset):
		"""main function to copy asset to server"""
		filePath = str( asset.path )
		if asset.path.endswith( '.ma' ):# MAYA FILE
			#COPY TEXTURES AND REFERENCES RECURSIVE
			if self.serverPath in filePath: #THIS FILE ONLY EXISTS IN SERVER SO THERE IS NO NEED
				return
			else:
				serverFile = mfl.mayaFile( filePath.replace( prj.BASE_PATH + '/', self.serverPath ) )
				serverFile.newVersion()
				asset.copy( serverFile.path )
				if self.changeInternalPaths:
					deps, textures = self.getDependenciesToCopy( asset )
					self.changeIntPaths( [asset.path ], prj.BASE_PATH + '/', self.serverPath )
					toCopy = self.filesToCopy( deps,  prj.BASE_PATH + '/', self.serverPath )
					if toCopy:
						dia = trhC.MultiProgressDialog( toCopy, prj.BASE_PATH + '/', self.serverPath, self )
						dia.show()
						res = dia.exec_()
						if res and self.changeInternalPaths:
							self.changeIntPaths( toCopy, prj.BASE_PATH + '/', self.serverPath )
							if self.autoMakeTx:
								for t in textures:
									self.makeTxForTexture( t, prj.BASE_PATH + '/', self.serverPath )

		else:
			if self.serverPath in filePath: #THIS FILE ONLY EXISTS IN SERVER SO THERE IS NO NEED
				return
			else:
				localFile = fl.File( filePath.replace( prj.BASE_PATH + '/', self.serverPath ) )
				asset.copy( str( localFile.path ))
Beispiel #6
0
	def changeIntPaths( self, files, serverPath, localPath ):
		"""docstring for changeIntPaths"""
		for f in files:
			if not f.endswith( '.ma' ):
				continue
			localFile = mfl.mayaFile( f.replace( serverPath, localPath ) )
			stinfo = os.stat( localFile.path )
			localFile.changePathsBrutForce( srchAndRep =  [ serverPath, localPath ] )
			os.utime( localFile.path,(stinfo.st_atime, stinfo.st_mtime))
Beispiel #7
0
def exportSets( sets, sho ):
	"""docstring for exportSets"""
	nods = []
	for s in sets:
		nods.extend( mc.ls( s + ':*', s = True, dag = True, ni = True ) )
	nods = mn.Nodes( nods )
	nods.select()
	maFile = mfl.mayaFile( sho.setsPath+ 'set.ma' )
	maFile.newVersion()
	mc.file( str( maFile.path ), preserveReferences=True, type='mayaAscii', exportSelected =True, prompt=True, force=True )
Beispiel #8
0
	def settexturespath( self, newPath, mayaFile ):
		"""move textures to new path and set that path in the nodes"""
		if not os.path.exists( newPath ):
			os.makedirs( newPath )
		for t in self.textures:
			curPath = t.a.ftn.v
			finalPath = newPath + curPath.split( '/' )[-1]
			if curPath == finalPath:
				continue
			shutil.copy2( curPath, finalPath )
			mayFile = mfl.mayaFile( mayaFile )
			mayFile.changeTextures( newDir = newPath )
Beispiel #9
0
	def fillReferencesTable(self):
		"""fill the references table"""
		if self.inMaya:
			references = []
			sel = mc.ls( rf = True )
			for s in sel:
				try:
					references.append( mfl.mayaFile( mc.referenceQuery( s, f = True ) ))
				except:
					continue
		else:
			references = self.fil.references
		self.assets_tw.setRowCount( len( references ) )
		color = [QtGui.QColor( "green" ),QtGui.QColor( "red" )]
		for i,t in enumerate(references):
			item = QtGui.QTableWidgetItem( t.basename )
			item.setData(32, t )
			self.assets_tw.setItem( i, 0, item )
			area = t.basename.split( '_' )[-1]
			item = QtGui.QTableWidgetItem( area )
			self.assets_tw.setItem( i, 1, item )
			needs = 'No'
			if 'Shot' in t.path:
				origFile = mfl.mayaFile( re.sub(r'Sequences[^)]*Assets', 'Assets', t.path) )
				if t.isOlderThan( origFile ):
					needs = 'Yes'
			item = QtGui.QTableWidgetItem( needs )
			self.assets_tw.setItem( i, 2, item )
			#PATH
			item = QtGui.QTableWidgetItem( t.path )
			if t.exists:
				colVal = 0
			else:
				colVal = 1
			if uiH.USEPYQT:
				item.setBackgroundColor(  color[ colVal ])
			else:
				item.setBackground(  color[ colVal ] )
			self.assets_tw.setItem( i, 3, item )
Beispiel #10
0
	def animPath(self):
		"""return the anim file"""
		return mfl.mayaFile( self.path + '/Anim/' + self.name + '_ANIM.ma' )
Beispiel #11
0
	def layPath(self):
		"""return the anim file"""
		return mfl.mayaFile( self.path + '/Lay/' + self.name + '_LAY.ma' )
Beispiel #12
0
	def poolCam(self):
		"""return pool camera file"""
		return mfl.mayaFile( self.poolCamPath )
Beispiel #13
0
	def sets(self):
		"""return the sets exported in the pool"""
		if os.path.exists( self.setsPath ):
			return [ mfl.mayaFile( self.setsPath + o ) for o in os.listdir( self.setsPath ) if '.ma' in o ]
		return []
Beispiel #14
0
	def shaderPath(self):
		"""return the path for the shader file"""
		return mfl.mayaFile( self._path + '/shaders.ma' )
Beispiel #15
0
def batcher(
        modules=[],
        functions=[],
        mayaFiles=[],
        saveFile=False,
        makeLog=False,
        mayaBatchPath='C:\\Program Files\\Autodesk\\Maya2015\\bin\\mayabatch.exe',
        help=False):
    """ create a Batch file """
    helpText = 'This script is for run an array of scripts\n'
    helpText += '(mel or python) in an array of maya files.\n'
    #helpText += 'The functions array will be executed in order.\n'
    helpText += 'WARNING:\n'
    helpText += '\tFor every module you need a function!!\n'
    helpText += '\tIf the function has the same name of the module,\n'
    helpText += '\tYou can leave the item in the function array empty-->\'\'\n'
    helpText += 'USAGE Ex:\n'
    helpText += '\tbatcher(\n'
    helpText += '\tmodules = [\'t:/lay/ftb_lay_importExportCamaraFromLayout\',\'t:/mel/ftb_mel_cameraSequence.mel\']\n'
    helpText += '\t,functions = [\'ftb_lay_importExportCamaraFromLayout.fixThisCameraScene()\',\'cameraSequence\']\n'
    helpText += '\t,mayaFiles = [\'C:/pol/270ride010a_lay_camera_v003.ma\',\'C:/skarone/666ride666a_lay_camera_v666.ma\']\n'
    helpText += '\t,saveFile = True  (This will make a back up of the file before edit)\n'
    helpText += '\t,makeLog = True  (This will make a log of the batch per file in the same path))\n'
    if (help):
        print helpText
        return False
    if not (len(mayaFiles)):
        print '>>please give me some maya Files'
        print '>>use batchFiles(help=True) for more information'
        return False
    if not (len(modules)):
        print '>>please give me some module'
        print '>>use batchFiles(help=True) for more information'
        return False
    if not (len(functions)):
        print '>>please give me some function'
        print '>>use batchFiles(help=True) for more information'
        return False
    if not (len(functions) == len(modules)):
        print '>>the lenght of the functions array is'
        print '>>not the same of the modules array'
        print '>>use batchFiles(help=True) for more information'
        return False
    #CREATE THE COMMAND TO EXECUTE
    cmd = ''
    cmd += 'python (\\"import sys\\");'
    for n, mod in enumerate(modules):
        #module exists???
        """
		if not os.path.exists(mod):
			print '>>can\'t find module',mod
			return False;
		"""
        #detect if it is mel or python
        if (os.path.isfile(mod)):
            #probably is a mel
            filepath, fileMod = os.path.split(mod)
            file, fileExtension = os.path.splitext(fileMod)
            if not (fileExtension == 'mel'):
                print '>>this file isn\'t a python or a mel module', mod
                return False
            else:
                #is a mel =) source
                cmd += 'source \"' + mod + '\";'
                if (functions[n] == ''):
                    cmd += '' + file + ';'
                else:
                    cmd += '' + functions[n] + ';'
        elif (os.path.isdir(mod)):
            #is a python =) module
            mod.replace('\\', '/')
            m = mod.split('/')[-1]
            cmd += 'python (\\"sys.path.append(\'' + mod + '\')\\");'
            cmd += 'python (\\"import ' + m + '\\");'
            cmd += 'python (\\"reload( ' + m + ')\\");'
            if (functions[n] == ''):
                cmd += 'python (\\"' + m + '.' + m + '()' + '\\");'
            else:
                cmd += 'python (\\"' + functions[n] + '\\");'
        else:
            print '>>something in this module is wrong', mod
            return False

    #LOOP THRU THE FILES
    for fileName in mayaFiles:
        finalcmd = cmd
        #fileName = fileName.replace('\\','/')
        fileName = mfl.mayaFile(fileName)
        if not fileName.exists:
            print '>>cant find file', fileName.path
            continue
        if (saveFile):
            fileName.newVersion()
            finalcmd += 'file -save;'
        finalcmd += 'print (\\"done!\\n\\");'

        batch = ''
        batch += mayaBatchPath + ' -file "' + fileName.path + '" '
        batch += '-command "' + finalcmd + '" '

        if (makeLog):
            log = fileName.replace('.ma', '.log')
            print log
            batch += ' -log "' + log + '"'
        print '>>about to execute', batch
        subprocess.call(str(batch))
        #os.system(batch)
        if (makeLog):
            subprocess.call('notepad.exe "' + log + '"')
    return
Beispiel #16
0
	def showMenu(self, pos):
		tabwid = self._getCurrentTab()
		item = tabwid.currentItem()
		if uiH.USEPYQT:
			asset = item.data(32).toPyObject()
		else:
			asset = item.data(32)
		menu=QtGui.QMenu(self)
		if INHOU:
			fils = menu.addMenu('Files')
			nukIcon = QtGui.QIcon( PYFILEDIR + '/icons/houdini.png' )
			actionNewFile = QtGui.QAction(nukIcon,"New File", fils)
			fils.addAction( actionNewFile )
			self.connect( actionNewFile, QtCore.SIGNAL( "triggered()" ), self.newHoudiniFile )
			fils.addSeparator()
			#OPEN IN CURRENT NUKE
			fls = [ hfl.houdiniFile( a.path ) for a in fl.filesInDir( asset.dirPath, False ) if a.path.endswith('.hip')]
			for f in fls:
				nukIcon = QtGui.QIcon( PYFILEDIR + '/icons/houdini.png' )
				actionOpenInCurrent = QtGui.QAction(nukIcon,f.name, fils)
				fils.addAction( actionOpenInCurrent )
				self.connect( actionOpenInCurrent, QtCore.SIGNAL( "triggered()" ), lambda val = f : self.openHoudiniFile(val) )
		propIcon = QtGui.QIcon( PYFILEDIR + '/icons/question.png' )
		actionProperties = QtGui.QAction(propIcon, "Properties", menu)
		menu.addAction( actionProperties )
		self.connect( actionProperties, QtCore.SIGNAL( "triggered()" ), self.properties )
		folderIcon = QtGui.QIcon( PYFILEDIR + '/icons/folder.png' )
		actionOpenInExplorer = QtGui.QAction(folderIcon,"Open File in explorer", menu)
		menu.addAction( actionOpenInExplorer )
		self.connect( actionOpenInExplorer, QtCore.SIGNAL( "triggered()" ), self.openFileLocation )
		#COPY PATH
		actionSaveScene = QtGui.QAction("Copy File Path", menu)
		menu.addAction( actionSaveScene )
		self.connect( actionSaveScene, QtCore.SIGNAL( "triggered()" ), self.copyFilePath )
		#OPEN RENDER PATH
		actionSaveScene = QtGui.QAction(folderIcon,"Open Render Folder", menu)
		menu.addAction( actionSaveScene )
		self.connect( actionSaveScene, QtCore.SIGNAL( "triggered()" ), self.openRenderFolder )
		#OPEN RENDER PATH
		videoIcon = QtGui.QIcon( PYFILEDIR + '/icons/video.png' )
		actionOpenPlayblast = QtGui.QAction(videoIcon,"Open Playblast", menu)
		menu.addAction( actionOpenPlayblast )
		self.connect( actionOpenPlayblast, QtCore.SIGNAL( "triggered()" ), self.openPlayblast )
		menu.addSeparator()
		#DOWNLOAD UPLOAD
		downIcon = QtGui.QIcon( PYFILEDIR + '/icons/download.png' )
		uploIcon = QtGui.QIcon( PYFILEDIR + '/icons/upload.png' )
		actionCopyServer = QtGui.QAction( downIcon, "Download From Server", menu)
		actionCopyServer.setIcon( downIcon )
		menu.addAction(actionCopyServer)
		self.connect( actionCopyServer, QtCore.SIGNAL( "triggered()" ), self.copyFromServer )
		actionToServer = QtGui.QAction( uploIcon, "Upload To Server", menu)
		menu.addAction(actionToServer)
		self.connect( actionToServer, QtCore.SIGNAL( "triggered()" ), self.copyToServer )
		menu.addSeparator()
		if INMAYA:
			fils = menu.addMenu('Versions')
			#OPEN IN CURRENT NUKE
			fls = [ mfl.mayaFile( a.path ) for a in fl.filesInDir( asset.dirPath+'/Versions/', False ) if a.path.endswith('.ma')]
			for f in fls:
				nukIcon = QtGui.QIcon( PYFILEDIR + '/icons/maya.png' )
				actionOpenInCurrent = QtGui.QAction(nukIcon,f.name + ' - ' + f.date, fils)
				fils.addAction( actionOpenInCurrent )
				self.connect( actionOpenInCurrent, QtCore.SIGNAL( "triggered()" ), lambda val = f : self.openMayaFile(val) )
			#OPEN IN CURRENT MAYA
			mayaIcon = QtGui.QIcon( PYFILEDIR + '/icons/maya.png' )
			actionOpenInCurrent = QtGui.QAction(mayaIcon,"Open in This Maya", menu)
			menu.addAction( actionOpenInCurrent )
			self.connect( actionOpenInCurrent, QtCore.SIGNAL( "triggered()" ), self.openFileInCurrentMaya )
			menu.addSeparator()
			#IMPORT
			impIcon = QtGui.QIcon( PYFILEDIR + '/icons/import.png' )
			actionImport = QtGui.QAction(impIcon,"Import", menu)
			menu.addAction( actionImport )
			self.connect( actionImport, QtCore.SIGNAL( "triggered()" ), self.importFile )
			menu.addSeparator()
			#COPY TIME SETTINGS
			timeIcon = QtGui.QIcon( PYFILEDIR + '/icons/time.png' )
			actionCopyTime = QtGui.QAction(timeIcon,"Copy Time Settings", menu)
			menu.addAction( actionCopyTime )
			self.connect( actionCopyTime, QtCore.SIGNAL( "triggered()" ), self.copyTimeSettings )
			menu.addSeparator()
			#REFERENCE
			refIcon = QtGui.QIcon( PYFILEDIR + '/icons/reference.png' )
			actionReference = QtGui.QAction(refIcon,"Reference", menu)
			menu.addAction( actionReference )
			self.connect( actionReference, QtCore.SIGNAL( "triggered()" ), self.reference )
			menu.addSeparator()
			#SAVE IN THIS SCENE
			savIcon = QtGui.QIcon( PYFILEDIR + '/icons/save.png' )
			actionSaveScene = QtGui.QAction(savIcon,"Save Scene Here!", menu)
			menu.addAction( actionSaveScene )
			self.connect( actionSaveScene, QtCore.SIGNAL( "triggered()" ), self.saveScene )
		elif INNUKE:
			#OPEN IN CURRENT NUKE
			nukIcon = QtGui.QIcon( PYFILEDIR + '/icons/nuke.png' )
			actionOpenInCurrent = QtGui.QAction(nukIcon,"Open in This Nuke", menu)
			menu.addAction( actionOpenInCurrent )
			self.connect( actionOpenInCurrent, QtCore.SIGNAL( "triggered()" ), self.openFileInCurrentNuke )
			#SAVE IN THIS SCENE
			savIcon = QtGui.QIcon( PYFILEDIR + '/icons/save.png' )
			actionSaveScene = QtGui.QAction(savIcon,"Save Scene Here!", menu)
			menu.addAction( actionSaveScene )
			self.connect( actionSaveScene, QtCore.SIGNAL( "triggered()" ), self.saveNukeScene )


		menu.popup(tabwid.viewport().mapToGlobal(pos))
Beispiel #17
0
import rigging.utils.SoftModCluster.SoftModCluster as sf
reload( sf )
import pipe.mayaFile.mayaFile as mfl
import os
import modeling.curve.curve as crv
import general.curveScatter.curveScatter as crvScat
reload( crvScat )

PYFILEDIR = os.path.dirname( os.path.abspath( __file__ ) )
lipsBaseFile = mfl.mayaFile( PYFILEDIR + '/lipsBase.ma' )
"""
1-Import file into the scene
2-Move the controls to modify the curves to match with the geometry lips
3-Build the system with the amount of controls that you want
Default is 3 controls, 3 UP, 3 DOWN and there is allways 1 for each lip corner.

"""

class Lips(object):
	"""basic rig for lips based on 2 curves
	it will create sticky joint controls with a default weight from a softMod"""
	def __init__(self):
		self._scatter = []

	def create(self):
		"""this will import the face lips helpers curves"""
		lipsBaseFile.imp()
	
	def buildBase(self):
		"""buid the system with the controul count"""
		#BOTTOM
Beispiel #18
0
	def importRig(self):
		"""import rig to scene"""
		mfl.mayaFile( PYFILEDIR + '/base_face_rig.ma' ).imp()
Beispiel #19
0
	def render(self):
		"""docstring for render"""
		curFile = mfl.currentFile()
		if self.autoSave_chb.isChecked():
			curFile.newVersion()
			curFile.save()
		dead       = dl.Deadline()
		group      = str(self.groups_cmb.currentText())
		pool       = str(self.pools_cmb.currentText())
		comments   = str( self.comments_te.text())
		priority   = str( self.priority_spb.value() )
		taskSize   = str( self.taskSize_spb.value() )
		projPath   = str( self.projectPath_le.text() )
		settings = sti.Settings()
		gen = settings.General
		if self.useServerPaths_chb.isChecked(): #IF USE PATH FROM SERVER... WE NEED TO CHANGE INTERNAL PATHS SO MATCH SERVER
			curFile = mfl.mayaFile( curFile.copy( dead.userHomeDirectory + '/' + curFile.fullName ).path )
			if gen:
				basePath = gen[ "basepath" ]
				if basePath:
					if basePath.endswith( '\\' ):
						basePath = basePath[:-1]
					basePath = basePath.replace( '\\', '/' )
				serverPath = gen[ "serverpath" ]
				curFile.changePathsBrutForce( srchAndRep =  [ basePath, serverPath ] )

		#fix for xgen =)
		curFile.changeXgens( newDir = curFile.dirPath )
		InitialStatus = "Active"
		if self.submitSuspended_chb.isChecked():
			InitialStatus = "Suspended"
		whiteList = ''
		deRenGlob = mn.Node( 'defaultRenderGlobals' )
		pad = deRenGlob.a.extensionPadding.v
		#deRenGlob.a.imageFilePrefix.v = str(self.filePath_le.text())
		if self.renderLocal_chb.isChecked():
			whiteList = socket.gethostname()
			print 'rendering in local', whiteList
		plugin = 'MayaBatch'
		if mc.getAttr( "defaultRenderGlobals.ren" ) == 'mentalRay':
			plugin = 'MayaCmd'
		#MAIL
		mails = ''
		mailNoti = 'false'
		if gen[ "sendmail" ] == 'True':
			mails = ','.join( ml.getUsersInDepartments( ['lighting', 'production'], gen[ "departmentspath" ] ) )
			mailNoti = 'true'
		for w in self._getLayersWidgets():
			filePrefix = self.getFilePrefixFromTags( str(self.filePath_le.text()), self.assOrShot )
			frames   = str(self.frameRange_le.text())
			if not w.renderMe_chb.isChecked():
				continue
			if w.overFrameRange_chb.isChecked():
				frames =  str( w.frameRange_le.text() )
			filename = mc.renderSettings( lyr = w.layer.name, gin = ('?'*pad) )[0]
			print filename
			if not mc.getAttr( "defaultRenderGlobals.ren" ) == 'mentalRay':
				filePrefix = filePrefix.replace( '<RenderLayer>', w.layer.name.replace( ':', '_' ) )
				#get version number
				if '<RenderLayerVersion>' in filePrefix:
					versionNumber = self._getVersionNumber( filePrefix.split( '<RenderLayerVersion>' )[0] )
					filePrefix = filePrefix.replace( '<RenderLayerVersion>', 'v' + str(versionNumber).zfill( 4 ) )
				filename = filePrefix + '.' + ('?'*pad) + os.path.splitext( filename )[1]
			print 'RENDERING', filename, w.layer.name
			#filename = filename.replace( ':', '_' )
			name = ''
			if self._project:
				name = self._project + ' - '
			Job = dl.Job( w.layer.name.replace( ':', '_' ),
					{		'Plugin'          : plugin,
							'Group'           : group,
							'Pool'            : pool,
							'Frames'          : frames,
							'Comment'         : comments,
							'InitialStatus'   : InitialStatus,
							'UserName'        : os.getenv('username'),
							'Whitelist'       : whiteList,
							'Name'            : name + curFile.name + ' - ' + w.layer.name,
							'OutputFilename0' : filename,
							'Priority'        : priority,
							'ChunkSize'       : taskSize,
							'OutputDirectory0': filename,
							'NotificationEmails': mails,
							'OverrideNotificationMethod': 'true',
							'EmailNotification': mailNoti
							},{'CommandLineOptions' : '-rl ' + w.layer.name + ' -mr:art ',
								'UsingRenderLayers' : 1,
								#'ProjectPath'       : projPath,
								'RenderLayer'       : w.layer.name,
								'OutputFilePrefix'  : filePrefix,
								'OutputPath'        : filename
							}, curFile )
			Job.write()
			dead.runMayaJob( Job )
Beispiel #20
0
def batcher(modules = [], functions = [], mayaFiles = [],saveFile = False,makeLog = False,mayaBatchPath = 'C:\\Program Files\\Autodesk\\Maya2015\\bin\\mayabatch.exe', help = False):
	""" create a Batch file """
	helpText = 'This script is for run an array of scripts\n'
	helpText += '(mel or python) in an array of maya files.\n'
	#helpText += 'The functions array will be executed in order.\n'
	helpText += 'WARNING:\n'
	helpText += '\tFor every module you need a function!!\n'
	helpText += '\tIf the function has the same name of the module,\n'
	helpText += '\tYou can leave the item in the function array empty-->\'\'\n'
	helpText += 'USAGE Ex:\n'
	helpText += '\tbatcher(\n'
	helpText += '\tmodules = [\'t:/lay/ftb_lay_importExportCamaraFromLayout\',\'t:/mel/ftb_mel_cameraSequence.mel\']\n'
	helpText += '\t,functions = [\'ftb_lay_importExportCamaraFromLayout.fixThisCameraScene()\',\'cameraSequence\']\n'
	helpText += '\t,mayaFiles = [\'C:/pol/270ride010a_lay_camera_v003.ma\',\'C:/skarone/666ride666a_lay_camera_v666.ma\']\n'
	helpText += '\t,saveFile = True  (This will make a back up of the file before edit)\n'
	helpText += '\t,makeLog = True  (This will make a log of the batch per file in the same path))\n'
	if (help):
		print helpText
		return False
	if not (len(mayaFiles)):
		print '>>please give me some maya Files'
		print '>>use batchFiles(help=True) for more information'
		return False
	if not (len(modules)):
		print '>>please give me some module'
		print '>>use batchFiles(help=True) for more information'
		return False
	if not (len(functions)):
		print '>>please give me some function'
		print '>>use batchFiles(help=True) for more information'
		return False
	if not (len(functions) == len(modules)):
		print '>>the lenght of the functions array is'
		print '>>not the same of the modules array'
		print '>>use batchFiles(help=True) for more information'
		return False
	#CREATE THE COMMAND TO EXECUTE
	cmd = ''
	cmd +='python (\\"import sys\\");' 
	for n,mod in enumerate(modules):
		#module exists???
		"""
		if not os.path.exists(mod):
			print '>>can\'t find module',mod
			return False;
		"""
		#detect if it is mel or python
		if(os.path.isfile(mod)):
			#probably is a mel
			filepath, fileMod = os.path.split(mod)
			file, fileExtension = os.path.splitext(fileMod)
			if not(fileExtension == 'mel'):
				print '>>this file isn\'t a python or a mel module',mod
				return False;
			else:
				#is a mel =) source
				cmd += 'source \"'+mod+'\";'
				if(functions[n] == ''):
					cmd += ''+file+';'
				else:
					cmd += ''+functions[n]+';'
		elif(os.path.isdir(mod)):
			#is a python =) module
			mod.replace('\\','/')
			m = mod.split('/')[-1]
			cmd +='python (\\"sys.path.append(\''+mod+'\')\\");'
			cmd +='python (\\"import '+m+'\\");'
			cmd +='python (\\"reload( '+m+')\\");'
			if(functions[n] == ''):
				cmd +='python (\\"'+m+'.'+m+'()'+'\\");'
			else:
				cmd +='python (\\"'+functions[n]+'\\");'
		else:
			print '>>something in this module is wrong',mod
			return False
	
	#LOOP THRU THE FILES
	for fileName in mayaFiles:
		finalcmd = cmd
		#fileName = fileName.replace('\\','/')
		fileName = mfl.mayaFile( fileName )
		if not fileName.exists:
			print '>>cant find file',fileName.path
			continue;
		if (saveFile):
			fileName.newVersion()
			finalcmd +='file -save;'
		finalcmd +='print (\\"done!\\n\\");'
		
		batch = ''
		batch += mayaBatchPath + ' -file "'+fileName.path+'" '
		batch +='-command "'+finalcmd+'" '
		
		if(makeLog):
			log = fileName.replace('.ma','.log')
			print log
			batch +=' -log "'+log+'"'
		print '>>about to execute',batch
		subprocess.call(str(batch))
		#os.system(batch)
		if(makeLog):
			subprocess.call('notepad.exe "'+log+'"')
	return
Beispiel #21
0
	def skinfixPath(self):
		"""return the skin fix file"""
		return mfl.mayaFile( self.path + '/SkinFix/' + self.name + '_SKINFIX.ma' )
Beispiel #22
0
	def litPath(self):
		"""return the anim file"""
		return mfl.mayaFile( self.path + '/Lit/' + self.name + '_LIT.ma' )
Beispiel #23
0
	def shadingPath(self):
		"""return shading path of the asset"""
		return mfl.mayaFile( self.path + '/' + AREAS[ 1 ] + '/Maya/' + self.name + "_" + AREAS[ 1 ] + ".ma" )
Beispiel #24
0
	def finalPath(self):
		"""return the FINAL path for the MA file"""
		return mfl.mayaFile( self.path + '/' + self.name + "_" + AREAS[ 4 ] + ".ma" )
Beispiel #25
0
	def skinFixPath(self):
		"""docstring for skinFixPath"""
		return mfl.mayaFile( self.path + '/SkinFix/' + self.name + '_SKIN.ma' )
Beispiel #26
0
	def simPath(self):
		"""return the anim file"""
		return mfl.mayaFile( self.path + '/Sim/' + self.name + '_SIM.ma' )
Beispiel #27
0
	def lightPath(self):
		"""return path for lights file"""
		return mfl.mayaFile( self._path + '/lights.ma' )
Beispiel #28
0
	def addFileToHistoryMenu(self, path):
		"""docstring for addFileToHistoryMenu"""
		asset = mfl.mayaFile( path )
		actionOpenHistory = QtGui.QAction( asset.path, self.menuHistory )
		self.menuHistory.addAction( actionOpenHistory )
		self.connect( actionOpenHistory, QtCore.SIGNAL( "triggered()" ), lambda val = asset : self.openHistoryFile(val) )
Beispiel #29
0
	def hrsPath(self):
		"""return the anim file"""
		return mfl.mayaFile( self.path + '/Hrs/' + self.name + '_HRS.ma' )
Beispiel #30
0
	def previewMayaFile(self):
		"""return the preview maya file"""
		return mfl.mayaFile( self.path + self.name + 'Preview' + '.ma' )
Beispiel #31
0
	def vfxPath(self):
		"""return the anim file"""
		return mfl.mayaFile( self.path + '/Vfx/' + self.name + '_VFX.ma' )