New portfolio, please access: raularantes.com

This is a research blog for my MA in Visual Effects @ Ravensbourne, UK.

Python scripting in Nuke I

In order to get more familiar with Python scripting in Nuke, I’ve decided to start from the very beggining. I knew there were some videos from The Foundry Youtube channel but I’ve never bothered in watching them. Actually they’ve seemed to be more useful than I initially thought and I quite liked the start. It’s still all very basic, but it gave me a good idea of the syntax and the way I can interact with some nodes and the interface. It also contributes to a better overall understanding of the tool itself.

I’m listing here some basic scripts as a sort of quick memory note/snippet.

// settin defaults;
nuke.knobDefault ("Bezier.output", "alpha");
nuke.knobDefault ("EXPTool.mode", "Stops");
nuke.knobDefault ("EXPTool.label", "[value mode]");

http://www.youtube.com/watch?v=noBHt7p22Q4

// command help;
help(nuke.addFormat);

// add new format;
nuke.addFormat("2000 1000 LatLong_2K");

// var + setting default format;
latlong = "2000 1000 Latlong";
nuke.knobDefault ("Root.format", latlong); 

http://www.youtube.com/watch?v=E7xysAdYpY0

// redefine/change tools
help(nuke.menu);
toolbar = nuke.menu("Nodes");
toolbar.addCommand ("Transform/Reformat", "nuke.createNode('Reformat')", "ctrl+r");

http://www.youtube.com/watch?v=3-gR3ZpWTdw

// menu.py saved to the ".nuke" folder
// inside the "root" folder --> executed everytime Nuke is initialised.
usersToolbar = nuke.toolbar("Users");
myMenu = usersToolbar.addMenu ("Frank", "calvin.png");
myMenu.addCommand ("Keyer.LumaKeyer", "nuke.createNode('LumaKeyer')", "alt+F");

http://www.youtube.com/watch?v=sTwpPWAnJ28

nuke.createNode ("Merge");
nuke.createNode ("Merge", "operation stencil");

 

- Posted by rrraul on 01/07/2013 | Nuke |