Texture Packer and Automator

Texture Packer has a command line tool, which means that you can run it as a shell script in Automator. This means that you can get sprites from the Automator and automatically build spritesheets using them.

Why would I want to do this? Why can’t i just use Texture Packer with all its lovely GUI?

Because well for me, I process the sprites first using Automator, before I pack them into spritesheets. Also this is a quick way to not set all the different Texture Packer settings each time (yes, I know you can use Save Defaults for settings).

But double-clicking on my Automator app, and then select my sprites, and wait for it (it’s actually pretty quick) to automagically spit out spritesheets is still faster (and it only requires like 2 to 3 clicks), and it even supports multipack (in case the sprites doesn’t fit in just one spritesheet)

This is my (partial) Automator workflow:

Screen Shot 2014-05-08 at 11.31.15 AM
Screen Shot 2014-05-08 at 11.31.45 AM

A big shout out and thank you to Andreas Lowe for replying to all questions on Twitter, and helping me whip out that Shell Script.

This Automator app requires the Pro version of Texture Packer as well.

That’s it!

 

Sorry for not posting anything since creating this new blog in January, that’s because I temporarily moved back home (hello, Manila).

Advertisements

Huh, who knew that you can batch rename files using Automator

I used to use the free este trial version of A Better Finder Rename 8, as good as it was, the free version only allows me to rename 10 items at a time.

So I went to look for other options and found out that Automator can do (well not everything, but enough) what A Better Finder Rename 8 does.

I added this sorter in between.

So there 🙂 Automator <3.

Mini Tutorial: How to batch convert image files to PVR (for iPhone app development)?

According to Unity3D’S manual, when developing for iOS

Use iOS native PVRT compression formats. They will not only decrease the size of your textures (resulting in faster load times and smaller memory footprint), but also can dramatically increase your rendering performance! Compressed texture requires only a fraction of memory bandwidth compared to full blown 32bit RGBA textures.

You can use Unity’s built in PVRTC compression, but according to @ToxicBlob

Not all PVRTC are created equal

http://www.toxicblob.com/files/Not_all_PVRTC_are_created_equal.php

Well, the Unity manual also suggested using PVRTexTool to create your PVRs. They have a GUI tool and a command line tool. (Please read ToxicBlob’s blog on how to install the tool).

Since, my artists gives me a lot of texture files, there’s no way that I’d do the conversion one by one using the GUI tool, so Mac’s Automator to the rescue! I love Mac’s Automator, it’s now my new best friend.

So I made an Automator Workflow:

The shell script:

for f
do
/Applications/PVRTexTool/PVRTexToolCL/MacOS_x86/PVRTexTool -fPVRTC4 -pvrtchighquality -yflip 1 -square -i”$f” -o”$f”
done

EDIT: I edited the previous script, adding “-o$”f”” so that the output file will be in the same folder as your input file.

Just add all your textures in the Get Specified Finder Items part and click Run!

And that’s it!