This repository has been archived by the owner on Dec 2, 2024. It is now read-only.
Reworked tilesheets to implement support for Sparrow atlases. #182
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current implementation of Tilesheets in Armory is very limited. It only provides support for grids of square sprites, and playing a range of frames from the grid in order. This is highly inefficient, as it does not allow the spritesheet to be optimized or frames to be reused.
This pull request implements engine support for the Sparrow sprite format, which associates an XML file with the spritesheet, which looks like so:
These spritesheets can be generated by programs such as TexturePacker or Adobe Animate.
Developers can then specify frames by prefix, for example the Walk animation will use the frames with the name
walk
, in order.Care was taken to ensure relatively few breaking changes were made to the Tilesheet class, but a more optimal code structure may require a rework to Tilesheet (such as making tilesheet a parent to GridTilesheet and SparrowTilesheet subclasses).
There is also room to add additional file formats as users request them.
TODO
flipX
,flipY
, androtate
attributes. These indicate that the frame should be rendered flipped horizontally, flipped vertically, or rotated by 90 degrees, respectively. These attributes are used to further optimize a spritesheet by minimizing transparent space.Note
This pull request is associated with armory3d/armory#2745, and will not function as intended without it.