Nuke python scripts

Click 
here to download all Nuke tools (including setup).

Click here to view change log (updates).

sb AutoRender

This script creates a custom Write node that automatically sets the file path before rendering. The result will help to keep a clean folder structure and a consequent naming convention.

Most settings are customizable, either by editing the default settings in the menu.py, or by saving a ToolSet with your preferred settings. The node does not interfere with the standard Write node.

In order for the script to work correctly, you must specify a root folder (base path). There are a few different ways to specify the root folder: search word, environment variables, custom path. See the help button for more information.

Quick tip: In the settings tab there's a "debugging" checkbox. If checked, Nuke will show a message with the render path but not start the actual render. Useful when testing different settings.



sb ConvertFootage

This script speeds up the process of converting footage to a different format/resolution/color space/naming convention. To use the script, select one or several Read nodes, specify your settings and hit render.

Support for both rendering in UI and setup nodes only. Use the setup nodes only option if you want to submit the render to a render farm.

A simple usage case of this script is to batch convert CG renders (most often Tiled 32bit EXRs) to Scanline 16bit EXRs. Another usage case is when you have a large number of elements shot with a DSLR (for example) and you want to convert the source files to a VFX friendly format.

Click the "?" button for more information.

sb ExportNukeSceneToAE

This script exports the selected 3d objects (Camera, Axis, Card) for use in Adobe After Effects.

To import the data into After Effects, use sb ImportNukeScene.

The script exports the world position of objects, which means that it will work properly with parenting chains (for example a Camera connected to an Axis). You only need to select the final object in the parenting chain.

See the "?" section of the script for more information.



sb BakeWorldPosition

This script will create a stand-alone (baked) version of the selected 3d nodes (Camera, Axis, Light), removing parenting chains.

Thanks to Ivan Busquets on the Nuke Mailing list for many great examples of dealing with world transforms.

Note: There are caveats when baking transforms like this, and it won't work in all cases. For example it won't work with a camera that has both rotation and non uniform scaling, as it will create a skew. See here for more information.

sb SaveRenderBackup

This script saves a copy of the current Nuke-script after a render is complete. It will append a suffix (date+time) to the script name.

It's often useful to have a copy of the script, as it means that you can always recreate renders without having to be afraid to overwrite adjustments.

Note that this will save a copy of the script no matter if the current state is saved or not.



sb CreateRead

This script over-rides the standard create read function. In most cases it will work exactly the same, but with the additional feature that you can choose to use OCIO for color conversions instead of the built in LUTs.

To use OCIO, setup a USE_OCIO environment variable and set the value to "1".

If a color space is found in the filename, the OCIO color space will be set automatically.



sb ConvertTracker

This script converts (4) tracks in a Tracker to a CornerPin, RotoPaint, SplineWarp or GridWarp node.

All output nodes will handle perspective distortion as well as translation/rotation/scale.

Make sure that all tracks are co-planar.

sb ConvertCornerPin

This script converts a CornerPin to a RotoPaint, SplineWarp, GridWarp or Tracker node. It also has the option to output a new CornerPin (match-move & stabilize) with a reference frame tab added.

All output nodes will handle perspective distortion as well as translation/rotation/scale.

This can be useful for example when working with CornerPin data imported from Mocha.

Note that the script only supports animation on the "to" tab of the CornerPin node.


sb ReplacePaths

This script will replace/update the file path of selected nodes.

It works on all node types that has a file knob, e.g. Read nodes.

Useful if footage has been moved to another volume, or when relinking footage on another system.


sb DistributeObjects

This script creates a specified number of new 3d objects, evenly distributed between the selected 3d objects.

If you have more than two objects selected  (to create a curved path), make sure you select the objects in the correct order, as the script will follow the selection path. Preferably this should be in left to right order.

Support for translation/rotation/scale and xyz dimensions.
 



sb DAGPosition

This script works similarly to the Bookmark feature that was introduced in Nuke7.0.

It gives you a simple way to navigate large scripts by saving positions in the DAG, which you can then access quickly by hotkeys.



sb SetKnobValue

This script lets you set a knob value to multiple nodes.

The script works with knobs that takes strings/numbers as its value (most knobs).

Hover the mouse cursor over a knob to see it's name.

If the knob takes more than one value (for example a xy knob), separate your values with a comma, e.g. 100, 200.



sb AddViewerLuts

This script searches a specified folder path and adds found LUTs to the Viewer drop-down menu.

As Nuke works with a linear gamma internally, a pre-LUT is added before applying the main LUT. This pre-LUT converts the footage from linear color space to the input color space of the LUT. Therefore, a strict naming convention must be used.

Supported naming convention: <input_colorspace>2<name of lut>.ext

Examples: log2kodak_2383.csp, logC2arri_alexa.cube, cineon2fuijifilm_3521XD.3dl

Set the folder path in menu.py.


sb autoAddGizmos

This script searches a specified folder path and adds found gizmos to a menu in Nuke.

Set the folder path and menu name/icon in menu.py. Note that the folder path must exist in your Nuke plug-in path.
 

sb RevealInFileBrowser

This scrip reveals the selected Read/Write node(s) in the OS specific file browser.

Note: The script is only tested on Windows but *should* work on all platforms.



sb RandomTimeOffset

This script sets a random offset number (with control of min/max) to the selected Read/TimeClip/TimeOffset nodes.

Useful when you want to randomize footage that is used more than once in your script.



sb CardToCamera

This script creates a card that that matches the camera's field of view.

Works with both static and animated cameras.


sb ListExternalNodes

This script searches the current script and reports gizmos/plugins that does not live in the Nuke install directory.

Useful when sending work to a third party or when archiving scripts.

Note that OFX plug-ins might not get listed.

Based on a sample script posted on the Nuke mailing list by Nathan Rusch.



sb GlobalToolset

This scripts exports the selected nodes as a ToolSet to a specific folder. If the folder is located on a shard volume, named ToolSets, and in the Nuke plug-in path, the ToolSets will show up for other artists as well.

ToolSets are very handy when sharing setups between artist, but in the default implementation all ToolSets are saved at your local .nuke folder, which means you have to copy files around to get them to show up for other artist.

This script is basically the same as going to File/Export Nodes As Script, but with a few additions.


sb MeasureDistance

This script measures the distance between two points in 3d space.

sb Backdrop

This script adds a few extra parameters to the normal backdrop function.

It adds the possibility to set the name and font size directly, saving you the time of having to change them every time you create a backdrop.

It will also create backdrops from a given set of colors, which are darker and less saturated than the normal backdrop function.


sb OnOff          

This script adds a multiplier node to each selected node, which will turn on/off the opacity at a given frame-range.

sb DeleteViewers

This script deletes all viewer nodes in your script.

If you, like me, are in the bad practice of creating a large amount of new viewer nodes in your script, this is a quick way to delete all viewers and start from scratch.