/ Published in: Python
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
# Run RV as flipbook
#
# Based on: framecycler_this.py, ships with Nuke
#Copyright (c) 2007 The Foundry Visionmongers Ltd. All Rights Reserved.
import platform
import sys
import os.path
import re
import thread
import nuke
import nukescripts
rv_path=""
if rv_path == "":
try:
rv_path = os.environ["RV_PATH"]
except:
if platform.system() in ('Windows', 'Microsoft'):
rv_path = "C:\\Program Files\\Tweak\\RV-3.5\\bin\\rv.exe"
elif platform.system() in ('Darwin', 'Apple'):
rv_path = "/Applications/RV.app/Contents/MacOS/RV"
else:
rv_path = "rv"
#def rv_this(node, arg = 0):
def rv_this(node,start,end,incr, views=''):
global rv_path
if not os.access(rv_path, os.X_OK):
raise RuntimeError("RV cannot be executed (%s)." % (rv_path,) )
filename = nuke.filename(node)
filenameL = ''
filenameR = ''
node = nuke.selectedNode()
if '%v' in filename :
if 'left' in views:
filenameL = filename.replace ('%v','l')
if 'right' in views:
filenameR = filename.replace ('%v','r')
filename = '%s %s' % (filenameL, filenameR)
if '%V' in filename :
if 'left' in views:
filenameL = filename.replace ('%V','left')
if 'right' in views:
filenameR = filename.replace ('%V','right')
filename = '%s %s' % (filenameL, filenameR)
if filename is None or filename == "":
raise RuntimeError("RV cannot be executed on '%s', expected to find a filename and there was none." % (node.fullName(),) )
sequence_interval = str(start)+"-"+str(end)
os.path.normpath(filename)
args = []
rv_path = os.path.normpath(rv_path)
padding = re.search('%[0-9]+d',filename).group()
try:
padding
except:
raise RuntimeError ('Issue with the padding...please check into it')
filename = filename.replace(padding,sequence_interval + '#')
if platform.system() in ('Windows', 'Microsoft'):
args.append( "\"" + rv_path + "\"" )
args.append( "[ " + filename + " ]" )
else:
args.append( rv_path )
args.append(filename)
#args.append(sequence_interval)
#args.append( "-ns" ) # Nuke sequence format
# un-comment to apply gamma to linear EXRs
#args.append("-gamma")
#args.append("2.2")
#args.append("-play") # play on launch
args.append("-c") # region cache
os.spawnv(os.P_NOWAITO, rv_path, args)
Comments
 Subscribe to comments
                    Subscribe to comments
                
                