New AutoSD features
What you are going to learn:
- Using the new placeholders in TexturePacker
- Example with placeholders
- Using the new sprite filter feature
- Backwards compatibility
Placeholders
TexturePacker's Multipack and AutoSD features create multiple output files during a Publish:
- Multipack writes multiple atlases if there are more sprites than would fit into one single texture
- AutoSD writes multiple resolution output files
To save you from entering single file names for each of the variants - TexturePacker derives the names for you.
With 3.1.0 we introduced Multipack using simple placeholders in the file names to write the additional files.
Before TexturePacker 3.2.0 AutoSD replaced parts of the original file name with variant specific extensions.
E.g. replacing -ipadhd in the filename with -hd.
With 3.2.0 we've now changed the behavior of AutoSD to give you a better and more consistent way to specify file names - by also using placeholders instead of the replacement.
Placeholder | Description |
---|---|
{v} |
Scaling variant name |
{n} |
Multipack index, starting with 0 |
{n1} |
Multipack index, starting with 1 |
Example 1
Assuming that your sprites are for a Retina display iPad, name the data and texture files like sheet{v}.plist and sheet{v}.png.
Open the AutoSD dialog and enter the following values. Press + to add more variants.
Scale | Variant name {v} |
---|---|
1.0 | -ipadhd |
0.5 | -hd |
0.25 | empty |
To speed things up you might instead select the preset cocos2d ipad/hd/sd and press Apply.
After publishing you should see the following files:
- sheet-ipadhd.png
- sheet-ipadhd.plist
- sheet-hd.png
- sheet-hd.plist
- sheet.png
- sheet.plist
The corresponding command line would look like this:
TexturePacker \
--variant 1:-ipadhd \
--variant 0.5:-hd \
--variant 0.25: \
--data sheet{v}.plist \
--sheet sheet{v}.png \
--format cocos2d \
assets
Example 2
If you also use Multipack to create two ore more spritesheets, you have to name the texture and data files combining the placeholders like sheet{v}{n1}.png and sheet{v}{n1}.plist.
The resulting files after clicking Publish would be:
|
|

Sprite filter
Another new cool feature is the filtering of sprites!
Select SpriteKit (filter input sprites) or create your filters manually by clicking +, naming the variant and adding your search term in the "sprite filter" input field.
AutoSD will filter your sprites and put all sprites with @2x in a spritesheet called @2x, all sprites with iPhone in a spritesheet called iPhone and so on. You can also concatenate several search terms with , to have them packed into one spritesheet.
The filters will be processed longest first, so if you filter sprites by @2x-iPhone they wont appear on your @2x or your iPhone spritesheet.
The corresponding command line would look like this:
TexturePacker \
--variant 1:-@2x:@2x \
--variant 1:-iPhone:iPhone \
--variant 1:-@2x-iPhone:@2x-iPhone \
--data sheet{v}.plist \
--sheet sheet{v}.png \
--format cocos2d \
assets
Filtering also works on folder paths!
Just make sure you have the right smart folder in TexturePacker,
the one which includes all @2x, iPhone, @2x-iPhone ... subfolders.
Backwards compatibility
Due to the new AutoSD variants feature there is always one AutoSD variant (with scale 1) active.
If you want to open files created with the new AutoSD feature in older versions of TexturePacker, you have to open your .tps files in an editor and manually adapt the AutoSD variant:
Find
<key>autoSDSettings</key>
<array>
<struct type="AutoSDSettings">
...
</struct>
</array>
Remove everything inside the array tags if you don't want any AutoSD variant:
<key>autoSDSettings</key>
<array/>
Now you can Publish your sprites without AutoSD error.