Beispiel #1
0
def load_src():
    import pipe
    asset_obj = pipe.Projects().GetAssetByInfo(nuke.root().name())
    if not asset_obj: return
    shot_obj = asset_obj.GetShot()
    if not shot_obj: raise Exception('Shot not found')
    src_path = shot_obj.GetSrcPath()
    sequences = condensing_is(src_path, 'src')
    if not sequences: nuke.message("There aren't files in folder SRC")
    filenameSearch = "Load"
    enumerationPulldownp = "None " + ' '.join(sequences.keys())
    p = nuke.Panel("Presets selection")
    p.addEnumerationPulldown("SRC to load:", enumerationPulldownp)
    p.addButton("Cancel")
    p.addButton("Load")

    result = p.show()
    enumVal = p.value("SRC to load:")
    if enumVal == 'None': return
    #nuke.message(sequences[enumVal])
    n = nuke.toNode(enumVal)
    if not n:
        n = nuke.createNode('Read', inpanel=False)
        n.setName(enumVal)
    n.knob('file').fromUserText(sequences[enumVal])
Beispiel #2
0
def newRender():
	pat = re.compile('^\d{1,10}')
	n = nuke.selectedNode()
	fPath = n.knob('file').value()
	curHList = os.listdir(fPath.rsplit(os.sep, 1)[0])
	hFolder = fPath.rsplit(os.sep, 2)[0]
	hName = fPath.rsplit(os.sep, 1)[-1]
	lPath = nuke.root().name()
	
	if curHList:
		
		q = nuke.ask('Create new version?')
		
		if q:
			vDirs = os.listdir(hFolder)
			#raise Exception( vDirs)
			vDirs = filter(lambda x: pat.search(x) , vDirs)
			#raise Exception( vDirs)
			if vDirs:
				hFPath = hFolder + os.sep + str(filesys.padding(max([(int(f)) for f in vDirs]) + 1, 2))
			else:
				hFPath =hFolder + os.sep + str(filesys.padding(1, 2))
			#hFPath = hFolder + os.sep + str(filesys.padding(max([(int(f)) for f in vDirs]) + 1, 2))
			os.mkdir(hFPath)
			
			pipe.Projects().GetAssetByInfo(lPath).CheckIn('HiRes creation\n' + hFPath + os.sep + hName, True)
			
			n.knob('file').setValue(hFPath + os.sep + hName)
			
		else:
			
			nuke.scriptSave()
			pipe.Projects().GetAssetByInfo(lPath).CheckIn('HiRes creation v' + fPath.rsplit('/',2)[-2], True)

	else:
		
		nuke.scriptSave()
		pipe.Projects().GetAssetByInfo(lPath).CheckIn('HiRes creation v' + fPath.rsplit('/',2)[-2], True)
Beispiel #3
0
def startRenderPyroCache():
    if not _checkHip(): return
    curNodeLs = hou.pwd()
    curParm = curNodeLs.parm("sopoutput").eval()
    pyroNode = hou.node(curNodeLs.path().rsplit('/', 1)[0])
    if not curParm == "PIPECACHE": return
    hip = hou.hipFile.name()
    name = hip.split(os.sep)[-1].split('.')[0]
    import pipe
    obj_asset = pipe.Projects().GetAssetByInfo(hip)
    path = os.path.join(obj_asset.GetDataPath(), 'geo', name)
    dir_render, padd_dir, padd_int = filesys.get_next_version_dir(path)
    dir_render += os.sep + pyroNode.name()
    if not os.path.exists(dir_render): os.makedirs(dir_render)
    dir_render += os.sep + pyroNode.name() + '.$F4.bgeo'
    pyroNode.parm("file").set(dir_render)
    print dir_render
Beispiel #4
0
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)
Beispiel #5
0
def fillReads():
    read_node = nuke.selectedNode()
    if not read_node.Class() == 'Read':
        raise Exception('Must select a read node!')
    import sys, os, popen2
    sys.path.append('/usr/pipeline/lib')
    from nukescripts import pyQtAppUtils, utils
    import filesys
    import pipe
    reload(filesys)
    reload(pipe)
    asset_obj = pipe.Projects().GetAssetByInfo(nuke.root().name())
    if not asset_obj: raise Exception('Script not in projects')
    obj_data = asset_obj.GetShot()
    if not obj_data: obj_data = asset_obj.GetSequence()
    if not obj_data: raise Exception('Data path not found')
    #obj_data.RefreshRenderLatest()
    #renders_data = obj_data.GetDataRenderLatest()
    meta_knob = read_node.metadata()
    renders_data = filesys.GetAllRenderVersions(meta_knob['input/filename'])
    #print renders_data
    ReloadRendersPanel(read_node, renders_data).showModalDialog()
