.. _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. NUKE_PATH 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. NUKE_PATH can be added to most conveniently by setting an environment variable of the same name. This is often of use when building and testing plug-ins as you can set an environment variable pointing and 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 recursive).

To add a plug-in to your current session you can use a number of means:

* 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 it'll add an instance to the DAG. 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'll test that the plug-in can be found and 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.
* Equally, you can either go to the Other->All plug-ins menu and hit update, or hit tab and type update-enter. Both of these will add the full list of found plug-ins to the menu (and thus tab selector), allowing them to be added by 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, and the usual trappings of icons and so forth included.
