Skip to content
roackimPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pyatlas

Aseprite to atlas tool — compact and metadata-aware.

Utility designed to simplify the 2D graphics production pipeline by packing sprite sheets into tight atlases with rich metadata export.

Features

  • Compact atlas packing — tight layout for sprite sheets.
  • Named animations — extract animations directly from the atlas.
  • Layer ordering — control draw order from Aseprite.
  • Frame time export — per-frame timing information.
  • Meta layers — hitboxes and points computed into consumable data for your game engine.

Installation

With pipx (recommended)

pipx install .

Build a standalone binary

make build-binary

This produces a runnable binary at ./bin/atlas.

Usage

pyatlas -i <input_folder> -o <output_folder> -m <manifest_filename>

Layer Naming Syntax

Prefix Meaning Example
# Animation layer #jump
@hb Hitbox meta layer @hb.body
@pt Point meta layer @pt.origin

Animation layers (#<name>)

Layers prefixed with # are exported as animation frames. Example: #jump, #idle.

Box meta layers (@hb.<label>)

The program computes the axis-aligned bounding box of non-transparent pixels (alpha > 127) for each frame. This allows defining hitboxes directly as pixel art — especially useful for per-frame hitboxes on complex characters or bosses.

Point meta layers (@pt.<label>)

The program computes the barycenter (mean of the pixel centres) of all non-transparent pixels per frame, as unrounded floats. Useful for anchor points, attach points, or origin references.

Labels

The label is everything after @hb. / @pt., kept verbatim: @hb.hurtbox.arm_left has the label hurtbox.arm_left. A dot is part of the name, not nesting. Allowed: letters, digits, _, and . between parts. Labels are free-form; the exporter gives none of them special treatment.

Manifest metadata

A state is an Aseprite frame tag; a file without tags is a single state. Box and point metadata live on the state node, z-order on the file node:

hero = {
  _metadata = { z_order = { "body" } },          -- file node
  atk = {                                        -- state node (tag)
    _metadata = {
      boxes = {
        solidbox             = { const  = { x = 9, y = 13, w = 6, h = 11 } },
        hitbox               = { frames = { [2] = { x = 20, y = 11, w = 3, h = 6 },
                                            [4] = { x = 21, y = 10, w = 2, h = 8 } } },
        ["hurtbox.arm_left"] = { frames = { ... } },
      },
      points = {
        origin = { const = { x = 12.5, y = 23.5 } },
      },
    },
    body = { x = 0, y = 0, w = 24, h = 24, n = 4 },
  },
}
  • Each label is either { const = V } (present with the same value on every frame of the state) or { frames = { [i] = V } }, a sparse table keyed by 1-based frame index within the state. A missing index means the label is absent on that frame; there is no fallback. Never use # / ipairs on frames.
  • A label absent on every frame of a state is not emitted. Empty boxes, points and _metadata are omitted.
  • Boxes are integer {x, y, w, h} and points float {x, y}, in sprite pixels, y-down, relative to the frame's top-left.
  • For an untagged file the state node is the file node. For an #auto file the state node is the region leaf itself, next to x, y, w, h, n.
  • Frame indices assume every layer exports every frame: the Aseprite export runs without --trim / --ignore-empty.

Build-time checks

  • Error: an @ layer that is not @hb.<label> / @pt.<label> (e.g. @hbx.foo, @pt), an invalid label, or two layers with the same name.
  • Warning: a state where solidbox is present on some frames but not all; a state with box/point metadata but no origin (or origin.<variant>, e.g. origin.floor) point. These names are constants at the top of pyatlas/parse_jsons.py.

Tests

pixi run tests

Fixtures are real .aseprite files generated by tests/fixtures/make_fixtures.lua; their exports are committed so the tests do not need Aseprite. After changing the fixtures run aseprite -b --script tests/fixtures/make_fixtures.lua && ./tests/fixtures/export_fixtures.sh, and UPDATE_GOLDEN=1 pixi run tests after an intended manifest format change.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages