Using Eclipse with Nuke
Setting up the Eclipse editor to work as your NUKE IDE
This tutorial will outline the steps to be taken to make Eclipse your Nuke IDE. Though the Nuke script editor has been improved recently, it's still worth looking for alternatives. Eclipse adds lots of extra features like auto completion, syntax checking or source exploration to make daily tasks easier to accomplish. Right now there is only one disadvantage: You would always have to copy/paste the code from eclipse to the Nuke script editor or constantly restart nuke to reload your python module (to help with that use Andreas Frickingers Call Updated Function script).
These are the steps to quickly setup Eclipse to be used with Nuke. If you need a more extensive and complete guide see the official Eclipse documentation: http://pydev.org/manual_101_root.html
1) Setting up Python
Get and install python for your platform (www.python.org)
2) Setting up Eclipse
Go to http://www.eclipse.org and download the Eclipse Classic package. Extract the package and when started go to the update manager (Help > Install New Software), click add and provide http://pydev.org/updates as a site location. Tick the PyDev item and follow the Eclipse steps to install the software.
After installing Eclipse, you have to configure your Python interpreter: window > preferences > pydev > Interpreter – Python. Select the interpreter you just installed (find the python.exe). You will never use this interpreter for nuke, because Nuke uses it own, but Eclipse requires you to specify one.
If you don't have the PYTHONPATH already set up for your environment, you can now add paths that will be in your SYSTEM PYTHONPATH. In the preferences window you can add a new folder to your Libraries section. In our case this would be the path where you keep all your nuke python modules.
3) Setting up code completion
Nuke's python definitions are not accessible from outside the Nuke script editor. Therefor we have to help ourselves with a dummy module. The dummy contains all definitions of nodes and functions Nuke is capable of, so Eclipse can parse the module and provide the completions.
Because the available nuke functions are of course subject to change this module would be very cumbersome to maintain. So we use a script to generate the nuke.py dummy module.
Get the nukePyDummy script, and open it in your favorite text editor. Edit the variable MODULE_DIR to point to a path you want the dummy module to be placed. Use a directory in your PYTHONPATH, preferably the path you just added in step 3. Start Nuke, copy and paste the contents of the script to your nuke script editor and execute it. If you did not get any error, navigate to the directory where the nuke.py was created and have a look at it – you should see class and function definitions. Restart Eclipse.
5) A first project
Now that all is configured, let's create our first test project. In the menu, go to: file > new > project > Pydev > Pydev project. Provide a name and the interpreter you want to use (in case you have more than one set up)
6) A first module
On the left side in the Package Explorer expand your project and right click the src folder. Select new > pydev module, fill in the module name and finish. Now type:
import nuke nuke.
When typing nuke. the auto completion popup should show. If not press control + space to force it to come up. If it is still not working, check if your generated nuke.py is placed in the PYTHONPATH. If everything fails you can always just copy the nuke.py to your current projects working folder, so it will always be found.
TIPP: You do not have to use the nuke.py with Eclipse, in fact every editor who is capable of code completion can use the module. Eclipse is just the editor I like.