Managing Katana projects in Multi-Platform Environments

When sharing Katana projects across different machines, it is sometimes necessary to adjust the format of file paths for different operating systems or to account for different folder structures.

To make a Katana project portable across multiple platforms, file paths should be set up so they are relative and not dependent on a system-specific folder structure. There are three ways to do this:

Using parameter expressions

Using an environment variable

Relative file paths without using an expression

Using Parameter Expressions

Relative file paths can be set up by using parameter expressions. For example, right-click on a filename parameter, choose 'Expression' as the Value Mode and enter an expression:

project.dir + '/textures/testFile.png'

project.dir will then be resolved to the directory of the Katana project file. This is also valid:

path.join(project.dir, ‘/textures/testFile.png’)

Tip:  See the Katana Developer Guide for more information on Python expressions.

Using an Environment Variable

Alternatively, you can set an environment variable to point to the system specific root folder. To evaluate the variable in your parameter, there are two options:

Use a parameter expression. E.g.:

getenv("OS_PATH", tmpDir) + '/example/file/path'

Some nodes like Alembic_In also support the use of environment variables in a constant value for a file path parameter. E.g.:

${OS_PATH}/example/file/path

Note:  This is not supported for every node type, in this case please use the first option of evaluating the environment variable via an expression.

Using a Relative File Path Without Using an Expression

Another option is to make use of relative file paths without using an expression. In this case you should specify your file paths relative to the project directory, e.g. textures/testFile.png

You should then change the working directory for the environment you are launching Katana in.

If you are launching Katana from the command line or use a bash or batch script, use the cd command to set the current directory to the root directory of your relative file paths. If you are using a Python script to launch Katana, set the root using the Python os.chdir command similar to the following:

os.chdir(home + '/' + '/admin/katana_projects/' + example_project)

Article:  For more information on how to set up a launcher script:
Q100242: Creating a Katana launcher script for Windows
Q100272: Creating a Katana launcher script for Linux