New AutoSD features

2013-12-11 Kerstin Müller

What you are going to learn:


TexturePacker's Multipack and AutoSD features create multiple output files during a Publish:

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:

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      \

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:

  • sheet-ipadhd1.png
  • sheet-ipadhd1.plist
  • sheet-hd1.png
  • sheet-hd1.plist
  • sheet1.png
  • sheet1.plist
  • sheet-ipadhd2.png
  • sheet-ipadhd2.plist
  • sheet-hd2.png
  • sheet-hd2.plist
  • sheet2.png
  • sheet2.plist
sample AutoSD settings with placeholders

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                   \

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:


    <struct type="AutoSDSettings">

Remove everything inside the array tags if you don't want any AutoSD variant:


Now you can Publish your sprites without AutoSD error.

Did you like the tutorial? Please share!