Nuke-vfxDesktop integration example

I’ve made a little demonstration of what the new run-once.py feature might be useful for. Add the code block below to your menu.py in your user /.nuke/ folder to automatically have your clip imported into vfxDesktop when the render completes.

Don’t forget to edit the copy-line below to have your own path to vfxDesktop. Use forward slashes or double backslashes, ie c:/ or c:\\ due to how strings in Python works.

def importToVfxD():
 import shutil,os
 pyout = os.getenv("HOME") + "\\run-once.py"
 f = open(pyout, "w")
 f.write("import vfxd\n")
 f.write("id = vfxd.importClip(\""+str(nuke.filename(nuke.thisNode())+"\")\n"))
 #f.write("vfxd.playClip(id)\n")
 f.close()
 shutil.copy(pyout, "VFXDESKTOP PATH/run-once.py")

nuke.addAfterRender(importToVfxD)

Control vfxDesktop externally with Python!

Last minute addition! I’ve uploaded yet another version, this one will automatically run a file named “run-once.py” if it exists in the vfxDesktop directory, once run it will be deleted so it only runs once. The script could simply look like this:

import vfxd; vfxd.importClip("foo");

This allows you to generate a script tiny at the end of a render, for example, to automatically import the rendered sequence. This will open up for easy external manipulation of the application.

Paste clips both ways!

So, this is a feature I like in the new version, simple but powerful. Copy a sequence path from Nuke or any program with similar paths, and point at a reel and hit Ctrl+V, this will seek out all the frames associated with the sequence and import that as a clip. You can also import everything within a folder that you paste the same way. The logic is easy, unless there’s a # or a % in the string, treat it as a path, otherwise, as a sequence. It will also detect whether it’s a single frame or a sequence. Another trick you can do is to add asterisks to denote sub-folders, paste a string like: /path/*/*/*/ to import everything 3 folders deep from /path/.

Version update 0.2010-09-21.1

Got a new version for you with a bunch of requested fixes and updates, same beta passwords apply. Go grab it from the Download page!

New/updated features:

  • You can now assign a new time code to a clip, hold space while pointing at a clip and enter the edit menu, click assign new time code. You can do it both by absolute frame and by SMPTE time code. Make sure you have the correct FPS set in prefs.xml. This does not affect the file name but allows conforming material by EDL’s.
  • All buttons are now draggable in the NLE
  • Editing is now executed on mouse release instead of continuously, which makes editing orders of magnitude faster
  • Dragging edit handles uses the player’s full main image to show current / current+next / first+last frame during interaction.
  • Pressing 1-9 in the player now opens the NLE to display that number of steps, f. ex: pressing 2 opens it up with 2 levels of clips, use middle mouse button to pan and zoom.
  • Clip handles are shown numerically as well asĀ  graphically when you hover the mouse over a clip
  • Slipping a clip is no longer confined to the borders of the clip
  • All text boxes now supports the Windows clip buffer for copy and pasting
  • You can also press Ctrl+V to paste a sequence path as a clip into the desktop, for example, select the entire path in a read or write node in Nuke and copy it, then paste in vfxDesktop to get a clip. Both “/path/file.%04d.ext” and “/path/file.####.ext” are supported. This way you can copy-paste back and forth between the apps.
  • Reintroduced Python support for the time being, read more below
  • Entering expressions such as 23+44 gets evaluated through Python when you press Enter/Return, you can also use the math object, for example “math.sin(90)”, if you’d ever want to. There’s currently a problem where the app becomes unstable if you try to evaluate a non-numerical value, still working on finding the cause for that.
  • EXR files are now automatically gamma corrected to 2.2 for preview.
  • Holding Ctrl while clicking a folder prevents jumping to it, instead it simply displays its contents, and visible folder can be viewed like this no matter where you are in the hierarchy.
  • Folder Tree is now saved properly between sessions, and there is support for zooming. LMB+alt or MMB to pan, and MMB+alt to zoom.

Fixed bugs:

  • Pan/zooming the NLE with lmb+Alt lost control outside its boundaries.
  • Percentage sign characters wasn’t displayed correctly and could crash the app, especially in the Console

Available embedded Python commands as demonstrated by this tiny script:

import vfxd

vfxd.logMessage("Hello")
vfxd.clearDesktop()
vfxd.addReel(2)
clip_id = vfxd.importClip("//server/path/myclip.####.tif")
clip_id_2 = vfxd.getClipID("myclip")
vfxd.logMessage("This is the id " + str(clip_id))
vfxd.playClip(clip_id)

This is very much a work in progress, these commands might not work as expected, and many others are needed, but it’s a start. Pressing the P key in the interface currently executes a python script named “run.py” in the same folder as the application. Output from the Python interpreter ends up in the external console, the logMessage() command writes messages into the internal console (press F4 to open it). Please feel free to add thoughts about how you’d like Python to integrate, and what sort of commands would be useful, to the forum!

Return top