Beispiel #1
0
	def _fillUi(self):
		"""fill ui"""
		dead = dl.Deadline()
		self.groups_cmb.addItems( dead.groups )
		settings = sti.Settings()
		gen = settings.General
		renderPath = 'R:/'
		if gen:
			renderPath = gen[ "renderpath" ]
			if not renderPath.endswith( '/' ):
				renderPath += '/'
		self.pools_cmb.addItems( dead.pools )
		renderGlobals = mn.Node( 'defaultRenderGlobals' )
		self.filePath_le.setText( str( renderGlobals.a.imageFilePrefix.v ))
		self.assOrShot = prj.shotOrAssetFromFile( mfl.currentFile() )
		self.projectPath_le.setText( mc.workspace( q = True, fullName = True ) )
		self._project = ''
		if self.assOrShot:
			if self.assOrShot.type == 'asset':
				if gen.has_key( 'assetrenderpath' ):
					pat = renderPath + gen[ "assetrenderpath" ]
				else:
					pat = renderPath + '<project>' + '/Assets/' + '<asset>' + '/Render/<RenderLayer>/' + '<RenderLayerVersion>' + '/<RenderLayer>'
			elif self.assOrShot.type == 'shot':
				if gen.has_key( 'shotrenderpath' ):
					pat = renderPath + gen[ "shotrenderpath" ]
				else:
					pat = renderPath + '<project>' + '/' + '<sequence>' + '/' + '<shot>' + '/<RenderLayer>/' + '<RenderLayerVersion>' + '/<RenderLayer>'
			self._project = self.assOrShot.project.name
			self.filePath_le.setText( str( pat ))
		self.frameRange_le.setText( str( int( renderGlobals.a.startFrame.v ) ) + "-" + str( int(  renderGlobals.a.endFrame.v ) ) )
		self._fillLayers()
Beispiel #2
0
def withFace():
	"""docstring for withHistory"""
	withHis,withFace = isMeshWithHistory()
	if withFace:
		cur = mfl.currentFile()
		fil = fl.File( 'D:/conCaras/' + cur.name + '.txt' )
		fil.write( 'mierda' )
Beispiel #3
0
def withFace():
    """docstring for withHistory"""
    withHis, withFace = isMeshWithHistory()
    if withFace:
        cur = mfl.currentFile()
        fil = fl.File('D:/conCaras/' + cur.name + '.txt')
        fil.write('mierda')
Beispiel #4
0
def customSavePerArea():
	"""docstring for customSavePerArea"""
	curFile = mfl.currentFile();
	result = True
	if '_shading' in curFile.name.lower() or '_model' in curFile.name.lower():
		transForms = gutils.transformsWithoutFreeze()
		texturesNotInServer = tm.Manager().texturesNotInServerPath()
		msg =''
		if transForms:
			msg = '-There are transforms without freeze!, please fix it\n'
		if texturesNotInServer:
			msg += '-There are textures that are not pointing to the server!, please fix it\n'
		if msg:
			result = showMessage( msg )
	if not result == 'Ok':
		curFile.newVersion();
		curFile.save()
		if '_final' in curFile.name.lower():# send mail to lighting department
			gen = sti.Settings().General
			sendMail = gen[ "sendmail" ]
			mailServer = gen[ "mailserver" ]
			mailPort = gen[ "mailport" ]
			mailsPath = gen[ "departmentspath" ]
			asse = prj.shotOrAssetFromFile( curFile )
			if sendMail:
				ml.mailFromTool( 'new_asset_publish',{
						'<ProjectName>' : asse.project.name,
						'<AssetName>': asse.name,
						'<UserName>': os.getenv('username')},
						os.getenv('username') + '@bitt.com',
						mailsPath , mailServer, mailPort  )
