# Automations

{% hint style="success" %}
You need a **Studio** license to use this feature. It is included in v1.1.0 and higher.
{% endhint %}

Automations are user-defined rules that allow you to automatically and instantly edit multiple materials at once.

* Very powerful when combined with [presets](https://help.transmutr.com/manual/presets) and the [Command-Line Interface](https://help.transmutr.com/manual/command-line-interface).
* Useful for single models with a large number of materials.

## General usage

1. To use Automations, you first need to activate them by clicking the *Automations* switch:<img src="https://1807576756-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LbleSCzt45l7QT5OXk4%2F-LnC2_NB0UHyeGFrft0T%2F-LnD8sklpqLk2oHDusvT%2Fautomations_enabled.jpg?alt=media&#x26;token=c4cc506a-a1de-4ae2-81dd-4d5fccd881d8" alt="" data-size="original">&#x20;
2. Then open the Automations interface by clicking on *Edit Automations*: \ <img src="https://1807576756-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LbleSCzt45l7QT5OXk4%2F-LnC2_NB0UHyeGFrft0T%2F-LnD9CgjZRN1tr9_Nxva%2Fautomations_edit.jpg?alt=media&#x26;token=1aebf52d-f6e3-49d7-8ba2-8f9cfac0d015" alt="" data-size="original">
3. Finally, create a first automation by clicking on *"Create an Automation"*.

The interface is split into two columns, **Conditions** and **Actions**.\
When the **conditions** on the left are met, the **actions** on the right are applied.

![](https://1807576756-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LbleSCzt45l7QT5OXk4%2F-LnDpiktGOGp6fKHxQHf%2F-LnDpl5jMBQVqYBi5JkA%2Fautomations_overview.JPG?alt=media\&token=4e9e8d8e-dccb-4169-9b54-310228aea1e3)

Conditions are grouped via two operators: **AND** and **OR**.

All the conditions in an **AND** group must be true for that group to be considered true.\
Several groups can be separated by the **OR** operator. In that case, at least one group must be true for the actions to be applied.

In the following example, we set the Diffuse Color to black in either of the two following cases:

1. If the material type is *Metal*
2. If the material type is *Generic* and the refraction is exactly 1 (like glass):

![](https://1807576756-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LbleSCzt45l7QT5OXk4%2F-LnDq1dP3oJwV8CJO1YY%2F-LnDsjBSZkNRG6D3U_3Q%2Fautomations_and_or.JPG?alt=media\&token=6b089d1d-ac41-43a8-9451-e2f1986d870e)

{% hint style="success" %}
You can add as many automations, conditions and actions as you wish.
{% endhint %}

### Excluding materials from automations

When you activate automations, you'll notice that all the materials in the list become grayed out and that you cannot edit them anymore. That's because their settings are now controlled by the automations.

If needed, you can exclude some of the materials from being affected by the automations and edit them manually. To do so, simply click on the <img src="https://1807576756-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LbleSCzt45l7QT5OXk4%2F-LnHTh_SaCwfkalO850X%2F-LnHeD7IwGITZnPtPNo5%2Fautomations_exclude.JPG?alt=media&#x26;token=7b9a7b4b-e763-452d-8de7-6acf9118e2b5" alt="" data-size="original"> icon next to the material name.

### Variables

You can use variables in text fields (eg. material name and paths) in the form of predefined keywords wrapped in curly braces:

* **`{ModelName}`** is the name of the input file. For instance, if you load a file named *"tree01.fbx"*, the actual value of `{ModelName}` is *"tree01"*. It changes for each model, but is the same for every material.
* **`{MaterialName}`** is the name of the material. It is different for each material.
* **`{SourceFolder}`** is the path of the folder that contains the imported file. For instance, if you load *"C:/library/assets/tree01.fbx"*, the value of `{SourceFolder}` is *"C:/library/assets"*.
* **`{SourceFolderName}`** is the name of the folder that contains the imported file. For instance, if you load *"C:/library/assets/tree01.fbx"*, the value of `{SourceFolderName}` is *"assets"*.
* **`{SourceFolderParent}`** is the path of the parent of the folder that contains the imported file. For instance, if you load *"C:/library/assets/tree01.fbx"*, the value of `{SourceFolderParent}` is *"C:/library"*.
* **`{SourceFolderParentName}`** is the name of the parent of the folder that contains the imported file. For instance, if you load "*C:/library/assets/tree01.fbx"*, the value of `{SourceFolderParentName}` is *"library"*.
* **`{DiffuseMapPath}`** is the path of the diffuse map file.
* **`{DiffuseMapName}`** is the name of the diffuse map file.
* **`{DiffuseMapExt}`** is the extension of the diffuse map file.
* **`{BumpMapPath}`** is the path of the diffuse/normal map file.
* **`{BumpMapName}`** is the name of the bump/normal map file.
* **`{OpacityMapPath}`** is the path of the opacity map file.
* **`{OpacityMapName}`** is the name of the opacity map file.
* **`{ReflectionMapPath}`** is the path of the reflection map file.
* **`{ReflectionMapName}`** is the name of the reflection map file.
* **`{ReflectionGlossinessMapPath}`** is the path of the reflection glossiness map file.
* **`{ReflectionGlossinessMapName}`** is the name of the reflection glossiness map file.
* **`{RefractionMapPath}`** is the path of the refraction map file.
* **`{RefractionMapName}`** is the name of the refraction map file.
* **`{DisplacementMapPath}`** is the path of the displacement map file.
* **`{DisplacementMapName}`** is the name of the displacement map file.
* **`{TranslucencyMapPath}`** is the path of the translucency map file.
* **`{TranslucencyMapName}`** is the name of the translucency map file.
* **`{EmissiveColorMapPath}`** is the path of the emissive color map file.
* **`{EmissiveColorMapName}`** is the name of the emissive color map file.
* **`{EmissiveIntensityMapPath}`** is the path of the emissive intensity map file.
* **`{EmissiveIntensityMapName}`** is the name of the emissive intensity map file.

{% hint style="info" %}

#### **Example: adding a suffix to the material names**

Let's say that you want to add a suffix *"\_palmtree"* to all the materials:

1. Add the condition *"Name* → *not empty"* (which means that the automation will be applied to all the materials)
2. Add the action *"Name* → *{MaterialName}\_palmtree"*

With this automation, all the material names will be modified to end with "\_palmtree". For instance, a material named *"trunk"* will be renamed to *"trunk\_palmtree"*.

Note: by default, Transmutr prefixes all the materials with the model name. You can disable this behavior in the [Options](https://help.transmutr.com/manual/options).
{% endhint %}

{% hint style="success" %}
If you want to achieve a specific result, but don't know how to, don't hesitate to contact us at <transmutr@lindale.io>\
We'll be glad to help you!
{% endhint %}

## Applying Automations to multiple files

If you have multiple files that need similar material processing, you can automate the process by combining Automations with [Presets](https://help.transmutr.com/manual/presets) and the [Command-Line Interface](https://help.transmutr.com/manual/command-line-interface). This is very powerful if you have a large library of files that were created the same way.

1. Open any one of the files with Transmutr and setup your automations
2. Save the current settings (including automations) as a preset file by clicking on <img src="https://1807576756-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LbleSCzt45l7QT5OXk4%2F-LnHTh_SaCwfkalO850X%2F-LnHgNscfQ5p_wAp8rdG%2Fsave_preset.JPG?alt=media&#x26;token=c8be19f0-13d4-4d2a-aae0-cd40c6e87173" alt="" data-size="original">&#x20;
3. Use the [Command-Line Interface](https://help.transmutr.com/manual/command-line-interface) to convert all your files while applying the preset settings that include the automations you created earlier.

For example, this command converts all OBJ files in *C:/models/* and applies *preset.json* which can contain some automations:\
`transmutr.exe convert --preset C:/models/preset.json C:/models/*.obj`
