Bernard Engine · Doc

Expressions and paths

Bernard does not store a file path as is: it stores an expression, a text in which some parts are replaced by values from Bernard. The same file can thus have the right path on a Windows workstation, a Linux workstation or a remote server.

This page explains the expression language, the Path Edit tool that lets you check and fix them, and path variations by operating system and by site. To create a file and manage its versions, see File management.

What an expression is

An expression is ordinary text in which some parts are written between < and >. Bernard replaces each of these parts with a value.

File paths are expressions. Any text property that the administrator has marked Is Interpreted is one too (see Root Settings).

Example, for the file of a shot:

D:\prod\<Parent.Name>\<Name>

If the shot is called sh010 and its parent SEQ010, the resulting path is D:\prod\SEQ010\sh010.

A path is built step by step: the expression of a file can quote a file of the parent, whose expression in turn quotes a file of the grandparent, from the project folder down to the file.

The names used between < and > are not case-sensitive: <Name> and <name> are identical.

The syntax

To get Write Example Gives
a property of the object <Property> <Name> sh010
a property of a parent <Parent.Property> <Parent.Name> SEQ010
an element of a list, by its rank <List[n]> <Files[0]> the first file of the list
an element of a list, by its name <List[name]> <Files[env_bg]> the file named "env_bg"
a text in upper or lower case .upper() or .lower() <Name.upper()> SH010
a part of a text <Property[start:end]> <Envelope[0:3]>, with the value "letter" let
the file version, with zeros <self.version[##]> current version 5 05
an image sequence <Start Frame:End Frame[###]> frames 1 to 100 one number per frame, on 3 digits
a calculation +, - <1 + 5> 6
a repetition <for x in List [body]> <for f in Files [<f.Name>;]> plate;env_bg;
an environment variable of the workstation <env.NAME> or <ENV.NAME> <ENV.PROD_ROOT>\<Name> D:\prod\sh010
a particular object <root>, <item>, <compound>, <children>, <user>, <computer>, <datetime>, <id> <compound> the compound of the task

A few details:

A complete example

A "Model" file of a shot, whose current version is 5. Its expression, on Windows:

<Parent.Files[0]>\Model_v<self.version[##]>.obj

<Parent.Files[0]> is the first file of the parent (here, the shot's folder). Depending on the path variation and the version, Bernard gives:

Case Resulting path
Local variation, current version P:\demo\SH0010\Model_v05.obj
Local variation, version 2 requested P:\demo\SH0010\Model_v02.obj
a network share variation \\nas01\demo\SH0010\Model_v05.obj

(The drive and share names are made up.)

Error messages

When an expression cannot be interpreted, Bernard displays a message between asterisks in place of the value, and Path Edit underlines the offending name in red.

Message Cause What to do
* Error: '…' not found on … * the property or name does not exist on the object fix the spelling, or add the property to the object
* Variable (…) is not set in your environment * the environment variable does not exist on this workstation define it on the workstation, then restart Bernard
* Error: Unable to interpret '…' * the expression is malformed check the < and > and the square brackets
* Recursion Error: '…' * a property quotes itself remove the circular reference
* Error: Only one value expected from list for '…' * a list is used without choosing an element add [n], or [name]
* Error: '…' not found in the list for '…' * the name quoted between square brackets is not in the list fix the name
* Error: Context Node Not Found (possibly deleted) * the starting object was deleted restore the object, or fix the expression

The expression editor

When you edit an expression (in an interpreted property, in Path Edit or in the Paths Variation tab), the editor:

Expression editor: coloring, unknown name underlined in red

Path Edit

What it is for: checking and fixing the paths of all the files of a selection. For a given variation and system, the view shows the expression of each file and the path it gives.

Where to open it: Windows › Path Edit, then select an item (or a folder, or a project).

Path Edit view: expressions, resulting paths and interpretation errors

What you can do

An example of use: the project's disk changes letter, from D: to P:. Tick the files concerned, search for D:\prod with Ctrl+H, replace with P:\prod, check the preview with Show the replacements, then click Replace all.

What can get in the way: changing the paths of a variation requires the Can modify file paths for specific Path Variations permission (see Roles Setting).

Path variations by system and by site

The same file does not have the same path everywhere: on a studio Windows workstation, on a Linux workstation, on a network share, at a vendor. Bernard resolves this with path variations.

How it works

  1. Variations are studio categories. Local exists by default. The administrator adds others: a shared storage, another site, an SFTP server (the variation then carries the Is SFTP box).
  2. Each file carries one expression per variation and per system: Windows, Linux, macOS.
  3. Each workstation has its current variation, Current Path Variation, Local by default. Its system is detected automatically.
  4. Bernard chooses the expression of the workstation's variation and system, interprets it and keeps the result in memory.
  5. Copies go from one variation to another: downloading copies to the workstation's variation, uploading copies from it (see File management).

If the expression is missing, Bernard does not stop:

Where to see and set them

An example: an office workstation and a remote workstation

The studio has two variations, Local and NAS. A file has two expressions:

Variation Windows Linux
Local P:\demo\<Parent.Name>\<Name> /mnt/demo/<Parent.Name>/<Name>
NAS \\nas01\demo\<Parent.Name>\<Name> /nas/demo/<Parent.Name>/<Name>

An artist on Windows, whose current variation is Local, opens P:\demo\SEQ010\sh010. When they download the file from the remote server, Bernard copies it to that path. A Linux workstation that also uses the Local variation gets /mnt/demo/SEQ010/sh010.

(The paths and share names are made up.)

What can get in the way: changing the paths of a variation requires the Can modify file paths for specific Path Variations permission.

Going further