← back to roto on ba3a.dev

PresetLibrary

class PresetLibrary(builtIn: Map<String, ProjectPreset>, userFolder: Path)

The presets a project can start from: the builtIn ones, then the artist's own in userFolder (<config>/presets), one <id>/ folder each holding the three bundle files. Listing is sorted by id within each group, so it is deterministic. Adding is all-or-nothing: the files are written to a temporary folder that is then moved into place.

Constructors

Link copied to clipboard
constructor(builtIn: Map<String, ProjectPreset>, userFolder: Path)

Types

Link copied to clipboard
object Companion

How the app and the command line build the library.

Functions

Link copied to clipboard
fun add(preset: ProjectPreset): String

Adds preset as a user preset and returns its id: the name with every run of characters SafeName does not allow turned into -. Throws PresetException, adding nothing, when no id can be made of the name, when the id is already a built-in or user preset (case aside), or when writing fails.

fun add(bundle: Path): String

Reads the bundle at bundle with PresetBundle.read and adds it as add does; a bad bundle adds nothing.

Link copied to clipboard

Built-in presets, then user presets, each group sorted by id. A damaged user preset is a BrokenPreset.

Link copied to clipboard
fun remove(id: String)

Removes the user preset id. A built-in or unknown id is a PresetException; nothing else is touched.