Give me Python selection - hiero.selectedItems

Easy way to get selected items for use in your Script Editor. Stores them in hiero.selectedItems. Uses Ctrl/Cmd+Alt+C Shortcut.

Updated: 19 November 2013

Author: ant

Compatible Nuke versions: 7.0 or later

Compatibility: Linux, Mac, Windows

Sometimes you just want to get the items in your view, to play with in the Script Editor.

This python, provides an easy way to get selected items for use in your Script Editor. Stores them in hiero.selectedItems. Ctrl/Cmd+Alt+C Shortcut.

By default this will return: Projects, Clips, Sequences, Bins, Tracks, TrackItems

To install, copy to: ~/.hiero/Python/Startup

The example adds a right-click Menu to the Timeline, Spreadsheet and and Bin Views for getting the current Selection.

After running this action, the selection is stored in: hiero.selectedItems , which can be used in the Script Editor.

A keyboard shortcut is also added: Ctrl/Cmd+Alt+C.

Note on activeItem behaviour in BinView

By default in the Bin, the action will return the activeItem, i.e. the Clip or Sequence, rather than the BinItem.

This behaviour can be overridden by changing this line:

kAlwaysReturnActiveItem = True

to: kAlwaysReturnActiveItem = False

or can be set dynamically in the Hiero session Editor via:

hiero.plugins.getPythonSelection.SelectedShotAction.kAlwaysReturnActiveItem = False

 

Sign in or register to download or rate.