예제 #1
0
파일: hiRes.py 프로젝트: houdrook/pipeline
def getHiresSQ():
	pat = re.compile('^\d{1,10}')
	n = nuke.toNode('HiRes')
	xpos = n.knob('xpos').value()
	ypos = n.knob('ypos').value()
	
	sObj = pipe.Projects().GetAssetByInfo(nuke.root().name())
	hPath = sObj.GetShot().GetOutPath() + '/hires/'
	
	os.system('chmod 777 -R ' + hPath)
	
	vDirs = filter(lambda x: pat.search(x) , os.listdir(hPath))
	
	sName = sObj.GetShot().name	
	sqName = sObj.GetShot().seq_name
	seqObject = sObj.GetSequence()
	
	if vDirs:
		cPath = os.path.join(hPath,str(filesys.padding(max([(int(f)) for f in vDirs]),2)))
	else:
		cPath = os.path.join(hPath,str(filesys.padding(1,2)))
	hList = os.listdir(cPath)
	hList.sort()
	fUText = cPath + os.sep + hList[-1].rsplit('.',2)[0] + '.%0' + str(len(max(hList).rsplit('.', 2)[-2])) + 'd.' + hList[-1].split('.')[-1] + ' ' + str(int(hList[0].rsplit('.', 2)[-2])) + '-' + str(int(hList[-1].rsplit('.', 2)[-2]))
	
	dPath = os.path.join(filesys.REPO, sObj.GetProject().name, filesys.OUT,'hires',sqName, sName + seqObject.GetPrefix())
	
	if not os.path.exists(dPath):	filesys.mkdirs(dPath)

	shotObject = sObj.GetShot()
	sName = shotObject.name
	num_folder = cPath.split(os.sep)[-1]
	
	os.system('cd %s && ln -sf ../../../../film/sequences/%s/shots/%s/out/hires/%s'%(dPath,shotObject.seq_name,sName, num_folder ))
	
	r = nuke.createNode('Read')
	r.knob('name').setValue('Hires')
	r.knob('file').fromUserText(fUText)
	r.knob('xpos').setValue(xpos + 100)
	r.knob('ypos').setValue(ypos)
예제 #2
0
def CreateHiresByAfanasy():
	
	
	# check for all read nodes
	readList = [(node.knob('name').value(),node.knob('file').value()) for node in nuke.allNodes('Read')]
	rlen = len(filesys.REPO)
	suspected = [n for n in readList if n[1][:rlen] != filesys.REPO]
	if suspected: raise Exception('Error! Files in nodes below have to move into %s:\n%s'%(filesys.REPO,'\n'.join([str('%s - %s'%(n[0],n[1])) for n in suspected])))
			
	# settings variables
	
	ext = 'dpx'
	cSpace = 'sRGB'
	pad = '.%06d.'	
	
	# creating paths and HiRes name
	
	sObj = pipe.Projects().GetAssetByInfo(nuke.root().name())
	nPath = sObj.GetCurrentActualPath()
	hName = sObj.GetShot().name + pad + ext
	hFPath = sObj.GetShot().GetOutPath() + '/hires/'
	hList = os.listdir(hFPath)
	hFolder = ''

	# write node creation
	if nuke.toNode('HiRes'):
		
		nuke.message('Node HiRes already exists. Use that one, %username% :-)')
		pass
	
	else:
			
		sNode = nuke.selectedNode()
		hNode = nuke.createNode('Write', inpanel=False)
		hNode.knob('name').setValue('HiRes')
		hNode.knob('colorspace').setValue(cSpace)
		hNode.knob('channels').setValue('rgb')
		
		aNode = nuke.createNode("afanasy", inpanel=False)
		aNode.knob('hmask').setValue('tfxr.*')
		aNode.knob('jname').setValue('%s'%sObj.name)
		aNode.knob('first').setValue(nuke.root().firstFrame())
		aNode.knob('last').setValue(nuke.root().lastFrame())
		
		# Hires folder is empty
		if not hList:
			hFolder = hFPath + str(filesys.padding(1, 2))
			os.mkdir(hFolder)
			hNode.knob('file').setValue(hFolder + os.sep + hName)
		# Hires folder is not empty
		else:
			hList = filter(lambda x: pat.search(x) , hList)
			hFolder = hFPath + str(filesys.padding(max([(int(f)) for f in hList]), 2))
			hNode.knob('file').setValue(hFolder + os.sep + hName)
	
	#Make link into out/hires folder
	shotObject = sObj.GetShot()
	sName = shotObject.name
	seqObject = sObj.GetSequence()
	
	dPath = os.path.join(filesys.REPO, sObj.GetProject().name, filesys.OUT,'hires',shotObject.seq_name, sName + seqObject.GetPrefix())
	if not os.path.exists(dPath):	filesys.mkdirs(dPath)
	num_folder = hFolder.split(os.sep)[-1]
	
	os.system('cd %s && ln -sf ../../../../film/sequences/%s/shots/%s/out/hires/%s'%(dPath,shotObject.seq_name,sName, num_folder ))