.. _intro-building:

Building & Installing Plug-ins
==============================

See :ref:`appendixa-index` for information on building plug-ins on your platform.

Once built, your plug-in binary (a shared library with the appropriate .dylib/.so/.dll extension depending on your platform) will need to be placed in a path where NUKE scans for plug-ins on startup. On all platforms this'll be either your ~/.nuke (ie <user home directory>/.nuke/, where the dot prefix may mean it is hidden by default in your file browser), or somewhere in your NUKE_PATH which defaults to:

* OSX 64bit: /Library/Application Support/NUKE/x.x/plugins/
* Linux 64bit: /usr/local/NUKE/x.x/plugins/
* Windows 64bit: C:\Program Files\Common Files\NUKE\x.x\plugins\

Where <x.x> is the major.minor version of the NUKE in question. Conveniently, NUKE_PATH can be added to by setting an environment variable of the same name. This is often of use when building and testing plug-ins, because you can set an environment variable pointing at your build directory and then fire up NUKE to try it out.

It is recommended when packaging up NDK plug-ins for distribution that you use the NUKE_PATH directories, and install your bundle in an appropriately named subdirectory (since the default path is searched single level recursively).

There are a number of ways to add a plug-in to your current session:

* Hit x to bring up the script command and type in the name of the plug-in and hit enter. If the plug-in is found in the various paths searched for the plug-in, an instance is added to the Node Graph. This is generally of most use when first setting up plug-ins. If this fails, you may want to try the script command 'load <my plug-in name>' which tests that the plug-in can be found and that dynamic loading works. The common reasons why this might not work is that the DD::Image:::Op::Description is incorrect, or that the plug-in has been built against a different version of the NDK than that supported by the version of NUKE you're trying to load it into.
* Go to the Other->All plug-ins menu and hit update, or hit tab and type update-enter. Both of these add the full list of found plug-ins to the menu (and thus tab selector), allowing them to be added by the usual means. Again, this is generally of most use when first setting up plug-ins.
* You can add your own menu entry to the default toolbar by adding a menu.py file to the NUKE_PATH and following the guidelines laid out in the Python Reference Guide. This is recommended for packaging up plug-ins for distribution as it allows easy discovery of your tools. Additionally, any pre-requisite Python elements can be initialised in menu or init.py, including the usual icons and so on.
