Skip to content

TextureAtlas: recognise TexturePacker / Aseprite JSON from other exporters - #1917

Merged
obiot merged 6 commits into
masterfrom
claude/peaceful-ritchie-2vbnh4
Nov 25, 2026
Merged

obiot merged 6 commits into
masterfrom
claude/peaceful-ritchie-2vbnh4

Conversation

@obiot

@obiot obiot commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Description

TextureAtlas chose its parser from the tool named in meta.app and refused any other name, so a file in the TexturePacker or Aseprite JSON layout written by another tool (such as spritesheet.dev) threw Unknown texture atlas format before any parsing. TexturePacker's "JSON (Hash)" variant also failed with frames.forEach is not a function.

What changes

  • Unknown meta.app: the format falls back to the structure of the file. meta.frameTags reads as Aseprite; frames that each have a frame rectangle (and, in a list, a filename), with meta.size, read as TexturePacker. A missing or non-string meta.app goes the same way. A known name still decides alone, and a file in neither layout still throws Unknown texture atlas format.
  • TexturePacker "JSON (Hash)": frames keyed by name are read as the array form is.
  • ShoeBox: the melonJS exporter writes "app": "ShoeBox", but the name was matched in lowercase only, so those files were refused. The match no longer depends on case.
  • Missing image error: it printed 'null'; it now names the image.
  • Refactoring: the TexturePacker and Aseprite parsers shared their per-frame code; both now call one addFrame helper (parser/frame.js), and the constructor picks the parser once.

Docs and skills

  • README, "Tools integration": spritesheet.dev and any tool exporting the TexturePacker or Aseprite JSON layout; Blender and other glTF tools for 3D scenes.
  • API doc: the TextureAtlas class doc lists the Hash variant and other tools, and its first example says which exports it covers.
  • Sprites skill: the atlas format table has the Hash variant and a row for other tools, and the symptom table has rows for Unknown texture atlas format, frames.forEach is not a function, and an Aseprite "Array" export whose frames are not found by name.
  • Router skill: its two mentions of atlas formats include tools exporting those layouts.
  • Changelog: two entries under Added and one under Fixed.

Not changed

  • The Aseprite parser names the frames of a "JSON (Array)" file by position ("0", "1"), not by filename. That predates this change; the new tests pin it as it is.
  • TMXTileset still requires "aseprite" in meta.app before turning frame tags into tile animations.

Testing

  • New spec tests/texture-atlas-formats.spec.js: every combination of ten meta.app values and four layouts (TexturePacker Array and Hash, Aseprite Array and Hash), checking the format, frame names, rectangles, UVs and animations; malformed files that must still throw; ShoeBox as exported; multipack; image lookup; and drawing on WebGL and Canvas with pixel checks.
  • pnpm test passed locally on the second commit (540 files, 12,690 tests); the later commits add tests, docs and skills only, and the two atlas specs pass with them (184 tests). pnpm lint passes.
  • The eleven examples that build a TextureAtlas were loaded in headless Chromium against this branch: no errors, and each draws its atlas art.

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Performance improvement
  • Refactoring (no functional changes)

Checklist

  • I have read the Contributing Guide
  • My code follows the existing code style (pnpm lint passes)
  • I have tested my changes locally (pnpm test passes)
  • I have added tests that cover my changes (if applicable)
  • The build succeeds (pnpm build)

Related issues

Fixes #1915

🤖 Generated with Claude Code

https://claude.ai/code/session_01JnzwA1sfRfGDyxaPSzYMnN

…rters

An atlas whose meta.app is not a tool known by name is now identified from
the structure of the file (meta.frameTags reads as Aseprite, frames with a
frame rectangle as TexturePacker) instead of throwing, and the TexturePacker
parser accepts the "JSON (Hash)" variant, frames keyed by name.

Adds spritesheet.dev to the supported tools.

Fixes #1915

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnzwA1sfRfGDyxaPSzYMnN
Follow-up to the review of the #1915 change:
- an unknown tool's file is accepted only when every frame has its
  rectangle (and, in a list, its filename), checked before its tags, so
  a malformed file throws "Unknown texture atlas format" rather than a
  TypeError or loading empty
- ShoeBox is matched whatever its case: the melonJS exporter writes
  "ShoeBox", which was refused
- the TexturePacker and Aseprite parsers share one addFrame helper, and
  the constructor picks the parser once
- the missing-image error names the image
- tests: expectations spelled out per layout, malformed inputs, ShoeBox
  as exported, mixed multipack; the duplicate block is removed

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnzwA1sfRfGDyxaPSzYMnN
…med files

Covers the branches the format specs did not reach: the image named by
meta.image when none is passed, an image passed by name, a file that names
none, and frames or a sheet size of the wrong type.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnzwA1sfRfGDyxaPSzYMnN
Copilot AI balanced review requested due to automatic review settings November 24, 2026 23:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnzwA1sfRfGDyxaPSzYMnN
Copilot AI balanced review requested due to automatic review settings November 25, 2026 00:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

…exturePacker or Aseprite layout

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnzwA1sfRfGDyxaPSzYMnN
Copilot AI balanced review requested due to automatic review settings November 25, 2026 00:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnzwA1sfRfGDyxaPSzYMnN
Copilot AI balanced review requested due to automatic review settings November 25, 2026 00:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@obiot
obiot merged commit 28ffce8 into master Nov 25, 2026
6 checks passed
@obiot
obiot deleted the claude/peaceful-ritchie-2vbnh4 branch November 25, 2026 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature request] Recognise TexturePacker / Aseprite JSON from other exporters (meta.app whitelist)

3 participants