Favorite directories can be accessed by artists with a single click from any Nuke file browser. Typically you would create these favorites for common directories on a project.
To define an common set of favorite directories:
1. | Create a file called menu.py in your plug-in path directory. |
For more information on plug-in path directories, see Loading Gizmos, NDK Plug-ins, and Python and TCL Scripts.
2. | Add an entry in the following format: |
nuke.addFavoriteDir('DisplayName', 'Pathname')
• Replace DisplayName with the string you want as the display name for the directory link, for example ‘Home’ or ‘Desktop’.
• Replace Pathname with the path name to the directory to which the favorite should point.
3. | In the above entry, you can also add the following optional arguments after 'Pathname': |
• type. This is an integer and a bitwise operator, OR a combination of nuke.IMAGE, nuke.SCRIPT or nuke.FONT.
nuke.IMAGE restricts the favorite directory to appear only in the image file browser, which Nuke opens for file Read/Write operations.
nuke.SCRIPT restricts the favorite directory to appear in the script file browser, which appears when you select File > Open or a similar menu selection to open or import script files.
nuke.FONT restricts the favorite directory to appear in the font browser.
• icon='Name'. Replace Name with the name and file extension of the .png (or .xpm) image you wish to use as the icon for the favorite directory. This image must be stored in your Nuke plug-in path directory. It should be 24 x 24 pixels in size.
• tooltip='My tooltip'. Replace My tooltip with the string you wish to display as pop-up help.
The following entry would create a favorite called DisasterFlickStore which appears on all File Browsers invoked from Read nodes and which points to the /job/DisasterFlick/img directory.
nuke.addFavoriteDir ('DisasterFlickStore', '/job/DisasterFlick/img', nuke.IMAGE)
|
The result of example 1. |
The following entry would create a favorite called Test. It appears on all File Browsers invoked from Read nodes or by selecting File > Open and points to the /job/Test directory. The entry also defines Test Images and Scripts as the tool tip for the favorite directory.
nuke.addFavoriteDir ('Test', '/job/Test', nuke.IMAGE | nuke.SCRIPT, tooltip='Test images and Scripts')
|
The result of example 2. |