Shelf Item Scripts are Python scripts contained in shelf items grouped under Shelves, which can be executed from Katana's UI. Shelves can be incredibly useful as they allow users to create tools that save time by launching Python operations from the shelf or via custom keyboard shortcuts. Shelf Item Scripts can use Katana's APIs, like the NodegraphAPI to access various parts of Katana that can be queried or modified.
Shelf items are collated into pop-up UIs named Shelf Actions (cog
icon). The Shelf Action can be used for more broad functions, or created for the scene graph or specific nodes, as displayed below:
The main Shelf location, available via the main menu toolbar
Shelf location specifically for the Scene Graph tab
Widgets toolbar within nodes, which is available via the Parameters tab
To find out more about the different types of Shelves and how to set up Shelf Item Scripts for specific locations, please refer to the Shelf Item Scripts User Guide.
CREATING A SHELF ITEM SCRIPT
When setting up your first Shelf Item Script, there are several steps involved:
To start, open Katana and select the Shelf Action(cog icon) on the main toolbar.
At the top right of the UI, select 'Add -> New Shelf...', this will create a custom Shelf for your scripts.
Enter the new Shelf name and click OK.
Go back to the Shelf Action cog icon, select your newly created Shelf and add your first shelf item with 'Add -> New Item...' A pop-up window will appear where you can name your shelf item and give it a keyboard shortcut if desired. Then select OK:
NOTE: When setting a keyboard shortcut for your custom shelf item, you won't be able to use a shortcut that already exists in Katana. A warning should be displayed, and the list of Katana default keyboard shortcuts can be found in the Keyboard Shortcuts Resources.
After initializing the creation, a text document will open with your Shelf Item Python Script file. This will print 'hello, world' to your Katana terminal window by default.
NOTE: Using NodegraphAPI commands, you can add additional functionality to your Python script.
Run the Shelf Item Script either from the main ShelfAction, by selecting your new Shelf and clicking on your new shelf item, or by using the keyboard shortcut added earlier.
This will print 'hello, world' to your Katana terminal window.
FURTHER READING
For an overview of Shelves Item Scripts in Katana, please visit the Shelf Item Scripts User Guide.