Create a ticket
Follow

Q100401: Creating a Shelf Item in Katana

SUMMARY

Shelf Item Scripts are Python scripts contained in Shelf Items grouped under Shelves, which run from Katana's UI.

Shelves can be incredibly useful, they allow users to create tools which will save time by launching Python operations either from the Shelf, or via custom keyboard shortcut.

Shelf Item Scripts can use Katana's APIs, like the NodegraphAPI, to access various parts of Katana that can be queried or modified.

This article will further explain the Shelf tool, as well as provide a short tutorial on setting up your first Shelf Item.

If you have already setup your first Shelf Item and would like tips to update or remove it, please see this article: Q100402: Editing and removing Shelf Items in Katana

 

MORE INFORMATION

Shelf Items are collated into pop-up UIs named Shelf Actions (cog ShelveCog.PNG 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

        shelves_main_menu_453x177.png

  • Shelf location specifically for the Scene Graph tab

        shelves_scenegraph_453x209.png

  • Widgets toolbar within nodes, which is available via the Parameters tab

        shelves_parameters_tab_453x330.png

To learn more about types of Shelves and setting up Shelf Item Scripts to specific locations, please check our Katana online help for more information: Katana Online Help - Shelf Item Scripts

  

Creating your first Shelf Item script

When setting up your first Shelf Item Script there are a number of steps involved, but they are intuitive to follow.

1. To start, open Katana and select the Shelf Action(cog ShelveCog.PNG icon) on the main toolbar. 

2. 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.

3. Go back to the Shelf Action cog icon, select your newly created Shelf and add you 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:

        CreateItem.PNG

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 here: Katana Online Help - Keyboard Shortcuts

4. After initialising the creation, a text document will open with your Shelf Item Python script file.

        firstShelf.PNG 

This will print 'hello, world' to your Katana terminal window by default.

NOTE: Using NodegraphAPI commands you can add additional functionality for your Python script.

5. Run the Shelf Item Script either from the main Shelf Action, 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

If you would like to improve your Shelf Item by adding custom Python functions and editing the docstring to include custom icons, keyboard shortcuts etc, please see this article: Q100402: Editing and removing Shelf Items in Katana

If you would like to see an example of another Shelf Item script which is used to rename input/output ports, please see this article: Q100372: Renaming input and output ports with Python

Was this article helpful?
/

We're sorry to hear that!

Please tell us why.
0 out of 0 found this helpful

Comments