rv_this with stereo support


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # Run RV as flipbook
  2. #
  3. # Based on: framecycler_this.py, ships with Nuke
  4. #Copyright (c) 2007 The Foundry Visionmongers Ltd. All Rights Reserved.
  5.  
  6. import platform
  7. import sys
  8. import os.path
  9. import re
  10. import thread
  11. import nuke
  12. import nukescripts
  13.  
  14. rv_path=""
  15. if rv_path == "":
  16. try:
  17. rv_path = os.environ["RV_PATH"]
  18. except:
  19. if platform.system() in ('Windows', 'Microsoft'):
  20. rv_path = "C:\\Program Files\\Tweak\\RV-3.5\\bin\\rv.exe"
  21. elif platform.system() in ('Darwin', 'Apple'):
  22. rv_path = "/Applications/RV.app/Contents/MacOS/RV"
  23. else:
  24. rv_path = "rv"
  25.  
  26.  
  27. #def rv_this(node, arg = 0):
  28. def rv_this(node,start,end,incr, views=''):
  29.  
  30. global rv_path
  31.  
  32. if not os.access(rv_path, os.X_OK):
  33. raise RuntimeError("RV cannot be executed (%s)." % (rv_path,) )
  34.  
  35. filename = nuke.filename(node)
  36. filenameL = ''
  37. filenameR = ''
  38.  
  39. node = nuke.selectedNode()
  40.  
  41. if '%v' in filename :
  42. if 'left' in views:
  43. filenameL = filename.replace ('%v','l')
  44. if 'right' in views:
  45. filenameR = filename.replace ('%v','r')
  46. filename = '%s %s' % (filenameL, filenameR)
  47. if '%V' in filename :
  48. if 'left' in views:
  49. filenameL = filename.replace ('%V','left')
  50. if 'right' in views:
  51. filenameR = filename.replace ('%V','right')
  52. filename = '%s %s' % (filenameL, filenameR)
  53.  
  54. if filename is None or filename == "":
  55. raise RuntimeError("RV cannot be executed on '%s', expected to find a filename and there was none." % (node.fullName(),) )
  56.  
  57. sequence_interval = str(start)+"-"+str(end)
  58.  
  59. os.path.normpath(filename)
  60.  
  61.  
  62. args = []
  63. rv_path = os.path.normpath(rv_path)
  64. padding = re.search('%[0-9]+d',filename).group()
  65. try:
  66. padding
  67. except:
  68. raise RuntimeError ('Issue with the padding...please check into it')
  69.  
  70. filename = filename.replace(padding,sequence_interval + '#')
  71.  
  72. if platform.system() in ('Windows', 'Microsoft'):
  73. args.append( "\"" + rv_path + "\"" )
  74. args.append( "[ " + filename + " ]" )
  75. else:
  76. args.append( rv_path )
  77. args.append(filename)
  78.  
  79.  
  80. #args.append(sequence_interval)
  81. #args.append( "-ns" ) # Nuke sequence format
  82.  
  83.  
  84. # un-comment to apply gamma to linear EXRs
  85. #args.append("-gamma")
  86. #args.append("2.2")
  87.  
  88. #args.append("-play") # play on launch
  89. args.append("-c") # region cache
  90.  
  91. os.spawnv(os.P_NOWAITO, rv_path, args)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.