← back to roto on ba3a.dev

AtlasModelSource

class AtlasModelSource(file: Path, canvas: Canvas, actions: List<String>, facings: List<String>, pattern: Template, durationMs: Map<String, Int> = emptyMap(), loops: Set<String> = emptySet()) : ModelSource

A libGDX .atlas file (its page PNGs beside it) as animations. Each region is matched against the name pattern for every action and facing of the project; the matches of one action and facing, ordered by frame number, are one row. Regions that match nothing are skipped and listed in skipped. An atlas carries no durations, so each action has the artist's duration and loop flag. A region smaller than the canvas is placed on it by ModelCanvas; a larger one stops the import, naming both sizes.

Parameters

file

the .atlas file

canvas

the project canvas

actions

the project's actions

facings

the project's facings

pattern

a Template over {action}, {facing} and {frame}, all three required

durationMs

each action's frame duration; an action not in the map gets DEFAULT_ATLAS_DURATION_MS

loops

the actions that loop; any other does not

Constructors

Link copied to clipboard
constructor(file: Path, canvas: Canvas, actions: List<String>, facings: List<String>, pattern: Template, durationMs: Map<String, Int> = emptyMap(), loops: Set<String> = emptySet())

Properties

Link copied to clipboard

The names of the regions that matched no action and facing, in file order.

Functions

Link copied to clipboard
open override fun durations(row: ModelRow): List<Int>

The action's duration for every frame.

Link copied to clipboard
open override fun frames(row: ModelRow): List<Raster>

The row's regions in frame order, each rebuilt at its original size and placed on the canvas.

Link copied to clipboard
open override fun loop(row: ModelRow): Boolean

Whether the row's action is in the looping set.

Link copied to clipboard
open override fun rows(): List<ModelRow>

One row per action and facing that has regions, in the project's action then facing order.