AS

ampersante/spine2d-animation-mcp

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

129 stars 26 forks Качество 57 Тренд 5MIT

ampersante/spine2d-animation-mcp — это кандидат на MCP-сервер, импортированный из https://github.com/ampersante/spine2d-animation-mcp.

Обзор

ampersante/spine2d-animation-mcp — это кандидат на MCP-сервер, импортированный из https://github.com/ampersante/spine2d-animation-mcp.

Обзор (машинный перевод)

MCP-сервер, который преобразует многослойный PSD-персонаж в проект Spine 4.2 — skeleton JSON, текстурный атлас и PNG(ы) страницы atlas — готовый к импорту в редактор Spine и Unity.

Цель — сократить ручную работу по монтажу и импорту персонажа с нескольких дней до примерно часа.

Статус

Фаза 0 (доказательство концепции): PSD → правильный, импортируемый риг (пока без анимации).

Конвейер реализован и покрыт тестами на синтетических фикстурах. Он ещё не был проверен с реальным PSD в редакторе Spine / Unity — это следующий этап. Генерация анимации, headless-превью и экспорт Unity планируются на более поздние этапы.

Что он делает сегодня

Имея PSD, слои которого названы по частям тела (head, body/torso, arm_left, hand_right, leg_left, foot_right, …), инструмент import_psd_to_spine даёт:

  • .json — Скелет позвоночника 4.2 (кости, слоты, стандартная кожа, региональные прикрепления)
  • .atlas — libgdx/атлас текстуры позвоночника
  • .png — упакованная страница(ы) атласа

Ключевые поведения:

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

README

Показан фрагмент оригинального README. Открыть оригинал.

spine2d-mcp

An MCP server that converts a layered PSD character into a Spine 4.2 project — skeleton JSON, texture atlas, and atlas page PNG(s) — ready to import into the Spine editor and Unity.

The goal is to cut the manual rig-and-import work for a character from days down to roughly an hour.

Status

Phase 0 (proof of concept): PSD → a correct, importable rig (no animations yet).

The pipeline is implemented and covered by tests against synthetic fixtures. It has not yet been validated against a real PSD in the Spine editor / Unity — that is the next milestone. Animation generation, headless preview, and Unity export are planned for later phases.

What it does today

Given a PSD whose layers are named after body parts (head, body/torso, arm_left, hand_right, leg_left, foot_right, …), the import_psd_to_spine tool produces:

  • .json — Spine 4.2 skeleton (bones, slots, default skin, region attachments)
  • .atlas — libgdx/Spine texture atlas
  • .png — packed atlas page(s)

Key behaviors:

  • Multi-segment skeleton (root → hip → torso → chest → neck → head, limbs off chest, legs off hip); missing intermediate bones are created as positioned virtual bones.
  • Joint-correct pivots — each bone pivots at the joint edge of its part (or an explicit [pivot] marker layer), not the image center, so rotation behaves anatomically.
  • PSD draw order is preserved as Spine slot order.
  • Structural validation of the skeleton against the invariants the Spine 4.2 reader enforces.

Format source of truth: reference/SkeletonJson.java (spine-runtimes 4.2).

Requirements

  • Python 3.11+
  • uv

Setup

uv sync

Run the tests

uv run pytest

Run the MCP server

uv run spine2d-mcp

This starts a stdio MCP server exposing a single tool:

import_psd_to_spine(psd_path: str, out_dir: str | None = None)
  -> { project_path, atlas_path, png_paths }

Point an MCP client (e.g. Claude Desktop / Claude Code) at it, then ask it to import a PSD by path.

Project layout

src/spine2d_mcp/
  server.py          FastMCP server + import_psd_to_spine tool
  pipeline.py        PSD -> Spine project orchestration
  psd/parser.py      PSD -> flat layer list (+ pivot markers)
  psd/conventions.py bone hierarchy, joint sides, [pivot] tag
  spine/schema.py    Pydantic models for Spine 4.2 JSON
  spine/builder.py   layers -> SpineProject
  spine/writer.py    SpineProject -> JSON
  spine/validator.py structural validation
  atlas/packer.py    rectpack bin packing
  atlas/writer.py    .atlas text + composite PNG
reference/           SkeletonJson.java, spineboy.atlas (format references)
tests/               pytest suite (synthetic PSD fixtures)

License

This project is released under the MIT License.

You may use, copy, modify, merge, publish, distribute, sublicense, and sell copies

Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →