コード例 #1
0
def getShotNotes():
    '''Gets the current frame range from Shotgun and pushes the data to nuke.
    Requires that you have certain parameters set (see below for variables)
    THese parameters are pretty standard in Shotgun but you can customize below.
    '''

    sg = shotgunUtils.genericUtils()
    scriptName = nuke.root()['name'].value()
    
    print 'foo'
    
    if scriptName == '' :
        nuke.message ('You need to save this first!')
    else:
        projectText = scriptName.split('/')[2]
        shotText = scriptName.split('/')[5]
        project = sg.project(projectText)
        shot = sg.shot(project, shotText)
        
    
        curNotes = sg.notesFindLatest(shot)
        noteDate = datetime.datetime.date(curNotes['created_at']).isoformat()
        noteContent = '<div>Subject : %s\nDate : %s\n%s\nContent: \n\n%s</div>' % (curNotes['subject'], noteDate, '-'*30, curNotes['content'])
    
        nodeNote = nuke.toNode('ShotgunNotes')
        if nodeNote == None:
            nodeNote = nuke.nodes.StickyNote(name='ShotgunNotes')
        nodeNote['label'].setValue(noteContent)
コード例 #2
0
def createVersion(versionName,
                  filePath,
                  firstFrame,
                  lastFrame,
                  jpgPath='',
                  qtPath='',
                  versionStatus=''):
    sg = shotgunUtils.genericUtils()
    project = sg.project(filePath.split('/')[2])
    shot = sg.shot(project, filePath.split('/')[5])
    #thumbFrame = (firstFrame+lastFrame)/2
    try:
        versionData = sg.versionCreate(project,
                                       shot,
                                       versionName,
                                       'For Client Review (' +
                                       versionStatus.upper() + ')',
                                       jpgPath,
                                       firstFrame,
                                       lastFrame,
                                       task='Comp',
                                       makeThumb=True,
                                       makeThumbShot=True)
        sg.sg.upload('Version', versionData['id'], qtPath, 'sg_uploaded_movie')
        sg.sg.upload('Shot', shot['id'], qtPath, 'sg_uploaded_movie')
        return versionData
    except IOError as e:
        print "I/O error({0}): {1}".format(e.errno, e.strerror)
コード例 #3
0
def syncFrameRangeWithShotgun():
    '''Gets the current frame range from Shotgun and pushes the data to nuke.
    Requires that you have certain parameters set (see below for variables)
    THese parameters are pretty standard in Shotgun but you can customize below.
    '''

    inFrame = 'sg_cut_in'
    outFrame = 'sg_cut_out'
    
    sg = shotgunUtils.genericUtils()
    scriptName = nuke.root()['name'].value()
    if scriptName == '' :
        nuke.message ('You need to save this first!')
    else:
        projectText = scriptName.split('/')[2]
        shotText = scriptName.split('/')[5]
        project = sg.project(projectText)
        shot = sg.shot(project, shotText)
        
        errorMessage = []
        if inFrame not in shot:
            errorMessage.append('%s is not present in your Shotgun config' % inFrame) 
        if outFrame not in shot:
            errorMessage.append('%s is not present in your Shotgun config' % outFrame)
        if len(errorMessage) > 0:
            errors = ''
            for message in errorMessage:
                errors = '%s%s\n' % (errors, message)
            nuke.message (errors)
        else:
            nuke.root()['first_frame'].setValue(shot[inFrame])
            nuke.root()['last_frame'].setValue(shot[outFrame])
            
            nuke.message ('Set in and out frames to %s and %s' % (shot[inFrame], shot[outFrame]))
コード例 #4
0
def getVersions(playlist):
    sg = shotgunUtils.genericUtils()
    versionPaths = []    
    for item in playlist['versions']:
        versionData = sg.versionFind(item['id'])
        #print versionData
        versionPaths.append({'file' : versionData['sg_path_to_frames'], 'range' : versionData['sg_last_frame'] - versionData['sg_first_frame'] + 1})
    return versionPaths
コード例 #5
0
def getPlaylist(projectName, playlistName):
    sg = shotgunUtils.genericUtils()
    project = sg.project(projectName)
    if project == '':
        raise Exception('Project name %s not found.' % (projectName))
    playlist = sg.playlistFind(project, playlistName)
    if playlist == '':
        raise Exception('Playlist %s not found.' % (playlistName))
    retValue = {'project': project, 'playlist': playlist}
    return playlist