Beispiel #6
0
def cvci():

    try:
        comment = 'test check in'
        nuke.scriptSave()
        proc = subprocess.Popen(
            'comments -m maya -c good',
            shell=True,
            stdout=subprocess.PIPE,
        )
        stdout_value = proc.communicate()[0]
        if stdout_value != None:
            comment = stdout_value  #r.readlines()[0]
        lst_comments = comment.split('\t')
        isGood = False
        if len(lst_comments) > 1:
            if lst_comments[1].strip('\n') == 'g':
                isGood = True
            comment = lst_comments[0]
        asset_obj = pipe.Projects().GetAssetByInfo(nuke.root().name())
        asset_obj.CheckIn(comment, isGood)
    except:
        exctype, value = sys.exc_info()[:2]
        raise Exception("Unexpected error: %s" % value)
Beispiel #7
0
def mocha_open():
    n = nuke.selectedNode()
    if not n.Class() == 'Read': raise Exception('Must select a read node!')
    frmt = n.knob('format').value()
    frrg = n.frameRange()
    first = int(frrg.first())
    last = int(frrg.last())

    import pipe, filesys
    asset_obj = pipe.Projects().GetAssetByInfo(nuke.root().name())
    if not asset_obj: return
    shot_obj = asset_obj.GetShot()
    if not shot_obj: raise Exception('Shot not found')

    start_path = asset_obj.GetDataPath() + os.sep + 'tracks' + os.sep

    file_v = n.knob('file').value()
    ext = file_v.split('.')[-1]
    new_path = file_v.rsplit(os.sep, 1)[0] + os.sep

    ims = filesys.ImageSequence(new_path)

    files = [x for x in os.listdir(new_path) if x[-(len(ext)):] == ext]

    new_len_files = last - first  # + 1
    new_name = ims.getName(
    )  # + ims.getSep() #'.'.join(files[0].split('.')[:-2])

    conf_file = filesys.USER_HOME + os.sep + '.config/Imagineer Systems Ltd/Mocha 1 Linux.conf'
    if not os.path.exists(conf_file):
        raise Exception("Default config file not found: "
                        ','.join(
                            os.listdir(filesys.USER_HOME + os.sep +
                                       '.config/Imagineer Systems Ltd')))

    cls_config = buff(conf_file)
    cls_config["LastSaveTrackingDataFolder"] = start_path
    cls_config["AbsoluteOutputDirectory"] = '/tmp//MoTemp'
    cls_config["LastTrackingExportFormat"] = 9

    cls_config.save()

    cls_buffer = buff(TEMPLATE)

    old_name = cls_buffer["Core.ClipPrefix.value"][:-1]

    cls_buffer["Core.ClipLength.value"] = new_len_files + 1
    cls_buffer["Core.ClipDirectory.value"] = new_path
    cls_buffer["ProjectOutputDirectory.value"] = '/tmp//MoTemp'
    cls_buffer["Core.MaximumIndex.value"] = last
    cls_buffer["Core.MinimumIndex.value"] = first
    cls_buffer["UseAbsoluteOutputDirectory.value"] = 1
    cls_buffer["Core.FrameWidth.value"] = frmt.width()
    cls_buffer["Core.FrameHeight.value"] = frmt.height()
    cls_buffer["Core.ClipSuffix.value"] = '.' + ext
    cls_buffer["Core.ClipPrefix.value"] = new_name + ims.getSep()
    cls_buffer["PlaybackOutPoint.value"] = new_len_files  #last-1
    cls_buffer["Core.IndexWidth.value"] = ims.getLengthOfPadding()
    cls_buffer["Core.FirstFrameOffset.value"] = 1
    """ How about this:
	.Core.FrameRate.value=24                                                                                                                                                                                                               
	.Core.MasterTimelineClipID.value=0                                                                                                                                                                                                     
	.Core.FirstFrameOffset.value=1                                                                                                                                                                                                         
	.Core.FilmType.value=HD                                                                                                                                                                                                                
	.Core.FilmBackWidth.value=16                                                                                                                                                                                                           
	.Core.FilmBackHeight.value=9                                                                                                                                                                                                           
	.Core.FilmWidth1.value=1920                                                                                                                                                                                                            
	.Core.FilmWidth2.value=1280                                                                                                                                                                                                            
	.Core.FilmWidth3.value=640                                                                                                                                                                                                             
	.Core.FilmHeight1.value=1080                                                                                                                                                                                                           
	.Core.FilmHeight2.value=720                                                                                                                                                                                                            
	.Core.FilmHeight3.value=480                                                                                                                                                                                                            
	.Core.AspectRatio.value=1.77778                                                                                                                                                                                                        
	.Core.PixelAspectRatio.value=1
	?????????????     
	"""
    cls_buffer.replace(old_name, new_name)
    os.system('mkdir /tmp/MoTemp')
    cls_buffer.save('/tmp/MoTemp/new.mocha')
    os.system('/mnt/opt/mocha/mocha /tmp/MoTemp/new.mocha ')
