Sampling deep values

A quick note about sampling deep values in python in nuke.

Today, I was faced with a question that a quick google search could not answer so I thought I'd made a post about it.

How do you sample the values a the deep channel in python?

nuke.sample(node, channel, x, y) doesn't work on deep.

Nuke's help behind what it is, accessing this page took a bit longer than it should have: https://docs.thefoundry.co.uk/nuke/63/pythonreference/nuke.Node-class.html#deepSample

And so, here's how you do it :

node.deepSample(c, x, y, n)

  • c -> deep channel (deep.front, deep.back...) - string
  • x -> position to sample on the x axis - integer
  • y -> position to sample on the y axis - integer
  • n -> index of the sample - integer, -1 for the frontmost