コード例 #6
0
def getPlaylist (projectName, playlistName):
    sg = shotgunUtils.genericUtils()
    project = sg.project(projectName)
    if project == '':
        raise Exception ('Project name %s not found.' % (projectName))
    playlist = sg.playlistFind(project, playlistName)
    if playlist == '':
            raise Exception ('Playlist %s not found.' % (playlistName))
    retValue = {'project' : project, 'playlist': playlist}
    return playlist
コード例 #7
0
ファイル: processClientOutput.py プロジェクト: AntiCG/vfxpipe
def createVersion(versionName, filePath, firstFrame, lastFrame, jpgPath='', qtPath='', versionStatus = ''):
    sg = shotgunUtils.genericUtils()
    project = sg.project(filePath.split('/')[2])
    shot = sg.shot(project, filePath.split('/')[5])
    #thumbFrame = (firstFrame+lastFrame)/2
    try:
        versionData = sg.versionCreate(project, shot, versionName, 'For Client Review (' + versionStatus.upper() + ')', jpgPath, firstFrame, lastFrame, task='Comp',makeThumb=True,makeThumbShot=True)
        sg.sg.upload('Version',versionData['id'],qtPath,'sg_uploaded_movie')
        sg.sg.upload('Shot',shot['id'],qtPath,'sg_uploaded_movie')
        return versionData
    except IOError as e:
        print "I/O error({0}): {1}".format(e.errno, e.strerror)
コード例 #8
0
def getVersions(playlist):
    sg = shotgunUtils.genericUtils()
    versionPaths = []
    for item in playlist['versions']:
        versionData = sg.versionFind(item['id'])
        #print versionData
        versionPaths.append({
            'file':
            versionData['sg_path_to_frames'],
            'range':
            versionData['sg_last_frame'] - versionData['sg_first_frame'] + 1
        })
    return versionPaths
コード例 #9
0
ファイル: sendToPlaybackRV.py プロジェクト: AntiCG/vfxpipe
def sendData():
    try:
        n = nuke.selectedNode()
    except :
        awNodes = nuke.allNodes('AutoWriter')
        n = awNodes[0]
        if len(awNodes) > 1 : 
            nuke.message('Error :\nYou have more than one AutoWrite.  Please select one.')
            return
    
    if n.Class() == 'AutoWriter':
        with n:
            nodes = nuke.allNodes('Write')
        for curNode in nodes:
            if 'exr' in nuke.filename(curNode).lower():
                exrPath = nuke.filename(curNode)
            if 'jpeg' in nuke.filename(curNode).lower() and '2048x1080' in nuke.filename(curNode).lower():
                outputFile = nuke.filename(curNode)
                frameFirst = int(nuke.root()['first_frame'].value())
                frameLast = int(nuke.root()['last_frame'].value())
                if os.path.exists(fxpipe.framePadReplace(outputFile, frameLast)) == False: 
                    nuke.message('Error : this output does not exist')
                    return
                #frameFirst = int(nuke.root()['first_frame'].getValue())-1
                #frameLast = int(nuke.root()['last_frame'].getValue())
                progressTask = nuke.ProgressTask("Sending to Review Room")
                progressTask.setMessage("Pushing file to Playback Machine")
                progressTask.setProgress(0)                
                fh = open('//svenplay/cache/%s.rv' % (os.path.basename(outputFile).split('.')[0]), 'w')
                fh.write('GTOa (3)\n\n')
                fh.write('sourceGroup0_source : RVFileSource(1)\n{\n media \n {\nstring movie = "%s" \n}\n}' % (outputFile))
                fh.close()
                progressTask.setProgress(50)
                #progressTask.setMessage('Pushing Shotgun Version')
                sgu = shotgunUtils.genericUtils()
                project = sgu.project(fxpipe.showName(outputFile))
                shot = sgu.shot(project,fxpipe.shotName(outputFile))
                try:
                    vData = sgu.versionCreate(project, shot, fxpipe.shotName(outputFile) + '_' + fxpipe.versionNumber(outputFile), 'Sent for Review', outputFile, frameFirst, frameLast,  task='Comp', makeThumb=True,)
                except:
                    vData = None
                progressTask.setProgress(100)
                
                if vData:
                    nuke.message('Created Version: %s' % vData['code'])
                else:
                    nuke.message('Error Creating Version')
    
    
    else:
        nuke.message ('You have not selected an AutoWrite node')
