Posted By

donaldstrubler on 11/16/10


Tagged

python nuke


Versions (?)

pxTrackerToSyntheyes


 / Published in: Python
 

URL: donaldstrubler.com

Right click menu to send Nuke trackers to Syntheyes.

  1. import nuke
  2. def TrackerToSyntheyes():
  3.  
  4.  
  5. filenameSearch = 'choose your path'
  6. singleLine1 = '1920'
  7. singleLine2 = '1080'
  8. rangeLine = '1,100'
  9. prefix = 'nuke_'
  10.  
  11. p = nuke.Panel('Tracker to Syntheyes')
  12. p.addFilenameSearch(" Filename:", filenameSearch)
  13. p.addSingleLineInput("Width", singleLine1)
  14. p.addSingleLineInput("Height", singleLine2)
  15. p.addSingleLineInput("Range", rangeLine)
  16. p.addSingleLineInput("Prefix", prefix)
  17.  
  18. result = p.show()
  19.  
  20. filenameVal= p.value(" Filename:")
  21. width = float(p.value("Width"))
  22. height = float(p.value("Height"))
  23. rangeVal = p.value("Range")
  24. rangeValFirst = int(rangeVal.split(',')[0])
  25. rangeValLast = int(rangeVal.split(',')[1])
  26. prefix2 = p.value("Prefix")
  27.  
  28. print filenameVal
  29.  
  30.  
  31.  
  32.  
  33. tracker = nuke.selectedNode()['name'].value() + ' '
  34. f = open(filenameVal, 'w')
  35. f.write
  36. for j in nuke.selectedNodes():
  37. tracker = j['name'].value() + ' '
  38.  
  39.  
  40. for i in range(rangeValFirst,rangeValLast):
  41. i = i+1
  42. nuke.frame(i)
  43.  
  44. x = str(((nuke.selectedNode()['track1'].getValueAt(i)[0]/width)*2)-1) + ' '
  45.  
  46. y = str(((((nuke.selectedNode()['track1'].getValueAt(i)[1]/height)*2)-1)*(-1))) + ' '
  47. #tr = nuke.selectedNode()['track1'].getValueAt(i)
  48. ls = []
  49. sent = prefix + tracker + str(i) + ' ' + x + y + '7' + '\n'
  50. f.write(sent)
  51. print sent
  52.  
  53. f.close()
  54.  
  55. #TrackerToSyntheyes()
  56.  
  57.  
  58. #menu
  59. #m = nuke.menu('Animation')
  60. #m.addCommand('File/Export to Syntheyes', "pxTrackerToSyntheyes.TrackerToSyntheyes()")

Report this snippet  

You need to login to post a comment.