Cool, thanks for sharing! I think an export script is often application specified, especially when packing into a single atlas, but a script like this makes for a great place to start customizing.
It might be worth noting that this can work fine on Windows if Cygwin is installed. Personally I put the Cygwin bin dir on my Windows path, so I can access Cygwin stuff from a Windows command prompt. I dislike the Cygwin shell, as it often forces using Cygwin paths (the cygdrive
nonsense).
For your quote problem, I think you just need to use \"
(untested, and the forum wrecked the backticks):
spine_args="$spine_args -i \"$file\" -o \"`dirname $EXPORT_PATH/$file`\" -e \"$setting_file\""
FWIW, here's one of our bash scripts we used for the 4.0 blog post skeletons:
http://n4te.com/x/2183-QE7h.txt
It combines all the skeletons into a single JSON file for use with Spine Web Player. It also packs two atlases, one with a single project (surf
) and one with all the other projects (it does that by copying the images to a folder and packing them from there). The second atlas uses whitespace stripping with meshes, so it collects the project file paths and passes them when packing using -j
. This script expects the project files and images to be in a particular layout, eg:
project1/image1.png
project1/image2.png
project2/other1.png
project2/other2.png
project1.spine
project2.spine
All projects use .
for the images path, so attachment names use the project name as a suffix, eg project1/image2
. This layout allows a project to use any of the images from other projects, if needed, since they are being packed into the same atlas.