Creating Actions - ArtFXDev/silex_client GitHub Wiki
The actions defines what are the options to the user. An action could be thought as a shelf button in a DCC. When the user execute an action, the actual action is resolved according to the context and then all the commands that compose the resolved action are executed in order.
You can create your actions in config/actions folder, or in a subfolder of it.
📦config
┗ 📂actions
┣ 📂action_category
┃ ┗ 📜your_action.yml
┗ 📜your_action.yml
An action definition is a yaml file that defines the commands to execute and there parameters. You can define multiple actions in one file but we usually avoid it, the yaml must correspond to the following schema:
<action_name>:
steps:
<step_name>:
label: <pretty name of the step>
index: <index used to define the order of execution, it allows to insert new steps between existing steps>
commands:
<command_name>:
path: <path.to.the.command.definition>
tooltip: <Short help message for the user>
parameters:
<parameter_name>: <parameter_value>
The commands are grouped into steps. The order of execution is defined first by the step index and then the steps commands are executed in order
An action can inherit from an other using the !inherit tag. Any entry in the file can contain the !inherit tag, you can make an entire action inherit from an other but you can also make a step inherit from an other actions step. The !inherit tag is used with two keywords arguments :
- parent:
- key: <path separated with "." to the desired key
Example:
- To make your entire action inherit from another
<action_name>: !inherit
parent: "./<action_name>.yml"
key: "<action_name>"
steps:
...
- To make only a step inherit from a step from an other action
<action_name>:
steps:
<step_name>: !inherit
parent: "./<action_name>.yml"
key: "<action_name>.steps.<step_name>"
commands:
...