nfx_logo
Home About Downloads Tutorials

Tutorial: Custom plugin paths

This tutorial will describe how to create a init.tcl file which will add user specified directories which Nuke will use for plugin or tcl source directories.

Using multiple versions of Nuke or a custom work environment may require seperate source directories for gizmos, tcl script and plugins.

Commands:

The two tcl commands you can add to an init.tcl that will add a plugin directory path are.


1: plugin_addpath

2: plugin_appendpath


plugin_addpath:


This will add the path to the beginning of Nukes plugin paths.


plugin_appendpath:


This will add the path to the end of Nukes plugin paths.


What is the difference?


The difference is if you use plugin_addpath then your preferences.nk and window_layouts.nk file will be saved into this directory since it will be the first directory listed under plugin_path.


Example 1:

This example will demonstrate having a directory used to store plugins, this plugin directory contains sub-directories one for each version of Nuke. Depending on which version of Nuke is running it will only add the corresponding plugin directory for its version.

# Add plugin directory path(s) for user binary plugins.
# Set paths based on the version of Nuke being launched.
switch [set nuke_version] {
    "4.6000" {plugin_appendpath "/home/nrgy/.nuke/plugins/NFX/4.6"}
    "4.7100" {plugin_appendpath "/home/nrgy/.nuke/plugins/NFX/4.7v1"}
    "4.7200" {plugin_appendpath "/home/nrgy/.nuke/plugins/NFX/4.7v2"}
    "4.7300" {plugin_appendpath "/home/nrgy/.nuke/plugins/NFX/4.7v3"}
}

You could even get more creative and have the path being added search for environmental variables, my personal init.tcl file replaces the above code with.

# Add plugin directory path(s) for user binary plugins.
# Set paths based on the version of Nuke being launched.
switch [set nuke_version] {
    "4.6000" {plugin_appendpath "[set env(HOME)]/.nuke/plugins/NFX/4.6"}
    "4.7100" {plugin_appendpath "[set env(HOME)]/.nuke/plugins/NFX/4.7v1"}
    "4.7200" {plugin_appendpath "[set env(HOME)]/.nuke/plugins/NFX/4.7v2"}
    "4.7300" {plugin_appendpath "[set env(HOME)]/.nuke/plugins/NFX/4.7v3"}
}

It grabs the environmental variable $HOME and then uses that as part of the path.


Example 2:

This last example is my init.tcl file, it will append my NFXPlugins directories to the plugin_path as well as add 2 other directories one which contains gizmos and the other tcl scripts.

# Add plugin directory path(s) for user binary plugins.
# Set paths based on the version of Nuke being launched.
switch [set nuke_version] {
    "4.6000" {plugin_appendpath "[set env(HOME)]/.nuke/plugins/NFX/4.6"}
    "4.7100" {plugin_appendpath "[set env(HOME)]/.nuke/plugins/NFX/4.7v1"}
    "4.7200" {plugin_appendpath "[set env(HOME)]/.nuke/plugins/NFX/4.7v2"}
    "4.7300" {plugin_appendpath "[set env(HOME)]/.nuke/plugins/NFX/4.7v3"}
}
# Add test plugin directory path(s) for binary plugins.
plugin_appendpath "[set env(HOME)]/.nuke/plugins/test"

# Add gizmo directory path(s) for user gizmos.
plugin_appendpath "[set env(HOME)]/.nuke/gizmos"

# Add tcl directory path(s) for user tcl scripts.
plugin_appendpath "[set env(HOME)]/.nuke/tcl"

© 2007 NFXPlugins All rights reserved - Nuke is a trademark of The Foundry Visionmongers Ltd.