# YAML Reference#

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 key - value pairs.

action:
name: "Convert Video to mp4"
version: 1
id: "ap::ffmpeg::avitomp4"
category: "examples/ffmpeg"
type: command
author: "Anchorpoint Software GmbH"
description: "Creates an mp4 from an avi"

command: "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#

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"


### 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"


### 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”, “python”, or “package”.

### command#

The path to the executable of a command line application like FFmpeg (e.g. ffmpeg.exe) if the action is of type “command”. The path can be absolute or relative to the yaml file.

### 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: "ffmpeg.exe"
arguments: "-i ${path}${root}/03_Export/Videos/yamlExample.mp4"


### script#

The path to the Python script if the action is of type “python”. It expects a Python 3.9 script. The path can be absolute or relative to the yaml file.

action:
type: python
script: "save_as_template.py"


### author#

Who created this action.

action:
author: "Anchorpoint Software GmbH"


### description#

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


### details#

A detailed description of your action. Currently this is only used for packages. The content supports basic HTML.

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


### register#

Specify where your action should be registered within Anchorpoint. Actions can be registered for the:

• file and folder context menu

• for the new file, folder, and drive buttons

• the left sidebar in the browser. Use the filter wildcard key to only register the action if the filter matches. Separate multiple filters with a semicolon.

register:
file:
filter: "*.png;*.exr" #Wildcard matching
folder:
filter: "*/assets/*"
new_file:
enable: true
new_folder:
filter: "*/shots/*"
drive:
enable: true
new_drive:
enable: true
sidebar:
enable: true


This section handles more advanced YAML keys that can be used to specify how your 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 you don’t have to modify your python script.

inputs:
URL: "anchorpoint.app"
target: ${root}/03_Export/Videos  You can also show basic prompts to ask the user for input. See more examples here. inputs: URL: message: "What website do you like the most?" default: "anchorpoint.app"  ### platforms# By default, actions are supported on all platforms. With the platforms key you can explicitly list the supported platforms: platforms: - win - mac  ### python_packages# Anchorpoint ships with it’s own Python interpreter to not depend on local installations. Hence, Anchorpoint is not using the locally installed python packages. Installing your own python packages for your actions is simple. Just specify your required packages in the action or packge YAML and Anchorpoint will install them, if needed. python_packages: - pillow - opencv-python  ### 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 no message at all. In python you can fire up toasts directly. toast: success: enable: false error: message: "Could not export file, please check your file system"  ## Variables# Within the YAML file you can access predefined and environment variables as well as defined inputs easily with the${var} syntax.

inputs:
blender_path: "${BLENDER_DIR}/blender.exe" #environment variable BLENDER_DIR command:${blender_path}


### relative_path#

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

### project_path#

The project root folder.

inputs:
URL: "anchorpoint.app"


### 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.