Spriter Plugin for Torque Going Open Source
by BrashMonkey · in General Add-On Discussion · 11/29/2012 (8:38 am) · 2 replies
Hello everyone. For the last few months I've been working on a Torque2D implementation for the Spriter 2D animation tool (http://www.brashmonkey.com/spriter.htm). However, due to various circumstances, it has been decided that opening development to other programmers will potentially speed up the final release of the plugins. And so, I am now releasing my work to you, the Torque community, to do with you please. The spriter demo and my torque script files can be found at:
http://www.brashmonkeygames.com/brashmonkey/spriter/T2SpriterDemo.zip
The source archive contains a modified copy of the Fish demo that I was using as a test case. The Spriter code is in game/gameScripts and consists of three main files: spriter.cs, spriterData.cs, and spriterEntity.cs.
spriter.cs contains some helper methods to load SCML files, create entities, etc.
spriterData.cs contains the Data class which is responsible for reading and storing the SCML file data.
spriterEntity.cs contains the Entity class which uses the Data class to build an entity and attach it to a scene.
Currently the code only loads the first mainline animation frame and displays them as a set of t2dStaticSprites. No animation is implemented at this stage.
My plan had been to continue developing these torque scripts in order to implement the whole of the Spriter functionality without the need to recompile Torque. Later, I planned to write some C++ classes to take advantage of increase performance when recompiling the engine was appropriate. Integration with TGB was also in the back of my mind, but lower on the priority list. The next obvious step forward with this code would be to implement the animation system.
Feel free to use (or not use) this code however you wish. When I started this project I was new to Torque, so perhaps there are more efficient ways to accomplish the things I've done here--if so, use them! And I look forward to seeing what the community does with this project.
Thanks,
Mike Ness
http://www.brashmonkeygames.com/brashmonkey/spriter/T2SpriterDemo.zip
The source archive contains a modified copy of the Fish demo that I was using as a test case. The Spriter code is in game/gameScripts and consists of three main files: spriter.cs, spriterData.cs, and spriterEntity.cs.
spriter.cs contains some helper methods to load SCML files, create entities, etc.
spriterData.cs contains the Data class which is responsible for reading and storing the SCML file data.
spriterEntity.cs contains the Entity class which uses the Data class to build an entity and attach it to a scene.
Currently the code only loads the first mainline animation frame and displays them as a set of t2dStaticSprites. No animation is implemented at this stage.
My plan had been to continue developing these torque scripts in order to implement the whole of the Spriter functionality without the need to recompile Torque. Later, I planned to write some C++ classes to take advantage of increase performance when recompiling the engine was appropriate. Integration with TGB was also in the back of my mind, but lower on the priority list. The next obvious step forward with this code would be to implement the animation system.
Feel free to use (or not use) this code however you wish. When I started this project I was new to Torque, so perhaps there are more efficient ways to accomplish the things I've done here--if so, use them! And I look forward to seeing what the community does with this project.
Thanks,
Mike Ness
#2
12/19/2012 (12:47 pm)
With the T2D MIT project announcement I will point out that this work will be able to take advantage of the new CompositeSprite objects in the updated T2D codebase. Multiple sub-images rendered with local transforms within a "parent" sprite object. And with box2d integrated you could add up to 32 collision shapes to the object and animate them with the system.
Vlad I
Default Studio Name
Glad you are still working on the integration it with T2D!
Going to check your demo right now.
Can't wait for full the version.
PLEASE keep us updated!