コード例 #10
0
def syncFrameRangeWithShotgun():
    '''Gets the current frame range from Shotgun and pushes the data to nuke.
    Requires that you have certain parameters set (see below for variables)
    THese parameters are pretty standard in Shotgun but you can customize below.
    '''

    inFrame = 'sg_cut_in'
    outFrame = 'sg_cut_out'

    sg = shotgunUtils.genericUtils()
    scriptName = nuke.root()['name'].value()
    if scriptName == '':
        nuke.message('You need to save this first!')
    else:
        projectText = scriptName.split('/')[2]
        shotText = scriptName.split('/')[5]
        project = sg.project(projectText)
        shot = sg.shot(project, shotText)

        errorMessage = []
        if inFrame not in shot:
            errorMessage.append('%s is not present in your Shotgun config' %
                                inFrame)
        if outFrame not in shot:
            errorMessage.append('%s is not present in your Shotgun config' %
                                outFrame)
        if len(errorMessage) > 0:
            errors = ''
            for message in errorMessage:
                errors = '%s%s\n' % (errors, message)
            nuke.message(errors)
        else:
            nuke.root()['first_frame'].setValue(shot[inFrame])
            nuke.root()['last_frame'].setValue(shot[outFrame])

            nuke.message('Set in and out frames to %s and %s' %
                         (shot[inFrame], shot[outFrame]))
コード例 #11
0
def sendData():
    try:
        n = nuke.selectedNode()
    except:
        awNodes = nuke.allNodes('AutoWriter')
        n = awNodes[0]
        if len(awNodes) > 1:
            nuke.message(
                'Error :\nYou have more than one AutoWrite.  Please select one.'
            )
            return

    if n.Class() == 'AutoWriter':
        with n:
            nodes = nuke.allNodes('Write')
        for curNode in nodes:
            if 'exr' in nuke.filename(curNode).lower():
                exrPath = nuke.filename(curNode)
            if 'jpeg' in nuke.filename(curNode).lower(
            ) and '2048x1080' in nuke.filename(curNode).lower():
                outputFile = nuke.filename(curNode)
                frameFirst = int(nuke.root()['first_frame'].value())
                frameLast = int(nuke.root()['last_frame'].value())
                if os.path.exists(fxpipe.framePadReplace(
                        outputFile, frameLast)) == False:
                    nuke.message('Error : this output does not exist')
                    return
                #frameFirst = int(nuke.root()['first_frame'].getValue())-1
                #frameLast = int(nuke.root()['last_frame'].getValue())
                progressTask = nuke.ProgressTask("Sending to Review Room")
                progressTask.setMessage("Pushing file to Playback Machine")
                progressTask.setProgress(0)
                fh = open(
                    '//svenplay/cache/%s.rv' %
                    (os.path.basename(outputFile).split('.')[0]), 'w')
                fh.write('GTOa (3)\n\n')
                fh.write(
                    'sourceGroup0_source : RVFileSource(1)\n{\n media \n {\nstring movie = "%s" \n}\n}'
                    % (outputFile))
                fh.close()
                progressTask.setProgress(50)
                #progressTask.setMessage('Pushing Shotgun Version')
                sgu = shotgunUtils.genericUtils()
                project = sgu.project(fxpipe.showName(outputFile))
                shot = sgu.shot(project, fxpipe.shotName(outputFile))
                try:
                    vData = sgu.versionCreate(
                        project,
                        shot,
                        fxpipe.shotName(outputFile) + '_' +
                        fxpipe.versionNumber(outputFile),
                        'Sent for Review',
                        outputFile,
                        frameFirst,
                        frameLast,
                        task='Comp',
                        makeThumb=True,
                    )
                except:
                    vData = None
                progressTask.setProgress(100)

                if vData:
                    nuke.message('Created Version: %s' % vData['code'])
                else:
                    nuke.message('Error Creating Version')

    else:
        nuke.message('You have not selected an AutoWrite node')