Jump to content

Spriter Data API for Unity


Recommended Posts

Spriter Data API

Overview

The Spriter Data API is an object model in C# that follows the SCML (Spriter Character Markup Language) specification. It abstracts reading from an SCML file, allowing developers to easily integrate Spriter into their own applications.

This version of the API is written for the Unity game engine (http://unity3d.com).

The plugin passes all of Timpart's Spriter Test Suite version 0.2.

Demo

NGUI/Spriter Demo

This demo shows the "Monster" example, with varying pivot points between animations and bone animation used.

Downloads

Spriter Data API

NGUI Implementation for the API - NGUI required (the free/evaluation version also works great)

Download both of the above repositories and place them into the Assets folder in your Unity project.

NGUI Free vs NGUI Full

To use the full version of NGUI, open "Spriter-NGUI\Editor\SpriterDataNGUI" and comment out line 34. Make it look like the following:


//To use the full version of NGUI, comment out the following line.
//#define NGUI_FREE

Usage

Make sure the Spriter project you're importing is inside the Assets folder. Whilst there's nothing stopping you selecting another directory it's likely to break the plugin.

Unity should now have a "Spriter" menu option, to the left of "Window" and "Help". In here you will find "[NGUI]Create New Character".

This will create the character using Unity's legacy animation system. From here there is no reliance on any of the scripts in this project beyond the colour helper.

Future Goals

Automating the import process when the .scml file is updated.

Extending the project to work with 2DToolkit and/or ex2D.

Adding a (non-recommended) mode of operation with no toolkits

Known Issues

Sprites are sometimes a few pixels off from where they should be. I'm investigating this but haven't found the cause.

Opening the example scene might cause sprites to flicker when they change. Re-importing solves this.

Half the commit messages were written with "R3" compatibility. I meant "B3". Whoops.

SCML Version

Current SCML Version: Beta file format

Acknowledgments

Special thanks to:


  • [*:9nw3g1x7]Michael Lyashenko of Tasharen Entertainment for help with scripting support for NGUI
    [*:9nw3g1x7]The ex2D devs for guidance in the atlas creation process.
    [*:9nw3g1x7]Mike and Edgar of BrashMonkey for support, as well as making both Spriter and the SCML format.
    [*:9nw3g1x7]CptDefault for doing a lot of work to update the API for compatibility with the latest Spriter version.

License

The Spriter Data API is licensed under the MIT License.

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 80
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...

You are truly awesome! I hadn't had time to continue my development and as I came back to check on the file format changes I found this thread. I love that you added support for NGUI as I just recently purchased it when it went on sale about two weeks ago.

Congratulations on a job well done and thanks for releasing it! :mrgreen:

Link to comment
Share on other sites

  • 1 month later...

@Thinksquirrel

Thank you for the great plugins.

I tried both your plugins, the ex2D and NGUI Version.

NGUI works fine.

But ex2D produces some errors. First it seems, that there was some NGUI code left in the ex2D script (I was able to fix that).

Second, the animation looks strange as if the objects anchorpoints were wrong or something.

I would like to use the ex2D version for a project, so it would be nice, if we could get it to work.

Link to comment
Share on other sites

Hey Fabian,

I've had this on hold for now until I get a chance to work on supporting the new Spriter file format - I haven't been able to test out the ex2D implementation too much as of yet.

Feel free to open up a more detailed issue on GitHub though, and I can check it out.

There's also a known bug that seems to affect rotations for either the first or last frame (causing jitters in loops sometimes). Not sure if it affects the ex2D version, but in the NGUI version I've had to do some manual tweaking after import.

Link to comment
Share on other sites

@Thinksquirrel

Thanks for the reply,

I hope we will get some example files for the new Spriter file format soon.

As you suggested, i added the two issue on GitHub (hope i did it right).

I will keep testing as soon as you got a chance to update the code.

I don't recognized the jitter bug on first and last frame you mentioned on NGUI version,

but I will look for it in the ex2D version as soon as the character parts are in the right place.

Link to comment
Share on other sites

  • 4 weeks later...
I'm really hoping the Unity version of this has the same or more features as Smooth Moves, like playmaker support, skinned meshes, and low draw calls.

The API itself is actually only input/output and doesn't have many features on its own. It's meant to be used in tandem with other Unity plugins, for the most part.

I'm working on the rewrite for the new SCML version as I get the time - I can look into importing from Spriter into Smooth Moves.

Link to comment
Share on other sites

  • 2 weeks later...

Hey guys,

Work has finally cooled down somewhat so I finally have some time for this. Here's the current roadmap:

Initial work


  • [*:32bi4ykf] Create a set of base classes and different I/O modules - similar to the current setup, but simplify methods to make more "sense"
    [*:32bi4ykf] Shared SCML read/write - getting this to work correctly is the #1 priority

Modules - this work can be done concurrently by multiple parties. We want to focus on modules which have already been created (with the exception of the default)


  • [*:32bi4ykf] Default I/O module - creates a hierarchy, atlas, and a skinned mesh.

    • [*:32bi4ykf] Wizard/GUI
      [*:32bi4ykf] Progress bars, visual indicators

[*:32bi4ykf] NGUI module update


  • [*:32bi4ykf] Wizard/GUI
    [*:32bi4ykf] Progress bars, visual indicators

[*:32bi4ykf] ex2D module update


  • [*:32bi4ykf] Wizard/GUI
    [*:32bi4ykf] Progress bars, visual indicators

[*:32bi4ykf] 2D Toolkit module


  • [*:32bi4ykf] Wizard/GUI
    [*:32bi4ykf] Progress bars, visual indicators

[*:32bi4ykf] Other modules

Since I can't currently devote as much time as I would like towards this project, I will be looking for contributors/maintainers for the various modules once the core system has been rewritten. If interested, please check out the associated GitHub issue here. Feel free to ask any questions or offer suggestions as well.

Link to comment
Share on other sites

  • 2 weeks later...
I would like to know if there is any probability of having a unity animation save file option.

Thank you :)