Beispiel #5
0
	def _loadConfig(self):
		"""load config settings"""
		if INMAYA:
			sht = prj.shotOrAssetFromFile(mfl.currentFile())
		else:
			sht = None
		if sht:
			if str( type(sht) ) == "<class 'pipe.shot.shot.Shot'>":
				index = self.projects_cmb.findText( sht.project.name )
				if not index == -1:
					self.projects_cmb.setCurrentIndex(index)
				index = self.sequences_cmb.findText( sht.sequence.name )
				if not index == -1:
					self.sequences_cmb.setCurrentIndex(index)
				index = self.shots_cmb.findText( sht.name )
				if not index == -1:
					self.shots_cmb.setCurrentIndex(index)
				return
		if not os.path.exists( settingsFile ):
			return
		his = self.settings.History
		if his:
			if 'lastproject' in his:
				lastProject = his[ "lastproject" ]
				if lastProject:
					index = self.projects_cmb.findText( lastProject )
					if not index == -1:
						self.projects_cmb.setCurrentIndex(index)
Beispiel #6
0
	def publish(self):
		"""docstring for publish"""
		if INMAYA:
			fil = mfl.currentFile()
			if not fil:
				print 'Please Save File To create Playblast'
				return
			movFil = fl.File( fil.versionPath + fil.name + '_v' + str( fil.version ).zfill( 3 ) + '.mov' )
		elif INHOU:
			fil = hfl.currentFile()
			if not fil:
				print 'Please Save File To create Playblast'
				return
			movFil = fl.File( fil.versionPath + fil.name + '_v' + str( fil.version ).zfill( 3 ) + '.mov' )
		if movFil.exists:
			movFil.copy( fil.dirPath + fil.name + '.mov' )
			settings = sti.Settings()
			gen = settings.General
			if gen:
				self.sendMail = gen[ "sendmail" ]
				self.mailServer = gen[ "mailserver" ]
				self.mailPort = gen[ "mailport" ]
				self.mailsPath = gen[ "departmentspath" ]
				AssOrShot = prj.shotOrAssetFromFile( movFil )
				ml.mailFromTool( 'new_playblast',
					{ '<ProjectName>': AssOrShot.project.name,
					'<SequenceName>': AssOrShot.sequence.name,
					'<ShotName>': AssOrShot.name,
					'<UserName>': os.getenv('username'),
					'<Path>':fil.dirPath + fil.name + '.mov'},
					os.getenv('username') + '@bitt.com',
					self.mailsPath , self.mailServer, self.mailPort  )
Beispiel #7
0
	def getDirForRenderData(self):
		"""get the directory for the render layer data"""
		if self.useSceneForlder_chb.isChecked():
			pathDir = mfl.currentFile().dirPath + '/Data/'
		else:
			pathDir = str(QtGui.QFileDialog.getExistingDirectory(self, "Select Directory"))
		return pathDir
Beispiel #8
0
def playblastCurrentFile():
	"""playblast current File"""
	fil = mfl.currentFile()
	if not fil:
		print 'Please Save File To create Playblast'
		return
	movFil = fl.File( fil.versionPath + fil.name + '_v' + str( fil.version ).zfill( 3 ) + '.mov' )
	playblast( movFil )
Beispiel #9
0
def playblastCurrentFile():
    """playblast current File"""
    fil = mfl.currentFile()
    if not fil:
        print 'Please Save File To create Playblast'
        return
    movFil = fl.File(fil.versionPath + fil.name + '_v' +
                     str(fil.version).zfill(3) + '.mov')
    playblast(movFil)
Beispiel #10
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 #11
0
	def reference(self):
		"""reference file into scene"""
		tab = self._getCurrentTab()
		item = tab.currentItem()
		if uiH.USEPYQT:
			asset = item.data(32).toPyObject()
		else:
			asset = item.data(32)
		#TODO HERE WE NEED TO DETECT IF WE ARE IN A SHOT
		gen = self.settings.General
		assetPerShot = gen[ "useassetspershot" ]
		if assetPerShot == 'True':
			shotSel = prj.shotOrAssetFromFile( mfl.currentFile() )
			#assetspath + assetname + department + file
			newFil = asset.copy( shotSel.assetsPath + asset.path.split( 'Assets/' )[-1] )
			newFil.reference()
		else:
			asset.reference()
