# 🕹️ SpriteStudio Player for Godot

[SpriteStudio](<https://www.webtech.co.jp/spritestudio/>) で作成したアニメーションを [Godot Engine](<https://godotengine.org/>) 上で再生するためのプラグインです。`.sspj` を **SS Importer** ドックにドラッグし、変換された `.ssab` を 2D ビューポートへドロップすれば、コードを書かずに再生できます。

> [!TIP]
>
> **SpriteStudio のデータが手元に無くても始められます**
>
> [公式のサンプルデータ](<https://www.webtech.co.jp/help/ja/spritestudio7/download/sample/>)がそのまま使えます。キャラクターなら [Ringo](<https://www.webtech.co.jp/help/ja/spritestudio7/download/sample/#ringo>)、エフェクトを含むものなら [パーティクル](<https://www.webtech.co.jp/help/ja/spritestudio7/download/sample/#Perticle_sample>) が手頃です。

## 目次

- **セットアップ**

  - [インストール](<https://cri-middleware.github.io/SSPlayerForGodot/ja/setup/install/index.md>)
- **ワークフロー**

  - [基本的な使い方](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/usage_basic/index.md>)
  - [アセットのインポートとエディタ連携](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/usage_asset_pipeline/index.md>)（初回の `.sspj` インポートはこちら）
  - [スクリプト制御とイベント](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/usage_scripting/index.md>)
  - [モーションブレンド](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/motion_blending/index.md>)
  - [UI ボタン](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/ui_buttons/index.md>)
  - [サウンド再生](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/audio/index.md>)
  - [AnimationPlayer との連携](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/animation_player/index.md>)
  - [プロジェクトのエクスポート](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/export/index.md>)
  - [生成アセットの構成と配信](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/generated_assets/index.md>)（依存関係・エクスポートモード・`.pck`）
- **応用**

  - [CLI コンバートと自動化](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/import/index.md>)
  - [コマンドラインで再生を検証する](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/verify_playback/index.md>)（ヘッドレスでの確認と PNG スナップショット。CI やコーディングアシスタント向け）
  - [パフォーマンスチューニングと高度な設定](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/tips/index.md>)
- **API リファレンス**

  - [SpriteStudioPlayer2D](<https://cri-middleware.github.io/SSPlayerForGodot/ja/api/player/index.md>)
  - [リソース管理クラス](<https://cri-middleware.github.io/SSPlayerForGodot/ja/api/resource/index.md>)
- [トラブルシューティング](<https://cri-middleware.github.io/SSPlayerForGodot/ja/troubleshooting/index.md>)
- [制約と適用範囲](<https://cri-middleware.github.io/SSPlayerForGodot/ja/limitations/index.md>)
- [v1.x からのマイグレーション](<https://cri-middleware.github.io/SSPlayerForGodot/ja/migration_from_v1/index.md>)
- **Player・SDK 開発者向け**

  - [ビルドガイド](<https://cri-middleware.github.io/SSPlayerForGodot/ja/development/build/index.md>)
  - [プレイヤーの構成](<https://cri-middleware.github.io/SSPlayerForGodot/ja/development/architecture/index.md>)（層と、この作りになっている理由）
- **ライセンス**

  - [ライセンス](<https://cri-middleware.github.io/SSPlayerForGodot/ja/license/index.md>)
  - [サードパーティライセンス](<https://cri-middleware.github.io/SSPlayerForGodot/ja/third_party_notices/index.md>)

## 主な機能 (Key Features)

- **キャラクターが“生きる”。** 呼吸・まばたき、なびく髪や衣装、斬撃・魔法のエフェクトまで——動きは専用エディタ（SpriteStudio）でボーン・メッシュ変形・パーティクル・パーツ単位のアドオンシェーダを使ってビジュアルに作り込み、Godot はそれを再生するだけ。再生中のアニメーションはトラックに重ねたりクロスフェードしたりでき、歩きから走りへも飛ばずになめらかにつながります（[モーションブレンド](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/motion_blending/index.md>)）。`AnimationPlayer` で組み直す必要はありません。
- **キャラクターだけでなく、エフェクトや UI、シーン全体も。** キャラクター・背景・エフェクト・UI を組み合わせたカットシーンや画面全体の演出をエディタで作り、Godot では 1 つのアニメーションとして再生できます。`SpriteStudioButton` を使えば、ホバー・押下・無効・フォーカスごとに別の区間を再生する Godot のボタンにもなります（[UI ボタン](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/ui_buttons/index.md>)）。
- **いつものノードとして使える。** `SpriteStudioPlayer2D` は他のノードと同じようにシーンに置き、GDScript から操作できます（タイムラインのキーからのシグナル通知、設定不要のサウンド再生、実行時のパーツ単位の上書き、セルマップのテクスチャ差し替えに対応 — [スクリプト制御とイベント](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/usage_scripting/index.md>)）。アニメーションはシーンの外の専用ファイルに入るので、チーム開発でシーンの Git コンフリクトが起きにくくなります。
- **SpriteStudio と Godot をシームレスに往復。** `.sspj` を SS Importer ドックにドロップすれば、エディタ内で変換されます（[アセットのインポートとエディタ連携](<https://cri-middleware.github.io/SSPlayerForGodot/ja/workflow/usage_asset_pipeline/index.md>)）。直したくなったらインスペクターの **Open SSPJ** で SpriteStudio を開いて保存し、**Reconvert** を押すだけ。書き出しの手作業は要りません。
- **パース不要の読み込みと SIMD で、軽く滑らかに。** `.ssab` は FlatBuffers のバイナリをそのまま読むので、読み込み時のパースがありません。ポーズ計算は SIMD で最適化した Rust コアが担い、モバイルや大量のキャラクターを出すゲームでも滑らかに動きます。**サブフレーム補間**をオンにすれば、高リフレッシュレートのディスプレイにも追従します。

## 概要 (Overview)

本プラグインを利用してアニメーションを再生する際の流れを以下に示します。

```
graph LR
    SS[" .sspj / 画像<br>(ソースアセット) "]

    subgraph Convert ["変換プロセス"]
        DOCK[[" SS Importer ドック<br>(Godotエディタ内蔵) "]]
        CLI[[" ssconverter-cli<br>(CLIツール) "]]
    end

    subgraph Godot ["Godot ランタイム (res://)"]
        BIN[" .ssab / .ssqb "]
        NODE[[ SpriteStudioPlayer2D ]]
        RT(" libssruntime ")
    end

    SS -- "ドラッグ＆ドロップ" --> DOCK
    SS -- "CI/CDや手動" --> CLI
    DOCK -. "自動生成" .-> BIN
    CLI -. "生成" .-> BIN

    BIN -- "インスペクターにセット" --> NODE
    NODE -. "高速再生" .-> RT
    NODE -- "描画" --> RENDER{{" 画面 "}}

    classDef generated stroke-dasharray: 5 5;
    class BIN generated;
```

## 対応バージョン

- **Godot Engine**: 4.7 以降。
- **SpriteStudio**: SpriteStudio 7.6 以上で作成されたプロジェクト。

## 関連リポジトリ

- [SpriteStudio Docs](<https://cri-middleware.github.io/SpriteStudio-Docs/ja/>) — SDK と公式 Player のドキュメントポータル。
- [SpriteStudio-SDK](<https://github.com/cri-middleware/SpriteStudio-SDK>) — `libssruntime` / `libssconverter` を提供する SDK 本体。
- [SSConverterGUI](<https://github.com/cri-middleware/SSConverterGUI>) — Player を介さず `.sspj` を変換するデスクトップ GUI。

## マイグレーション

v1.x 以前のバージョンからの移行手順については、[マイグレーションガイド](<https://cri-middleware.github.io/SSPlayerForGodot/ja/migration_from_v1/index.md>) を参照してください。

## ライセンス

[ライセンス](<https://cri-middleware.github.io/SSPlayerForGodot/ja/license/index.md>) を参照してください。

サードパーティライブラリ（FlatBuffers, SpriteStudio-SDK の依存クレートなど）のライセンスについては、[サードパーティライセンス](<https://cri-middleware.github.io/SSPlayerForGodot/ja/third_party_notices/index.md>) を参照してください。
