def newFlixPanelFromCurrentViewerImage(nukeStudioViewer=True): print "Adding a new FLIX panel from current Viewer" uniquePath = getFlixTempFolder() + "flix_" + getUniqueString() + "_" lastTempNumber = "1" filePath = uniquePath + lastTempNumber + ".xml" fileRef_out = open(filePath, 'w') dialogue = "I do not believe in fairies" #getDialogue(psdDocument); fileRef_out.write("<flixImport waitForSource='1' multipleSetups='1'>\n") # Depending on the action, we can grab the active Nuke (comp) or NukeStudio Viewer image if nukeStudioViewer: currentImage = currentViewer().image() tempFilePath = uniquePath + lastTempNumber + "_.FLIXTEMP.png" currentImage.save(tempFilePath) else: # It's the Nuke Comp image vn = nuke.activeViewer().node() frame = vn['frame'].value() tempFilePath = uniquePath + lastTempNumber + "_.FLIXTEMP.png" vn['file'].setValue(tempFilePath) nuke.execute(vn, frame, frame) fileRef_out.write("<image originalFile='" + getActiveDocumentFilename() + "' dialogue='I do not believe in Fairies' imageFile='" + tempFilePath + "'/>\n") fileRef_out.write("</flixImport>\n") fileRef_out.close() sendFileToFlix(filePath)
def newFlixPanelFromCurrentViewerImage(nukeStudioViewer = True): print "Adding a new FLIX panel from current Viewer" uniquePath = getFlixTempFolder()+"flix_"+getUniqueString()+"_" lastTempNumber = "1" filePath = uniquePath+lastTempNumber+".xml"; fileRef_out = open(filePath, 'w'); dialogue = "I do not believe in fairies" #getDialogue(psdDocument); fileRef_out.write("<flixImport waitForSource='1' multipleSetups='1'>\n"); # Depending on the action, we can grab the active Nuke (comp) or NukeStudio Viewer image if nukeStudioViewer: currentImage = currentViewer().image() tempFilePath = uniquePath+lastTempNumber+"_.FLIXTEMP.png" currentImage.save(tempFilePath) else: # It's the Nuke Comp image vn = nuke.activeViewer().node() frame = vn['frame'].value() tempFilePath = uniquePath+lastTempNumber+"_.FLIXTEMP.png" vn['file'].setValue(tempFilePath) nuke.execute(vn, frame, frame) fileRef_out.write("<image originalFile='"+getActiveDocumentFilename()+"' dialogue='I do not believe in Fairies' imageFile='"+tempFilePath+"'/>\n"); fileRef_out.write("</flixImport>\n"); fileRef_out.close() sendFileToFlix(filePath)
def getActiveDocumentFilename(): name = '' try: name = currentViewer().player().sequence().name() name = name.split('\\').join('/') name = re.escape(name) except: name = "ns_viewer" + "_%i" % int(time.time()) return name
def getActiveDocumentFilename(): name = ''; try: name = currentViewer().player().sequence().name() name = name.split('\\').join('/'); name = re.escape(name) except: name = "ns_viewer" + "_%i" % int(time.time()) return name
def setPosterFrameForActiveSequence(self): if not self.currentViewer: self.currentViewer = currentViewer() currentTime = self.currentViewer.time() activeSequence = self.currentViewer.player().sequence() if activeSequence and currentTime: activeSequence.setPosterFrame(int(currentTime)) self.currentViewer = None
def replaceFlixPanelFromCurrentViewerImage(nukeStudioViewer = True): print "Replacing current FLIX panel from current Viewer image" uniquePath = getFlixTempFolder()+"flix_"+getUniqueString()+"_" lastTempNumber = "1" filePath = uniquePath+lastTempNumber+".xml"; fileRef_out = open(filePath, 'w'); dialogue = "I do not believe in fairies" #getDialogue(psdDocument); fileRef_out.write("<flixImport waitForSource='1' multipleSetups='1' replaceSelection='1'>\n"); currentImage = currentViewer().image() tempFilePath = uniquePath+lastTempNumber+"_.FLIXTEMP.png" currentImage.save(tempFilePath) fileRef_out.write("<image originalFile='"+getActiveDocumentFilename()+"' dialogue='[FLIX_CURRENT_DIALOGUE]' imageFile='"+tempFilePath+"'/>\n"); fileRef_out.write("</flixImport>\n"); fileRef_out.close() sendFileToFlix(filePath)
def getFrameSourceFromCurrentViewer(): # Current Viewer and Player cv = hi.currentViewer() cp = cv.player() # Current Sequence seq = cp.sequence().binItem().activeItem() # Current time of the Player T = cp.time() # Current TrackItem of the trackItem = seq.trackItemAt(T) d = T - trackItem.timelineIn() frame = trackItem.sourceIn() + d # Source Clip fileIn = trackItem.source().mediaSource().firstpath() # Now we have to calculate the Source frame of the TrackItem return fileIn, frame
def getFrameSourceFromCurrentViewer(): # Current Viewer and Player cv = hi.currentViewer() cp = cv.player() # Current Sequence seq = cp.sequence().binItem().activeItem() # Current time of the Player T = cp.time() # Current TrackItem of the trackItem = seq.trackItemAt(T) d = T-trackItem.timelineIn() frame = trackItem.sourceIn()+d # Source Clip fileIn = trackItem.source().mediaSource().firstpath() # Now we have to calculate the Source frame of the TrackItem return fileIn, frame
def replaceFlixPanelFromCurrentViewerImage(nukeStudioViewer=True): print "Replacing current FLIX panel from current Viewer image" uniquePath = getFlixTempFolder() + "flix_" + getUniqueString() + "_" lastTempNumber = "1" filePath = uniquePath + lastTempNumber + ".xml" fileRef_out = open(filePath, 'w') dialogue = "I do not believe in fairies" #getDialogue(psdDocument); fileRef_out.write( "<flixImport waitForSource='1' multipleSetups='1' replaceSelection='1'>\n" ) currentImage = currentViewer().image() tempFilePath = uniquePath + lastTempNumber + "_.FLIXTEMP.png" currentImage.save(tempFilePath) fileRef_out.write("<image originalFile='" + getActiveDocumentFilename() + "' dialogue='[FLIX_CURRENT_DIALOGUE]' imageFile='" + tempFilePath + "'/>\n") fileRef_out.write("</flixImport>\n") fileRef_out.close() sendFileToFlix(filePath)