Beispiel #8
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 ))
Beispiel #9
0
def PipeDailies():

    n = nuke.selectedNode()

    sObj = pipe.Projects().GetAssetByInfo(nuke.root().name())

    movPath = sObj.GetShot().GetOutPath() + '/dailies/'

    renderPath = sObj.GetDataPath() + '/render/tmp_dailies/'

    if not os.path.exists(renderPath):

        os.mkdir(renderPath)

    shotObject = sObj.GetShot()
    seqObject = sObj.GetSequence()

    sName = shotObject.name + seqObject.GetPrefix()

    if not os.listdir(movPath):

        vNum = '.v001'

    else:

        q = nuke.ask('Create new version?')

        if q: c = 1
        else: c = 0

        hList = filter(lambda x: pat.search(x), os.listdir(movPath))
        hList = [
            int(x.rsplit('.', 2)[-2].split('v')[-1]) for x in hList
            if x[:len(sName)] == sName
        ]
        if not hList:
            vNum = '.v001'
        else:
            vNum = '.v' + filesys.padding(max(hList) + c, 3)

    pad = len(str(int(nuke.animationEnd())))

    wNode = nuke.createNode('Write', inpanel=False)

    wNode.knob('file').setValue(renderPath + sName + vNum + '.%0' + str(pad) +
                                'd.jpg')

    # if there are Slate render is 1 frame longer

    if n.Class() == 'Slate' or n.Class() == 'slate2':

        r = nuke.render(wNode.name(),
                        start=int(nuke.animationStart()),
                        end=int(nuke.animationEnd()) + 1,
                        incr=1)

    else:

        r = nuke.render(wNode.name(),
                        start=int(nuke.animationStart()),
                        end=int(nuke.animationEnd()),
                        incr=1)

    nuke.delete(wNode)

    # mov creation

    # paths to djv folder
    pp = os.getenv('PROGRAM_PATH')
    djv = 'LD_LIBRARY_PATH=' + pp + '/djv/lib ' + pp + '/djv/bin/djv_convert'
    djView = 'LD_LIBRARY_PATH=' + pp + '/djv/lib ' + pp + '/djv/bin/djv_view'

    print djv, djView

    jpgName = sName + vNum

    jpgList = [
        x for x in os.listdir(renderPath) if x[:len(jpgName)] == jpgName
    ]

    jpgList.sort()

    sPath = renderPath + jpgList[0].rsplit(
        '.', 1)[0] + '-' + jpgList[-1].rsplit('.', 2)[-2] + '.jpg'

    djvArg = sPath + ' ' + movPath + jpgName + '.mov'

    # runs convertation
    os.system(djv + ' ' + djvArg)
    os.system('chmod 777' + ' ' + movPath + jpgName + '.mov')

    # clears tmp jpg folder

    shutil.rmtree(renderPath)

    # creates copy to REPO

    dPath = filesys.REPO + '/' + sObj.GetProject(
    ).name + '/out/dailies/' + strftime('%y.%m.%d')

    if not os.path.exists(dPath):
        os.makedirs(dPath)

    sPath = movPath + jpgName + '.mov'

    os.system(
        'cd %s && ln -sf ../../../film/sequences/%s/shots/%s/out/dailies/%s' %
        (dPath, shotObject.seq_name, shotObject.name, str(jpgName + '.mov')))
    #os.system('cp -f ' + sPath + ' ' + dPath)

    # checkIn

    nuke.scriptSave()

    # make comment
    comment = 'Dailies creation v' + vNum.split('.')[-1]

    # send comment to DB
    sObj.Events().Add(comment,
                      filesys.DAILIES,
                      extra={
                          'file': sPath,
                          'user': filesys.USERNAME
                      })

    #
    sObj.CheckIn(comment, True)

    # opens *.mov file
    os.system(djView + ' ' + movPath + jpgName + '.mov')
