Hello Guest

Author Topic: Automatic generation of animated sprite  (Read 5549 times)

DannyB

  • 2D Toolkit
  • Hero Member
  • *
  • Posts: 609
    • View Profile
    • Chicks Ahead
Automatic generation of animated sprite
« on: July 27, 2012, 12:48:42 pm »
Hello,

As I am starting to work with tk2d, I noticed that one of the more time consuming actions is the creation of animated sprites.
I know there is the Auto Fill feature, which is very helpful, but my question / suggestion is this:

I would like to name my images in a way that they represent the name of the clip and a number, like:
Running.01
Running.02
Running.03
...
Shooting.01
Shooting.02
Shooting.03
...

And then, to press a button that will create the two clips for me: Running and Shooting.

Also, I am not sure if this is possible, it would be great to simply point the animated sprite to a folder, instead of dragging images to it. Like set up that "this animated sprite is using the folder Textures/Enemy1"

Even better would be if there is a settings screen for the animated sprite that lets me check a checkbox to "automatically rebuild when images change" and to set default framerate and other per-clip settings.

Then, the creation and editing of animation sprites would simply mean: change the images in the folder. Thats it.

Can this or something similar be done now? If not, perhaps add to the suggestion box?



unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Automatic generation of animated sprite
« Reply #1 on: July 27, 2012, 06:51:41 pm »
Something like this doesn't exist at the moment. The main reason is convention often varies wildly with different people. You can implement this really easily though, either at runtime or offline - basically all you need to to is create a tk2dSpriteAnimation component on a game object, and then populate the clips with the frames. Its really quite straightforward. You get the spriteIDs from the spriteColleciton for each frame and build up a tk2dSpriteAnimationFrame. So, each tk2dSpriteAnimation contains one or more tk2dSprtieAnimationClips, and each clip consists of one or more tk2dSpriteAnimationFrames.

You can do that offline, or you could easily add a button to the SpriteAnimationEditor around the "Add new clip" comment. Just add another button to call this function to do all the work done above.

I've got a Plugin system in the pipeline for something like this, but its unlikely to happen any time soon with my efforts being concentrated on 1.80 right now. Maybe a demo of the plugin system could do what you've described there.

DannyB

  • 2D Toolkit
  • Hero Member
  • *
  • Posts: 609
    • View Profile
    • Chicks Ahead
Re: Automatic generation of animated sprite
« Reply #2 on: July 27, 2012, 09:23:16 pm »
Thanks unikron.

I might try this approach when I feel brave enough. :)

Tochas

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Automatic generation of animated sprite
« Reply #3 on: December 06, 2012, 09:19:53 pm »
Hi,

Could you elaborate on the offline method? I am looking to automate the process of creating animation objects and their clips from a specified sprite collection. As after the graphic artist gets done with all the drawing and stuff I would have to deal with setting about 2870+ frames to their corresponding animation clips.

I have a solid background on C#, but I am new to this unity stuff

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Automatic generation of animated sprite
« Reply #4 on: December 06, 2012, 09:28:52 pm »
Drop me an email at support@unikronsoftware.com and I'll send you some sample code which will generate tk2dSpriteAnimations.