I've written a bit of code to simplify loading Spine Atlas and SkeletonData files through the XNA Content Pipeline.

Note: This is unfortunately finicky to set up, so I only recommend it if you're already familiar with the Content Pipeline, and you prefer to use it. Also, while Atlas is perfect, using the Content Pipeline for SkeletonData will mostly just be for the convenience of having a ContentManager act as an asset cache for you. Spine's classes are not designed in a way that would allow for use of the automatic XNB serializer, and doing the work to create ContentWriter/Reader classes for each of Spine's classes isn't really worth the effort.

If you'd like to use the code, you'll need four files. ... ions/Spine

1) AtlasPipeline.cs
2) SkeletonDataPipeline.cs
Add these to a Content Pipeline extension project. ... harp/Spine

3) AtlasReader.cs
4) SkeletonDataReader.cs
Add these to a Game or Library project.

Make sure your Content Pipeline extension project is added to Content project references, then you can set the importers and processors. For atlases, choose "Atlas Importer - Spine" and "Atlas Processor - Spine." And for SkeletonData, choose "SkeletonData Importer - Spine" and "SkeletonData Processor - Spine."

Next, in the ContentProcessor parameters (expand the drop down next to the processor) you need to set the name of the atlas. This is the same asset name you would use to load in game using a ContentManager.

Finally, load the SkeletonData using a ContentManager: (No need to load the atlas yourself.)
SkeletonData skeletonData = Content.Load<SkeletonData>("MySkeletonData");
One more note, in that second folder, you might have noticed a class called SkeletonRenderer. That's what I use to render Spine skeletons using a replacement SpriteBatch class that I wrote that allows for Matrix transforms per draw. This makes it easy to apply transforms to the skeleton without a bunch of SpriteBatch.Begin/End killing your frame rate.
사용자 아바타

Kickstarter Backer
전체글: 50


Good stuff, thanks! :)

Should probably mention the SpriteBatch based rendering can't render skewed images. Note the SkeletonRenderer in spine-csharp is a modified copy/paste of the MonoGame SpriteBatch without SRT per sprite and which exposes the vertices directly. It has Begin/End and can batch across Skeleton instances. If you mix using it with SpriteBatch though of course they will batch separately.
사용자 아바타

전체글: 7423

다시 돌아감: Editor