Repository navigation
TextureAtlas: recognise TexturePacker / Aseprite JSON from other exporters - #1917
Merged
Merged
Conversation
…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
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JnzwA1sfRfGDyxaPSzYMnN
…exturePacker or Aseprite layout Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JnzwA1sfRfGDyxaPSzYMnN
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JnzwA1sfRfGDyxaPSzYMnN
2 of 10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
TextureAtlaschose its parser from the tool named inmeta.appand refused any other name, so a file in the TexturePacker or Aseprite JSON layout written by another tool (such as spritesheet.dev) threwUnknown texture atlas formatbefore any parsing. TexturePacker's "JSON (Hash)" variant also failed withframes.forEach is not a function.What changes
meta.app: the format falls back to the structure of the file.meta.frameTagsreads as Aseprite; frames that each have aframerectangle (and, in a list, afilename), withmeta.size, read as TexturePacker. A missing or non-stringmeta.appgoes the same way. A known name still decides alone, and a file in neither layout still throwsUnknown texture atlas format."app": "ShoeBox", but the name was matched in lowercase only, so those files were refused. The match no longer depends on case.'null'; it now names the image.addFramehelper (parser/frame.js), and the constructor picks the parser once.Docs and skills
TextureAtlasclass doc lists the Hash variant and other tools, and its first example says which exports it covers.Unknown texture atlas format,frames.forEach is not a function, and an Aseprite "Array" export whose frames are not found by name.Not changed
"0","1"), not byfilename. That predates this change; the new tests pin it as it is.TMXTilesetstill requires "aseprite" inmeta.appbefore turning frame tags into tile animations.Testing
tests/texture-atlas-formats.spec.js: every combination of tenmeta.appvalues 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 testpassed 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 lintpasses.TextureAtlaswere loaded in headless Chromium against this branch: no errors, and each draws its atlas art.Type of change
Checklist
pnpm lintpasses)pnpm testpasses)pnpm build)Related issues
Fixes #1915
🤖 Generated with Claude Code
https://claude.ai/code/session_01JnzwA1sfRfGDyxaPSzYMnN