Beispiel #12
0
	def setCurrentFile(self):
		"""docstring for fname"""
		import pipe.mayaFile.mayaFile as mfl
		curFile = mfl.currentFile()
		sht = prj.shotOrAssetFromFile( curFile )
		if sht:
			print 'FindProject',sht.project.name
			index = self.projects_cmb.findText( sht.project.name )
			if not index == -1:
				self.projects_cmb.setCurrentIndex(index)
			if str( type(sht) ) == "<class 'pipe.shot.shot.Shot'>":
				index = self.sequences_cmb.findText( sht.sequence.name )
				if not index == -1:
					self.sequences_cmb.setCurrentIndex(index)
				index = self.shots_cmb.findText( sht.name )
				if not index == -1:
					self.shots_cmb.setCurrentIndex(index)
			else:
				print 'FindAsset',sht.name
				index = self.assets_cmb.findText( sht.name )
				if not index == -1:
					self.assets_cmb.setCurrentIndex(index)
Beispiel #13
0
 def publish(self):
     """docstring for publish"""
     if INMAYA:
         fil = mfl.currentFile()
         if not fil:
             print 'Please Save File To create Playblast'
             return
         movFil = fl.File(fil.versionPath + fil.name + '_v' +
                          str(fil.version).zfill(3) + '.mov')
     elif INHOU:
         fil = hfl.currentFile()
         if not fil:
             print 'Please Save File To create Playblast'
             return
         movFil = fl.File(fil.versionPath + fil.name + '_v' +
                          str(fil.version).zfill(3) + '.mov')
     if movFil.exists:
         movFil.copy(fil.dirPath + fil.name + '.mov')
         settings = sti.Settings()
         gen = settings.General
         if gen:
             self.sendMail = gen["sendmail"]
             self.mailServer = gen["mailserver"]
             self.mailPort = gen["mailport"]
             self.mailsPath = gen["departmentspath"]
             AssOrShot = prj.shotOrAssetFromFile(movFil)
             ml.mailFromTool(
                 'new_playblast', {
                     '<ProjectName>': AssOrShot.project.name,
                     '<SequenceName>': AssOrShot.sequence.name,
                     '<ShotName>': AssOrShot.name,
                     '<UserName>': os.getenv('username'),
                     '<Path>': fil.dirPath + fil.name + '.mov'
                 },
                 os.getenv('username') + '@bitt.com', self.mailsPath,
                 self.mailServer, self.mailPort)
Beispiel #14
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 #15
0
def main():
	"""use this to create project in maya"""
	if mc.window( 'MayaFilePropertiesUi', q = 1, ex = 1 ):
		mc.deleteUI( 'MayaFilePropertiesUi' )
	PyForm=MayaFilePropertiesUi(mfl.currentFile(), inMaya = True )
	PyForm.show()
Beispiel #16
0
def renderOcc( motionBlur, group ):
	#setup render settings
	curFile = mfl.currentFile()
	dead = dl.Deadline()
	defRenderGlobals = mn.Node( 'defaultRenderGlobals' )
	defRenderGlobals.a.currentRenderer.v = 'arnold'
	defRenderGlobals.a.animation.v = True
	defRenderGlobals.a.extensionPadding.v = 4
	defRenderGlobals.a.putFrameBeforeExt.v = 1
	defArnoldRenderOptions = mn.Node( 'defaultArnoldRenderOptions' )
	defArnoldRenderOptions.a.motion_blur_enable.v = motionBlur
	defArnoldRenderOptions.a.motion_steps.v = 3
	mn.Node( 'defaultArnoldDriver' ).a.aiTranslator.v = 'exr'
	attrs = [ 'ignoreAtmosphere', 'ignoreLights',
			'ignoreShadows', 'ignoreDisplacement', 'ignoreBump' ]
	for a in attrs:
		defArnoldRenderOptions.attr( a ).v = 1
	defArnoldRenderOptions.a.AASamples.v = 3
	attrs = [ 'GIDiffuseSamples', 'GIGlossySamples',
			'GIRefractionSamples', 'sssBssrdfSamples', 'volumeIndirectSamples' ]
	for a in attrs:
		defArnoldRenderOptions.attr( a ).v = 0
	#TURN OFF ALL CAMERAS RENDERABLES
	for c in mn.ls( typ = 'camera' ):
		c.a.renderable.v = 0
	#TURN CAMERA TO RENDER ON
	currCam = getCurrentCamera()
	currCam.shape.a.renderable.v = 1
	#TURN OFF ALL IMAGE PLANES
	imagePlanes = mn.ls( exactType = 'imagePlane' )
	for i in imagePlanes:
		i.a.alphaGain.v = 0
	#set attributes on for all the meshes
	attrs = [ 'castsShadows', 'receiveShadows',
			'primaryVisibility', 'motionBlur' ]
	for n in mn.ls( typ = 'mesh' ):
		for a in attrs:
			n.attr( a ).v = 1
	#Turn OFF ALL AOVS
	for ao in aov.aovsInScene():
		ao.a.enabled.v = 0
	#Create OCC AOV
	aovNode = mn.Node( 'aiAOV_Aov_OCC' )
	if not aovNode.exists:
		aovNode = aov.create( aovName = 'Aov_OCC' , aovType = 6 )
	#Turn On OCC AOV
	aovNode.a.enabled.v = 1
	createShader(aovNode)
	#write job for render
	settings = sti.Settings()
	gen = settings.General
	renderPath = 'R:/'
	if gen:
		renderPath = gen[ "renderpath" ]
		if not renderPath.endswith( '/' ):
			renderPath += '/'
	assOrShot = prj.shotOrAssetFromFile( curFile )
	name = ''
	filename = ''
	if assOrShot:
		if assOrShot.type == 'shot':
			if gen.has_key( 'greypath' ):
				filePrefix = renderPath + gen[ "greypath" ]
			else:
				filePrefix = renderPath + '/<project>' + '/' + '<sequence>' + '/' + '<shot>' + '/Grey/' + '<RenderLayerVersion>' + '/Grey'
			#replace <tags> to final names
			filePrefix = getFilePrefixFromTags( filePrefix, assOrShot )
		else:
			print 'Cant Detect current shot :(, please save scene if its is a shot'
			return
		if '<RenderLayerVersion>' in filePrefix:
			versionNumber = _getVersionNumber( filePrefix.split( '<RenderLayerVersion>' )[0] )
			filePrefix = filePrefix.replace( '<RenderLayerVersion>', 'v' + str(versionNumber).zfill( 4 ) )
		filename = filePrefix + '.' + ('?'*4) + os.path.splitext( filename )[1]
		name = assOrShot.project.name + ' - '
	else:
		print 'please save scene in project'
		return
	curFile.newVersion()
	curFile.save()
	Job = dl.Job( 'defaultRenderLayer',
			{		'Plugin'          : 'MayaBatch',
					'Group'           : group,
					'Pool'            : '',
					'Frames'          : str( int( mc.playbackOptions( q = True, min = True ) ) ) + "-" + str( int( mc.playbackOptions( q = True, max = True ) ) ),
					'Comment'         : '',
					'InitialStatus'   : 'Active',
					'Whitelist'       : '',
					'Name'            : name + curFile.name + ' - ' + 'Grey',
					'OutputFilename0' : filename,
					'Priority'        : 50,
					'ChunkSize'       : 5,
					'OutputDirectory0': filename
					},{'CommandLineOptions' : '-rl ' + 'defaultRenderLayer' + ' -mr:art ',
						'UsingRenderLayers' : 1,
						#'ProjectPath'       : projPath,
						'RenderLayer'       : 'defaultRenderLayer',
						'OutputFilePrefix'  : filePrefix,
						'OutputPath'        : filename
					}, curFile )
	Job.write()
	dead.runMayaJob( Job )
	#TURN ON IMAGE PLANES
	for i in imagePlanes:
		i.a.alphaGain.v = 1
Beispiel #17
0
	def project(self):
		"""load project light Rig"""
		asset = prj.shotOrAssetFromFile( mfl.currentFile() )
		litRig  = ass.Asset( 'LightRig', asset.project )
		if litRig.exists:
			loadUnloadLightRig( litRig.shadingPath.path )