Hiero/Nuke Studio to Shotgun API Example

Installation

Installing the Shotgun Python API in a general-purpose Python environment has a few advantages:

  • Functionality can be more easily shared between multiple applications
  • Testing functionality of your code can be easier in a Python environment

To install the Shotgun API:

  1. Open a Command Prompt or Terminal.

  2. Enter the following command to confirm that a stand-alone version of Python 2.7x is installed correctly:

    python
  3. Enter the following to quit Python:

    exit()
  4. Enter the following to install the API:

    pip install git+git://github.com/shotgunsoftware/python-api.git
  5. After the installed completes, enter:

    python
  6. And then inside the interpreter enter:

    import shotgun_api3

If no errors are displayed, the API is installed correctly.

To install the FoundrySG tools:

  1. Create the following directory by OS, if it doesn’t exist:
    • Windows: C:\Users\{username}\.nuke\Python\Startup
    • Mac: /Users/{username}/.nuke/Python/Startup
    • Linux: /home/{username}/.nuke/Python/Startup
  2. Copy the foundrySG.py example into the correct directory by OS.
  3. Open foundrySG.py in a text editor.
  4. Replace sgURL, sgLogin, and sgPassword with your Shotgun credentials.

Note

Make sure the login credentials used have managerial permissions in Shotgun.

When you next start Hiero or Nuke Studio you should see the FoundrySG menu in the top menu bar.

Foundry Shotgun Methods

On startup the Foundry to Shotgun toolset menu is visible as FoundrySG:

_images/foundrysg.png

The following functions are supported:

Set Clips task colors

Takes your selected clips and for each of them matches the department token. See taskListColours() in the foundrySG_Example.py example file. If it finds a match it colors it accordingly.

Publish selected Clips

Publishes selected clips to Shotgun by making a movie of each and checking if the project exists on SG. The example then checks these exist and creates them if necessary:

Sequence Shot Task Version

The movie files are then uploaded against the correct Version.

Pull Clips Statuses from Shotgun

Tries to find the corresponding Shotgun versions to match the local clips. If successful it then pulls the SG shot/task status and applies the corresponding equivalent to each clip.

Push Clips Statuses to Shotgun

Takes the status tags applied to clips on the timeline, tries to find an equivalent for Shotgun and updates the shot/task on SG.

Push Selected Clips to new Shotgun Playlist

Takes your selection of clips, requests a name for a new playlist, then publishes a list of clips as an SG Playlist.

Pull Shotgun Playlist clips to the bottom track

Requests the name of a valid and existing SG Playlist, queries it and attempts to load the corresponding footage playing it in it’s own bin in the Nuke Studio project. It then places the clips in order on the lowest track.

Note

Be sure to have a clear track at the very bottom of the current sequence, otherwise the playlist clips overwrite existing clips.