Get Shots Helper

Convenient way to get the shots from a Sequence, including its thumbnail.

Updated: 17 April 2013

Author: ant

Compatible Nuke versions: 7.0 or later

Compatibility: Linux, Mac, Windows

getShotsHelper.py

This gets you a list of Shot objects from a Sequence as Python Dictionaries, with original TrackItem, shot name, source file path and a QImage of the Shot Thumbnail.

It can be used as the preparation stage of uploading thumbnails, shots, etc. to your Shotgun/FTrack/Asset management database for instance.

Usage:
------------------------------
myShots = getShotsFromSequence( mySequence ), where mySequence is a hiero.core.Sequence object
myShots = getShotsFromSequenceInCurrentViewer() - gets shots from the Sequence currently in the Viewer
Get the name of the first shot: myShots[0]['shotName']
Get the source file path used in the first shot: myShots[0]['sourceFile']

If you want to interrogate the Shot's in/out points etc, get the TrackItem object via: myShot[trackItem]

Notes on Saving out thumbnails
------------------------------
This code does not save any image files for you as it stands, but it stores images as QImages, which can later be saved/manipulated.
If you want to save the QImage to disk from a shot dictionary, myShot, do: myShot['shotThumb'].save('/tmp/some/path.png')
For more on QImage, check out: http://qt-project.org/doc/qt-4.8/qimage.html, in particular, save()
If you need more control over the output of your images, check out the QImageWriter Docs.
QImageWrite Docs: https://deptinfo-ensip.univ-poitiers.fr/ENS/pyside-docs/PySide/QtGui/QImageWriter.html

Sign in or register to download or rate.