update: it turns out this will invert the bones, so although it will look and animate correctly the bones will be in the wrong position. The fix is to work your way up the bone chain so that you know the orientation of each bone but I'm not willing to rewrite it right now.
Node script to flip a spine file horizontally. Only tested to the "works for me" stage.
Simply inverts all x coordinates and rotation/angle properties
The instructions alter files in place, so run on a backup.
- You'll need git, imagemagick and node.
- Clone this repository git clone https://github.com/MannyC/mirror_spine.git
- In repository directory: npm install
- Use Spine to export the json for the file you want to flip
- node spine_mirror.js spine_export_file.json > output_file_name.json
- To use imagemagick to flip png asset images in place (this will overwrite the original images; change from png as appropriate) *for i in $( ls .png); do convert -flop $i $i; done
- If you place the output json file in the same location as your original spine project file then spine should be able to find the now altered images
- Open a new project in Spine and import the output json file.