One of my favorite aspects of nuke is how easily customizable the interface and user experience is. Having only a minuscule amount of programming knowledge in Python can allow you to tailor nuke in fluid way that fits your personal compositing style. The ability to assign custom hotkeys for specific nodes or operations, adding custom menus for tools, and altering the default properties of nodes have helped save me time as well as keep my node graph more readable. The key ingredient to flavoring Nuke to your heart’s content is editing the menu.py file found in your .nuke folder. Foundry’s online learning database for python is an excellent resource to turn towards if you’re unfamiliar with what the menu.py and the .nuke folder and are looking for a way to get the ball rolling.
menu.py and init.py files
Customizing the UI with menu.py
Recently, I registered for Ben McEwan’s Python for Nuke 101 course and quickly learned some simple snippets of python code that have helped me speed up my compositing workflow. I’d highly recommend this course for anyone who’s new to python and integrating it within nuke. The second lesson from the course was focused on adding shortcuts, menus, and default parameters to nodes for nuke and I’d like to share with you some of my new additions to my menu.py after completing this module. These are primarily shortcuts that I’ve thought up recently and they’ve already made an impact in my compositing workflow. You’ll notice that many of the hotkey changes save only a few keystrokes, but in my experience being able to get the information I need in a shorter time, greatly improves my mental flow when compositing. Saving 2 or 3 clicks here and there may not sound like much but the few seconds it takes to open a menu and find the option or value that you’re looking for can add up through the workweek. The more time you save now, the more time you’ll have for getting started on that next shot, learning something new, or drinking beers at the end of the day.
I first learned of the IBK stacked technique from the Compositing Mentor blog at compositingmentor.com. I’m not going to go into meticulous detail on how this works under hood so check out the Compositing Mentor’s blog for more information. In short, stacking IBKColour nodes will likely lead you to a better result than just using a single IBKColour node. This method works by first creating a “main IBKColour” in which the user sets the screen size to a low value (1) and fiddles with the darks, lights, and erode until the subject is covered with black. Then, the user duplicates the main IBKColour, sets the erode to 0 and patch black to 1. The user continues to duplicate the main IBKColour and setting an erode value of 0 and patch black that increases exponentially with each copy (1, 2, 4, 8 etc.)
I was working on a commercial spot that involved heavy amounts of keying with multiple keying setups and found that the process of copy/pasting the IBKColour nodes and adjusting their values was prone to human error and was super time inefficient. So, I challenged myself to create a python script that would automate the stacking process and speed up my work when keying using IBK.
The video below shows how increasing the stack size creates new IBKColour nodes with exponentially increasing patch black values while also keeping the values of other knobs the same. In this example, there are 5 nodes in the stack (IBK01 through 05) with IBK00 being the “main IBKColour”.
The next video shows how the IBKStacker_IS tool creates the same outcome as the large stack of IBKColour nodes. Overall, using this tool can save a few seconds of time when keying but those few extra seconds can add up when you have lots of keying to do or when experimenting with different methods or values.
Add these lines of code to your menu.py file, located in your .nuke folder.