![]() If you’ve been through the python tutorials on Codecademy or others, you know that python can store pretty much anything into a variable. To manipulate our node, it would be nice to store it into a variable. It will do nothing else, letting you handle the connecting, placing, etc… ![]() “()” on the other hand, will only create the node. It will create a node, and connect it to the currently selected node if one is selected, apply your custom default settings if you have some, place it in the node graph, and a few other “convenient” things. “nuke.createNode(‘XXX’)” is the Function called when you create a node using the user interface. The first thing to do when we want to manipulate Nuke objects is to let Python know we’re using a function of the Nuke module. There are two ways to create a Node via python: nuke.createNode('Blur') () You can create it the normal way, or via Python. In the official getting started documentation, they show us how to easily create and access nodes, but let’s make our own example. Let’s look at a few useful things to do: Accessing and Modifying nodes: You ran your first code in Nuke, you can be proud, but that’s not so useful by itself. The script editor itself has two windows, an input part at the bottom, that’s where you write your code, and an output part on top, which will return the result from your code.Īnd run it by pressing the “run” button or Ctrl+Enter Right-click on the “tabs” area in the user interface and select the script editor. Luckily, the Foundry already wrote that document, and you can find it here: Well, there are many things you can do in Nuke with Python, and covering all of it would take me a lot of time. If anyone has recommendations, please post in the comments or email me!) Cool, I can write some Python now, but how do I use it in Nuke? ![]() I haven’t needed to re-learn python from scratch so I’m not really up to date on the best courses. (Edit 2021: Codecademy still offers the Python 2 course for free, but charges for the Python 3 one. Of course, if finish the whole course that wouldn’t hurt. No need to complete the whole course, but I would recommend going at least until the “Loops” chapter. ![]() My favourite part is that you don’t need to install anything, you can code and run your code directly in the browser. I believe one of the easiest and less boring ways to learn python is to use the website Codecademy: Ĭodecademy is teaching Python 2.7.3, which is the same Nuke is using. (Edit 2021: Python 3 is now the standard) Reads: Python 2 VS Python 3, VFX Platform The VFX Platform, a list of tools published by the Visual Effects Society, lists Python 2.7.x as the reference for 2015, so that’s what we’ll be looking at. Python 3 also exists, but it is not at the moment a standard for VFX. While there are many ways to get started, with books, tutorials or diving right in with Nuke, I would recommend learning the basic Python Syntax first.Īt the moment, Nuke and many other VFX applications are using a version of Python 2. (What’s wrong with this code?) How do I get started? That’s a pretty beginner-level code, it’s far from being perfect but would do the job much faster than you would manually. Or you could have opened the script editor and typed:įile = file.replace('awesomeNkueProject','awesomeNukeProject') You don’t know anything about python, so you proceed to rage against your producer and painfully re-link your read nodes one by one. Maybe you should have used a relative file path, but you didn’t. You open your nuke script, and none of the 87 read nodes can find the media. This morning, a producer realized there was a typo in the folder name and decided to fix it. Still, I would recommend learning the very basics, as it could save you a lot of time in some occasions.Ī bit of coding knowledge won’t make you a better artist, it will just make you a more efficient one.Įxample Scenario: You’ve been working for a week on the “Awesome Nuke Project”, which was located in the folder “/projects/awesomeNkueProject/” It is true you don’t need to know anything about coding to be a VFX artist, you can become a top-notch artist on high-end projects without ever writing a line of code. I decided to compile and write down a summary of the many different advises I have about it. The code examples will be updated to be compatible with both Python 2 and 3, and I’ll be putting a few notes in parenthesis throughout the article.)įellow compositor and VFX students often approached me wondering how and why to learn Python. (Edited 2021: Starting with Nuke 13, and VFXplatform 2020, Python 3 is now the standard! This article has been edited to reflect that new standard while trying to keep the original content from 2015.
0 Comments
Leave a Reply. |