Aliases in atlas exported via TexturePacker

Aliases in atlas exported via TexturePacker

When I pack identical sprite frames in one atlas file in TexturePacker, I could see they are aliased with a ‘stack’ icon, and I can observe the sprites do packed together without duplication. However when I look into the atlas file (the .plist exported), each of them has its own sprite frame data, in which an empty alias array exists. I also find cocos2dx’s source code (CCSpriteFrameCache.cpp) has already handled this array, so my question is, how could I export an atlas file with the alias arrays not being empty?


You can’t. The reason is that TexturePacker also detects aliases with different transparency / trimming and these can’t be represented in the array.

Thank you. So in what cases would the aliases array have contents?

Never if you use TexturePacker for packing. TexturePacker writes the empty array to prevent issues if a sprite sheet parser relies on the feature to be present in the file.
Writing the full sprite information instead of just filling the array as the same effect and does not effect the performance. It might require some more bytes in the file but since we are talking of kilo or even megabytes of graphics data it really does not matter.

Thank you so much for your explanation.