RenderSwitch

This is switch that changes inputs depending on if the Nuke script is rendering or not. The logic is based off the $gui and nuke.exectute() functions. I originally made this to help manage heavy DOF/Vector nodes in my own comps, but after becoming a supervisor, and dealing with a bunch of “Broken scripts” that turned out to just be forgotten $gui expressions, I decide to share it with my teams


How To Use

Step 1: Connect the 0 input to the heavy node you want to only use at render

Step 2: Connect the 1 input to a lighter version of the node, or nothing

Step 3: Send to render, and the switch will toggle to the 0 input, allowing the heavy node to process

By default the RenderSwitch only runs on the farm, outside of interactive mode. See section below to change this behavior

Other Options

Alternating the inputs

The RenderSwitch can be set to use either input 0 or 1 at render time. The default is set to 0 so that you can disable the node locally to view the heavy processes you want to run on the farm

$gui vs nuke.execute()

The default mode uses $gui, which will only render on the farm, and is very reliable. You can set it to use nuke.exectue() instead, which will work on the farm, and locally, but it’s not as reliable, and you might run into issues where the inputs don’t change when you expect them to. This depends on your nuke version, and what it considers to be an execution command. Using $gui is recommended for pipeline use and older versions of nuke

How It Compares

Adding a $gui expression to any knob is still very useful, but it isn’t great for script readability imo. When I can, I prefer to use a RenderSwitch to divide a pipe into the local and render streams, instead of trying to manipulate the knob values at render time to a high/low quality, on a single node. The other benefit of doing this is faster iteration of knob values, as you don’t need to change the expression every time you want to adjust them

That’s it! I hope it helps, and feel free to reach out if you have any more questions!

Previous
Previous

MagicSwitch

Next
Next

Python Code Snippets