Hey Nekete,

The current version actually exports to native Unity animations already - I will be making a default module for the new version that doesn't require any plugins and makes an animated skinned mesh, though. These will also use native Unity animations.

Link to comment
Share on other sites

I would like to know if there is any probability of having a unity animation save file option.

Thank you :)

Hey Nekete,

The current version actually exports to native Unity animations already - I will be making a default module for the new version that doesn't require any plugins and makes an animated skinned mesh, though. These will also use native Unity animations.

This is awesome. I'd love to help somehow, but I'm quite new to Unity, so... well maybe testing in the meantime.

Link to comment
Share on other sites

Quick question, using this API, what would be the best way to do things like texture swaps (i.e. weapon/armor changing) as I want to be able to "upgrade" items. I haven't looked at Spriter in a while so there may be something in the newer versions that help support this, just asking as it would be nice to know once I get back to working with it.

Thanks again for your support in developing this awesome API!

Link to comment
Share on other sites

Quick question, using this API, what would be the best way to do things like texture swaps (i.e. weapon/armor changing) as I want to be able to "upgrade" items. I haven't looked at Spriter in a while so there may be something in the newer versions that help support this, just asking as it would be nice to know once I get back to working with it.

Thanks again for your support in developing this awesome API!

Texture swaps are best handled through character maps, which basically allow remapping of one image (can be atlased or not) to another. Creating character maps would be done on the Spriter side (once it's available), and I have plans to support them with the default Unity implementation.

Link to comment
Share on other sites

Texture swaps are best handled through character maps, which basically allow remapping of one image (can be atlased or not) to another. Creating character maps would be done on the Spriter side (once it's available), and I have plans to support them with the default Unity implementation.

Yeah, texture swap was the wrong phrase to use. I definitely prefer my character be compacted into an atlas that has its parts all mapped. Looking forward to it! :)

Link to comment
Share on other sites

  • 4 weeks later...

I'm having some difficulty understanding how Spriter works with unity and what I need to have and do to get whatever functionality it has.

I was under the impression spriter made sprite sheets and from then on you were on your own, but apparently it creates a file that can be in your assets and then Unity can understand this to make your animated sprites?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...