Environment Setup

Running Scripts During Startup

To run Python scripts in Hiero, you can always use the Script Editor (as described in the User Guide). But if you want to have scripts loaded and running when Hiero starts up, read on.

On startup, Hiero scans various directories for Python scripts that customise the behaviour of Hiero. These scripts can be downloaded from online resources and placed in specific locations on disk depending on the platform running Hiero.

If you’re familiar with Python scripting, you can place custom startup scripts into Hiero’s site-packages directory, though bear in mind that you should take care as mistakes can produce performance and other issues. The site-packages directory for Hiero is located here:

Mac OS X

/Applications/Hiero1.5v1/Hiero1.5v1.app/Contents/Plugins/site-packages/hiero/

Linux

/usr/local/Hiero1.5v1/Plugins/site-packages/hiero/

Windows

C:\\Program Files\\The Foundry\\Hiero1.5v1\\plugins\\site-packages\\hiero\\

At startup, Hiero searches <path>/Python/Startup and <path>/Python/StartupUI for any Python .py modules or packages containing __init__.py files.

The <path> varies by platform and includes as follows:

Mac OS X:

/Applications/Hiero1.5v1/Hiero1.5v1.app/Contents/Plugins
~/Library/Application Support/TheFoundry/Hiero
~/.hiero

Linux:

/usr/local/Hiero1.5v1/Plugins
~/.hiero

Windows:

C:\\Program Files\\The Foundry\\Hiero1.5v1\\Plugins
~\\AppData\\Roaming\\The Foundry\\Hiero
~\\.hiero

Note

~\ indicates the User home directory.

You can specify any number of user-defined paths using the environment variable HIERO_PLUGIN_PATH, separating them with : just like the standard unix PATH environment variable and Nuke’s NUKE_PATH. See Adding plug-in locations for more information.

Scanning is done in two passes — all the Startup folders are searched first and then all the StartupUI folders.

Each package or module discovered is imported and added to the built-in package hiero.plugins.

Note

Python startup scripts are imported in alphabetical order so you can force ordering if necessary.

Preset Projects

Hiero also searches <path>/StartupProjects for preset projects saved as .hrox files. These preset projects are read only and can contain objects that you intend to use across all projects, such as custom Tags.

To remove a startup project, either:

  • Remove it from the <path>/StartupProjects directory, or
  • Rename the file extension so Hiero doesn’t recognise it on startup. For example, myStartup.hrox_hidden.

To modify a startup project:

  1. Load the project using File > Open.
  2. Make any required edits and save over the original in the same location.

Now the edited project loads at startup.

Adding Plug-in Locations

You can guide Hiero to directories containing scripts at startup using the HIERO_PLUGIN_PATH environment variable. For full of details of how to set environment variables on Mac, Linux and Windows, please refer to the Hiero User Guide ‘Hiero Environment Variables’ section.

Manipulating the Plug-in Path from Scripts

Listing Plug-in Paths

To see the current paths that Hiero searches when loading plug-ins, run the following in the Script Editor:

import hiero.core

hiero.core.pluginPath()

Adding Plug-in Paths

To append a path (if it exists) to the list of plug-in paths search by Hiero, use the following Python code:

import hiero.core

hiero.core.addPluginPath(path)

To insert a path (if it exists) into the list of plug-in paths, use the following Python code:

import hiero.core

hiero.core.addPluginPath(path, index)

Note

If index < 0 or out of bounds, the path is appended to the list.

Environment Info from Scripts

The hiero.core.env object contains information about the currently running Hiero executable, such as the major/minor version, the release number, etc. Run the following in Hiero’s Script Editor to see this information:

from hiero.core import *

print env
print env["VersionDate"]
print env["VersionMajor"]
print env["VersionMinor"]
print env["VersionString"]