Example scripts for exporting Spine skeletons with the version specified in the VERSION
variable. The script searches for Spine projects under the specified folder and if a JSON file with the extension .export.json
is found at the same level as the Spine project, the script uses it during export, otherwise it uses the default settings. The default export settings can be changed by opening the script and changing the DEFAULT_FORMAT
variable parameter.
This script allows you to export the Spine projects you want to export without having to specify each one, as long as they are collected under a specific folder. It is especially useful if you want to upgrade the version of the Spine Editor and you need to re-export all your existing Spine projects in that version.
A video demonstrating the use of the script is uploaded here:
YouTube: https://youtu.be/Vncyp2qtXaM?si=RiDg1iMrkRnT8Qa-
Although there is an example export script (https://github.com/EsotericSoftware/spine-runtimes/blob/4.1/examples/export/export.sh), this one requires add the project paths to be exported one by one to the script, so I thought it would be nice to have an example script that can automatically search for the export target and export settings JSON and export it. (I know this would not have been that difficult for people with programming knowledge, but I wanted to have something easy to use for beginners.)
This script requires jq to be installed. If you do not install it, you will get an error saying "Error: 'jq' is not installed. Please install 'jq' and retry".
'jq' is a lightweight and versatile command-line utility for processing and manipulating JSON data. It allows you to extract, filter, format, and transform JSON data in a variety of ways. jq' is often used for tasks such as selecting specific fields from JSON objects, searching and filtering JSON structures, and pretty-printing JSON content for easier human readability. It's a powerful tool for working with JSON data in scripts and command-line environments.
In this script, 'jq' is used to read the contents of JSON at the same level as the Spine project, determine whether or not the JSON is Spine's export settings JSON, and extract the output
or cleanUp
property specified in it.
Using chocolatey(windows package manager)
- Open command prompt.
- Install 'jq' by running the following command:
choco install jq
Withouht chocolatey
- Visit the official jq website: https://github.com/jqlang/jq/releases
- Scroll down to
Assets
. - Select the appropriate binary version for your system (e.g., 32-bit or 64-bit) to download
jq
. - Extract the 'jq.exe' executable from the downloaded archive.
- Place 'jq.exe' in a directory included in your system's PATH variable. (e.g. C:\bin)
- Open your Terminal.
- Install 'jq' by running the following command:
brew install jq
This will install 'jq' on your MacOS system using Homebrew. If you have not yet installed Homebrew, please follow this page to install it: https://brew.sh/ja/
Installing without Homebrew is quite complicated, so this is the recommended way.
<The bat script for Windows does not currently work well, so I do not have a description ready.>
Make the script executable:
In the Terminal, navigate to the directory where your script is located. Use the chmod +x
command to make your script executable. For example:
chmod +x <The path to the directory where this script is located>/spine_export.sh
This procedure is only required the first time and is not required the next time.
Run the script:
To run your script, drag and drop the spine_export.sh
into the Terminal window, then press Enter
.
The script will ask you to "Please enter the path to the directory containing the Spine projects you want to export", so enter the path of the target directory manually or by dragging and dropping the directory into the Terminal window and pressing Enter
.
Then, the export will be started.
This script was largely created using ChatGPT. This means that this script is also an example of how ChatGPT can be used to create such a script without being a mature programmer.