Beispiel #10
0
def Slate():
    
    sObj = pipe.Projects().GetAssetByInfo(nuke.root().name())

    # pInfo values

    pName = sObj.GetProject().name
    
    sqName = sObj.GetShot().seq_name
    
    sName = sObj.GetShot().name
    
    movPath = sObj.GetShot().GetOutPath() + '/dailies/'
    
    if os.listdir(movPath):
        
        vNum = str(max([int(x.rsplit('.', 2)[-2].split('v')[-1]) for x in os.listdir(movPath) if x[:len(sName)] == sName]) + 1)
    
    else:
    
        vNum = '1'
        
        
    # sInfo values
    
    sDescr = sObj.GetDescription()
 
    notes = nuke.getInput('Enter submission notes:\animation approval, rig removal approval etc', sDescr + ' approval')   
    
    mName = socket.gethostname().split('.', 1)[0]

    uVoc = {'scooby': 'Hanna Kucherevich',
            'porky': 'Anton Mitrakhov',
            'vinny': 'Zhanna Fitsay',
            'pluto':'Ievgen Kulieshov',
            'bender':'Denis Siplenko',
            'daffy':'Yevgen Skorobogatko',
            'piglet':'Ilya Goncharov',
            'lynx':'Alexandra Glukhova',
            'casper':'Vladimir Mikheyenko',
            'kermit':'Vlad Scripnik'}
    
    if not mName in uVoc.keys():
        
        aName = nuke.getInput('Enter your name:', 'Alexander Koreshkov')
        
    else:
        
        aName = uVoc[mName]
           
            
    res = nuke.root().knob('format').value().name() + ' ' + str(nuke.root().knob('format').value().width()) + 'x' + str(nuke.root().knob('format').value().height())                         
   
    tFC = str(int(nuke.animationEnd() - nuke.animationStart()) + 1) + ' frames'
    
    fps = str(int(nuke.root().knob('fps').value())) + ' fps'
    
    dOS = strftime('%y.%m.%d')    
    
    
    
    # slate node creation   
    
    s = nuke.createNode('Slate')
    
    s.knob('pInfo').setValue('Project: ' + pName + 
                             '\nSequence: ' + sqName +
                             '\nShot: ' + sName +  
                             '\nVersion: ' + vNum)
    
    s.knob('sInfo').setValue('Shot description: ' + sDescr +
                            '\nNotes: ' + notes +
                            '\nArtist: ' + aName +
                            '\nResolution: ' + res +
                            '\nTotal frame count: ' + tFC +
                            '\nFrame Rate: ' + fps +
                            '\nDate of submission: ' + dOS)
                                                    
 

    
    
Beispiel #11
0
def CreateHires():

	# settings variables
	
	ext = 'dpx'
	cSpace = 'Cineon'
	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)
	

	# 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('beforeRender').setValue('newRender()')
		hNode.knob('afterRender').setValue('getHiresSQ()')	
		hNode.knob('colorspace').setValue(cSpace)
		hNode.knob('channels').setValue('rgb')
		
		# 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)
			
			rq = nuke.ask('Render now?')
			
			if rq:
				
				hNode.knob('Render').execute()
			
	
		# Hires folder is not empty
	
		else:
			hList = filter(lambda x: pat.search(x) , hList)
			if hList:
				hFolder = hFPath + str(filesys.padding(max([(int(f)) for f in hList]), 2))
			else:
				hFolder = hFPath + '01'
	
			hNode.knob('file').setValue(hFolder + os.sep + hName)
			
			rq = nuke.ask('Render now?')
	
			if rq:
				
				hNode.knob('Render').execute()