My Nuke defaults - part 2

posted: May 16, 2020, 10:45 p.m.

This article was written for Python 2 (Nuke 12 and lower) for Nuke 13 you will need to do some adaptions as per here: post

Let's continue pimping out Nuke with some custom hotkeys and defaults. I had a whole bunch of this on Google Keep for some time (Google Keep is awesome by the way).

In my last post I talked about defining some custom hotkeys and defaults in Nuke. I thought I would continue with a few more scripts I find really helpful in speeding up my workflow.

More labels!

## labels
nuke.knobDefault('TimeClip.label', '[value first] to [value last]')
nuke.knobDefault('OCIOColorSpace.label', '<i>[value in_colorspace]</i> <b>to</b> <i>[value out_colorspace]')
nuke.knobDefault('Constant.label', '[value width] x [value height]')
nuke.knobDefault('Remove.label', '[value operation]')
nuke.knobDefault('Tracker.label', '[value transform] <br> ref frame: [value reference_frame]')
nuke.knobDefault('VectorDistort.label', 'ref frame [value referenceFrame]')

A few new ones here:

I want to see the reference frame for any kind of tracker, from humble Tracker node all the way to a fancy VectorDistort. Good to know what ColorSpace nodes are doing and what Remove nodes are doing. Constants are a traditional way to define formats for ScanlineRenderers and such and so it's good to have immediate feedback as to what the format actually is in the Node Graph.

nuke.knobDefault('MotionBlur.shutterTime', '0.5')
nuke.knobDefault('MotionBlur.shutterSamples', '10')
nuke.knobDefault('STMap.uv', 'rgb')
nuke.knobDefault('IDistort.uv', 'forward')
nuke.knobDefault('LayerContactSheet.showLayerNames', '1')

So the new defaults are for MotionBlur - the controls for this are greyed out unless you're running NukeX - but you can still change the defaults so when you create one in standard Nuke it's already how you want it.

STMap nodes default to none, which means they do nothing, so I set the default to be useful. Same with IDistort. One less knob to adjust later. LayerContactSheet nodes should show the layer names, that's the whole point.

Hotkeys

#custom hotkeys

unpremultKey=d.addCommand("unpremult", "nuke.createNode('Unpremult')", "U", shortcutContext=2)
premultKey=d.addCommand("premult", "nuke.createNode('Premult')", "Ctrl+U", shortcutContext=2)
channelMergeKey=d.addCommand("channelmerge", "nuke.createNode('ChannelMerge')", "Ctrl+M", shortcutContext=2)

Super obvious, but how many times do we create Premult and Unpremult nodes in a day? Why isn't there a hotkey? Well now there is. People don't use ChannelMerge nodes enough, probably because there isn't a hotkey. Use ChannelMerges instead of Merges to combine alphas - please!

Amazing transform scripts

import merge_transforms_v2
MergeTrasnforms=d.addCommand("python/&Merge Transforms", "merge_transforms_v2.start()", "shift+t", shortcutContext=2)


import animated_cornerpin_to_matrix
d.addCommand('CornerPinToMatrix', 'animated_cornerpin_to_matrix.animatedCP2MTX()', "Ctrl+shift+t", shortcutContext=2, icon='CornerPin.png')

These are two amazing scripts I found. The first is merge_transforms, by Erwan Leroy, collects a bunch of Transform and CornerPin nodes and combines them into a single CornerPin or Transform node. Really handy if you need to inverse the transform later on. You can read all about it on Erwan's website

The second, by Egbert Reichel, turns a CornerPin into a Matrix. This means you can put the data into a Roto, RotoPaint, SplineWarp or GridWarp node. Very very handy, especially if you use Mocha a lot. You can grab this here:

Better node copying

We all copy paste nodes, sometimes it would be great to actually keep the inputs connected to the copy when we paste it right?

This script I made does that.

Once the script is downloaded and saved in your ~/.nuke folder you can call it from your menu.py with:

import Copy_With_Inputs as cwp
d.addCommand("python/&Copy With Input", "cwp.copy_with_inputs()", "Ctrl+C")
d.addCommand("python/&Paste With Input", "cwp.paste_with_inputs()", "Alt+V")

This overwrites the standard Ctrl+C hotkey so that if the nodes has inputs they get saved. When using Ctrl+V they are pasted as normal, but Alt+V will past them with all their inputs even if they have oodles of them (like a Scene node with lots of geo)

And that's it at the moment. You can leave you own favourites in the comments below.

If you find this useful please share.

Cheers,

Daniel

modified March 23, 2021, 10:55 p.m.