diff --git a/docs/pipelines/file_format.md b/docs/pipelines/file_format.md index 9a399e9028ad5ddb019d2d5678fe4fb2fe3e7023..9c2d4d9dcc2e6fe78194338b2e6b800d8bc83c5f 100644 --- a/docs/pipelines/file_format.md +++ b/docs/pipelines/file_format.md @@ -1,3 +1,64 @@ # Pipeline.toml ## _WIP_ +Pipeline toml files can be incredibly concise by using many bits of shortcut syntax. Be sure to familiarise yourself +with the [TOML language](https://toml.io/en/) to get the most from this. + +Pipelines have three sections, defined in up to two locations: An input, an output, and a series of actions that will +be executed in order to transform one to the other. + +```toml +# # # +# Create reusable sets of actions in the "refs" map that can be used for multiple assets. Pipeline actions can also +# be defined inline, but you will typically need to use a pipeline more than once. +# # # +[[refs.flip_and_scale.actions]] +command = "Flip" +params = { direction = "horizontal" } + +[[refs.flip_and_scale.actions]] +command = "Scale" +params = { factor = 2.0 } + +[[refs.rotate.actions]] +command = "Rotate" +params = { amount = "one" } + +# There are three ways to write the input & output section of a pipeline. + +# 1) You can defined everything inline in the pipelines array +[[pipelines]] +input_path = "./some_sprites.png" +output_path = "../built/some_sprites.png" +actions = [ + { command = "Rotate", params = { amount = "one" } } +] + +# 2) You can reference a preset of actions defined in the "refs" table +[[pipelines]] +input_path = "./some_sprites.png" +output_path = "../built/some_sprites.png" +reference = "flip_and_scale" + +# 3) You can use a reference alongside a glob pattern to target multiple assets +[[pipelines]] +pattern = "./creatures/*.png" +output_dir = "../built/creatures" +reference = "rotate" + +``` + +Another way to write the reference section of the above example would be: + +```toml +[refs.flip_and_scale] +actions = [ + { command = "Flip", params = { direction = "horizontal" } }, + { command = "Scale", params = { factor = 2.0 } } +] + +[refs.rotate] +actions = [ + { command = "Rotate", params = { amount = "one" } } +] +``` \ No newline at end of file diff --git a/docs/pipelines/getting_started.md b/docs/pipelines/getting_started.md index 47af354f9ed1808d3c89527ea88df96b15cd6ba7..ecc659289f89bb37def3c05e1bcf0cdee6ead721 100644 --- a/docs/pipelines/getting_started.md +++ b/docs/pipelines/getting_started.md @@ -1,6 +1,8 @@ # Getting Started With Pipelines ## _WIP_ +[TOML file layout](file_format.md) + ### Execution Model ### Data Flow \ No newline at end of file