Package nukescripts :: Package pyQtExamples :: Module flipbookingExample
[hide private]
[frames] | no frames]

Source Code for Module nukescripts.pyQtExamples.flipbookingExample

 1  # Copyright (c) 2010 The Foundry Visionmongers Ltd.  All Rights Reserved. 
 2  import platform 
 3  import sys 
 4  import os.path 
 5  import re 
 6  import thread 
 7  import nuke 
 8  import subprocess 
 9  import nukescripts 
10  import nukescripts.flipbooking as flipbooking 
11   
12  ################################################################################ 
13  # README 
14  #  
15  # This is an example script that demonstrated how to subimplement for RV.  
16  # You need to modify this to get it to work! 
17  # 
18  # To include this in nuke please add this to somewhere in the python search path 
19  # and add the following line to __init__.py (or menu.py): 
20  # from rv import * 
21  ################################################################################ 
22   
23 -class ExampleRVFlipbook(flipbooking.FlipbookApplication):
24 """This is an example implementation of how to deal with implementing a 25 flipbook application other than FrameCycler for Nuke. This script needs 26 to be modified in several places before it can work, so please read all 27 of the notes marked with TODO and modify them where necessary."""
28 - def __init__(self):
29 # TODO: Please put your own path in here or add RV path discovery. 30 self._rvPath = "/Applications/RV64.app/Contents/MacOS/RV64"
31
32 - def name(self):
33 return "RV"
34
35 - def path(self):
36 return self._rvPath
37
38 - def cacheDir(self):
39 return os.environ["NUKE_TEMP_DIR"]
40
41 - def run(self, filename, frameRanges, views, options):
42 # TODO: You probably want more involved handling of frame ranges! 43 sequence_interval = str(frameRanges.minFrame())+"-"+str(frameRanges.maxFrame()) 44 45 os.path.normpath(filename) 46 47 args = [] 48 if nuke.env['WIN32']: 49 args.append( "\"" + self.path() + "\"" ) 50 filename = filename.replace("/", "\\") 51 filename = "\"" + filename + "\"" 52 else: 53 args.append( self.path() ) 54 55 56 roi = options.get("roi", None) 57 if roi != None and not (roi["x"] == 0.0 and roi["y"] == 0.0 and roi["w"] == 0.0 and roi["h"] == 0.0): 58 args.append("-c "+str(int(roi["x"]))) 59 args.append(str(int(roi["y"]))) 60 args.append(str(int(roi["w"]))) 61 args.append(str(int(roi["h"]))) 62 63 lut = options.get("lut", "") 64 if lut == "linear-sRGB": 65 args.append("-sRGB") 66 elif lut == "linear-rec709": 67 args.append('-rec709') 68 69 if frameRanges.increment() == 1: 70 args.append(filename) 71 args.append(sequence_interval) 72 73 #print args 74 os.spawnv(os.P_NOWAITO, self.path(), args)
75
76 - def capabilities(self):
77 return { 78 'proxyScale': False, 79 'crop': True, 80 'canPreLaunch': False, 81 'supportsArbitraryChannels': True, 82 'maximumViews' : 2, 83 # TODO: This list is compiled from running rv with the following: 84 # RV64 -formats | grep 'format "' | awk '{print $2}' | tr '[:space:]' ','; echo 85 # This may differ for your platform! 86 'fileTypes' : ["j2k","jpt","jp2","dpx","cin","cineon","jpeg","jpg","rla","rpf","yuv","exr","openexr","sxr","tif","tiff","sm","tex","tx","tdl","shd","targa","tga","tpic","rgbe","hdr","iff","png","z","zfile","sgi","bw","rgb","rgba","*mraysubfile*","movieproc","stdinfb","aiff","aif","aifc","wav","snd","au","mov","avi","mp4","m4v","dv"] 87 88 }
89 90 flipbooking.register(ExampleRVFlipbook()) 91