Skip to main content

YAML

The YAML file describes how an action behaves in Anchorpoint, registers it and can control Python scripts or command line applications. Each action needs a YAML file. The YAML file is declaratively described with a key - value pair.

action:   name: "Convert Video to mp4"    version: 1  id: "ap::ffmpegConvertVideo"  category: "examples/ffmpeg"  type: command  author: "Anchorpoint Software GmbH"  description: "Creates an mp4 from an avi"
  command: "${yamlDir}/ffmpeg.exe"   arguments: "-i ${path} ${root}/03_Export/Videos/yamlExample.mp4"
  register:    file:       filter: "*.avi*"
  toast:    success:      message: "Video successfully created."    error:      message: "Error when creating video."

This example uses FFmpeg to convert an avi file into an mp4 video.

Basic Keys#

Advanced Keys#

Variables#

Basic Keys#

See the following list to learn about the basic keys that can be used to define your action.

name#

Provides the name that shows up in Anchorpoint e.g. in the context menu

action:  #This will appear in the UI  name: "Convert Video to mp4"

default: N/A

id#

A unique identifier. It is generally a good idea to provide a "namespace" for your action so that there is a lower chance to clash with Actions provided by other users.

action:  id: "ap::ffmpegConvertVideo"

default: N/A

version#

A number that is used to identify the version of your action - very useful if you have to keep around multiple versions of the same action.

action:  version: 1

default: 1

category#

You can categories your action so that it appears grouped in the Anchorpoint UI.

action:  category: "examples/ffmpeg"

default: "general"

type#

What type of action, either "command" or "python".

default: N/A

Command#

The path to the executable of a command line application like FFmpeg (e.g. ffmpeg.exe) if the action is of type "command"

default: N/A

Arguments#

The variables to be passed to the command line application. In this example, instead of an absolute path, we take the ${path} variable, which returns us the file we selected in Anchorpoint.
We also use the ${root} variable, which gives us the path of the project.But this also means that this action can only be called in a project that contains a "03_Export/Videos" folder.

action:  type: command  command: "${yamlDir}/ffmpeg.exe"   arguments: "-i ${path} ${root}/03_Export/Videos/yamlExample.mp4"

default: N/A

Scripts#

The path to the Python script if the action is of type "python". It expects a Python 3.7 script.

action:  type: python  script: "${yamlDir}/substanceToTextures.py"

default: N/A

author#

Who created this action.

action:  author: "Anchorpoint Software GmbH"

default: N/A

description#

What does your action do?.

action:  author: "Create a video from all files that are sharing the same suffix"

default: N/A

Advanced Keys#

This section handles more advanced YAML keys that can be used to specify how you action functions exactly.

inputs#

A list of inputs for your action that can be defined in YAML and read in Python. Here it is worthwhile to store parameters, such as paths or certain settings, so that the Python script is not constantly modified.

inputs:       URL: "anchorpoint.app"      target: ${root}/03_Export/Videos

default: N/A

register#

Specify where your action should be registered within Anchorpoint. Currently actions can be registered to the file and folder context menu. Use the filter wildcard key to only register the action if the filter matches. Separate multiple filters with a semicolon. When dealing with folders you can set files: true to execute the action not on the folder but on all files of the folder. By doing so you can set a separate fileFilter as well. Set recursive: true to execute the action on all folder children as well.

register:     file:           filter: "*.png;*.exr" #Wildcard matching      folder:          filter: "*/assets/*"            files: true #Execute one action per file and not per folder. Defines the value of ${path} and ${relPath}            fileFilter: "*.blend" #Only valid if files: true          recursive: true #Execute recursively on files and folders

default: N/A

toast#

With the toast key you can control whether or not Anchorpoint shows a toast message on success or error. By default, Anchorpoint will show a generic success and error toast message.

toast:      success:          enable: false      error:          message: "Could not export file, please check your file system"

default: N/A

Variables#

Within the YAML file you can access predefined and environment variables as well as defined inputs easily with the ${var} syntax.

inputs:       blenderPath: "${BLENDER_DIR}/Blender.exe" #environment variable BLENDER_DIRcommand: ${blenderPath}arguments: --scene ${path} #access the predefined path variable

path#

The absolute path to the file or folder.

inputs:       URL: "anchorpoint.app"      target: ${path}/ExportedFiles

relPath#

Path to the file or folder relative to the active project.

root#

The project root folder.

inputs:       URL: "anchorpoint.app"      target: ${root}/03_Export/Videos

yamlDir#

The directory containing this YAML file.

action:       script: "${yamlDir}/sbsToTextures.py"

folder#

The active folder where you executed that action.

filename#

The active filename without the path and without the suffix.

suffix#

The suffix of the file, e.g. PNG.