-
Notifications
You must be signed in to change notification settings - Fork 138
SkeletonAsset Guide
All assets are known engine types that allow instances to be created at runtime. The "SkeletonAsset" — actually the SpineAsset class — is derived from a base type of "AssetBase", so it includes all of that type's fields plus its own.
A SkeletonAsset points the engine at the files exported from a skeletal-animation program. The only program supported is Spine. The asset references two exported files — a Spine atlas (the packed texture + region data) and a Spine skeleton data file (the JSON or binary skeleton). A SkeletonAsset is then used in a scene through a SkeletonObject.
A note on naming: these pages are titled "Skeleton", but the actual engine class is
SpineAssetand its skeleton-file field isSpineFile. The frozenmasterspinebranch is inconsistent here — some bundled example assets still use the olderSkeletonAsset/SkeletonFilenames. The_ScriptBinding.his the source of truth.
Using Spine requires a valid Spine license from Esoteric Software — and merely including the Spine runtime in a project triggers that requirement, even if a game doesn't use it. For that reason Spine was removed from the main engine and lives only on a separate masterspine branch, so the SpineAsset class is not present in a normal checkout.
See SkeletonObject for the full step-by-step on enabling Spine support (forking, merging masterspine, and wiring it into the CMake build) — and for an important warning that the bundled runtime is the old Spine 3.8 (current Spine is 4.3), so skeleton data exported from a modern Spine editor will not load without updating the runtime yourself.
(On the masterspine branch.)
The SpineAsset type exposes the following fields in addition to those it inherits. Shown are the equivalent methods available that perform the same action in setting and getting the respective field:
- AtlasFile
- setAtlasFile(string)
- getAtlasFile()
- SpineFile
- setSpineFile(string)
- getSpineFile()
- PreMultipliedAlpha — whether the texture was built with pre-multiplied alpha. (Set as a field; no dedicated get/set method.)
The following is a complete description of each of these fields.
The file path of the Spine atlas file. If your .asset.taml lives in the same folder as the atlas file, only the file name is needed.
%spineAsset.setAtlasFile("goblins.atlas");The file path of the Spine skeleton data file (the JSON or binary skeleton exported from Spine). If your .asset.taml lives in the same folder as the skeleton file, only the file name is needed.
%spineAsset.setSpineFile("goblins.json");A SkeletonAsset is normally defined in a .asset.taml file alongside its atlas and skeleton files. Here is the example in XML format:
<SpineAsset
AssetName="goblins"
AtlasFile="goblins.atlas"
SpineFile="goblins.json" />Note: the
SpineToyexample shipped inmasterspinestill uses the older<SkeletonAsset … SkeletonFile="…">form. That older tag predates the currentSpineAssetclass — use the field names shown above and verify againstSpineAsset_ScriptBinding.h.