Skip to content

Spine (esotericsoftware) model detection + export - #10

Merged
Diphome merged 3 commits into
masterfrom
feat/spine-exporter
Sep 7, 2026
Merged

Spine (esotericsoftware) model detection + export#10
Diphome merged 3 commits into
masterfrom
feat/spine-exporter

Conversation

@Diphome

@Diphome Diphome commented Sep 7, 2026

Copy link
Copy Markdown
Owner

What

Adds detection and export of Spine 2D skeletal models embedded in Unity assets. Since Spine format can't be synthesized from arbitrary Unity data, "export" means reassembling the original embedded Spine files into a per-model folder that re-imports into the Spine editor:

  • <model>.json or <model>.skel — the skeleton
  • <model>.atlas — the atlas (verbatim)
  • one .png per atlas page, named exactly as the atlas references it

Detection (hybrid)

  • Format heuristics on TextAssets (the always-works path): Spine atlases are recognised by their size:/filter:/format: page headers; JSON skeletons by the {"skeleton":…,"bones"/"slots"} shape; binary skeletons by .skel[.bytes] name. Texture pages are matched to Texture2Ds by the page name in the atlas.
  • Grouping prefers explicit SkeletonDataAsset links when a frontend can supply them (the collector accepts them), and otherwise groups skeleton+atlas by source assets file. Because pages are matched by atlas page-name, it also works when the skeleton/atlas and the textures live in different bundles.

Surfaces

  • CLI: -m spine (loads TextAssets + Texture2Ds), e.g. UnityRiftCLI <input> -m spine -o out.
  • GUI: Export → To Spine (skeleton + atlas + textures), added in code (no Designer edits), mirroring the Godot export wiring. Prompts for a folder and exports in the background.
  • Shared logic in UnityRiftUtility/SpineExtractor (SpineDetector, SpineCollector, SpineExporter, SpineModel).

Tested

Verified end-to-end on a real IL2CPP WebGL sample (samurai_oni, itch.io 2D character customization). The skeleton/atlas were in data.unity3d and the 7 texture pages in a separate addressables bundle; loading both, -m spine produced a valid Spine 4.3 samurai_oni.json + samurai_oni.atlas + 7 valid PNG pages, all resolved (no missing-texture warnings).

net9 CLI + GUI build clean; CI validates net472/net8/net9.

Follow-up

The collector already accepts explicit SkeletonDataAsset/AtlasAsset MonoBehaviour links, but the frontends currently feed only the heuristic path (the sample is IL2CPP with stripped MonoBehaviour typetrees, so those fields aren't readable there). Wiring the MonoBehaviour-field grouping for Mono games / loaded assemblies is a clean next step against a suitable sample.

Diphome and others added 3 commits September 7, 2026 21:04
Detect Spine models embedded in Unity assets and export the raw Spine files —
skeleton (.json/.skel), atlas (.atlas) and texture pages (.png) — into a
per-model folder that re-imports into the Spine editor.

- UnityRiftUtility/SpineExtractor: shared detector (atlas/skeleton format
  heuristics + atlas page parsing), collector (groups skeleton+atlas+textures,
  by explicit SkeletonDataAsset links when available, else by source assets
  file) and exporter (writes skeleton/atlas verbatim + PNG pages named exactly
  as the atlas references them).
- CLI: new "-m spine" mode (loads TextAssets + Texture2Ds).
- GUI: "Export > To Spine (skeleton + atlas + textures)" menu item, added in
  code (no Designer edits), mirroring the Godot export wiring.
- Texture pages are matched by the atlas page name, so it also works when the
  skeleton/atlas and the texture pages live in different bundles.

Tested on a real IL2CPP WebGL sample (samurai_oni): 1 model, 7 atlas pages, a
valid Spine 4.3 skeleton + atlas + 7 PNGs.

Co-Authored-By: Clue Opus 4.8 <noreply@anthropic.com>
Expose the new "-m spine" mode as an MCP tool (mirrors godot_export): detect
and export Spine models (skeleton + atlas + texture pages) to a per-model
folder. Notes that pages may live in a separate bundle, so pass a folder
containing both.

Co-Authored-By: Clue Opus 4.8 <noreply@anthropic.com>
Read spine-unity SkeletonDataAsset/AtlasAsset MonoBehaviours to recover the
authoritative skeleton -> atlas grouping, following the Cubism ToType/PPtr
pattern: skeletonJSON + atlasAssets[].atlasFile resolve to the skeleton and
atlas TextAssets. Fields are read from the serialized type tree when present,
else from loaded/generated assemblies; when neither is available (IL2CPP with
stripped type trees and no assemblies) it returns nothing and the format
heuristics take over. Both frontends now gather MonoBehaviours and pass the
links to SpineCollector; the CLI spine mode loads MonoBehaviour too.

Verified on the IL2CPP WebGL sample: the MonoBehaviour path can't read the
stripped SkeletonDataAsset there, so it falls back to the heuristic with
identical, correct output (skeleton + atlas + 7 pages).

Co-Authored-By: Clue Opus 4.8 <noreply@anthropic.com>
@Diphome
Diphome merged commit 9a480df into master Sep 7, 2026
1 check passed
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.

1 participant