- Editado
Use a different images path when exporting from command line
Hi there!
I have hundreds of spine project files (the .spine files) with missing images. I do, however, have the atlas files that were generated when we exported them in the past.
Now I am trying to generate png sequences of all the animations and since I don't have the original images from the spine project, I need to somehow recreate them using the atlas files I already have and then export the project as a png sequence. I know we can use the Texture unpacker to generate the images again. But my issue is that the spine project internally has a path set for where to look for images but when I unpack using the unpacker, it is a different folder name.
Since I have hundreds of spine project files, I am wondering if there is a way to tell the command line exporter to use a different image path from what was specified in the project file. So if a project specifies 'project-files/' as the path to images and the texture is unpacked in 'images/', then I should be able to somehow use the 'images' folder for the image paths.
Basically, I just need to do the following using a batch script:
- Unpack existing atlas
- Export spine project as PNG sequence with the files from step 1
You helped us in a previous thread too, and we are thankful for any assistance you can provide.
You can use the CLI to unpack many atlases to their images. Can you just unpack those images to the right place? Eg, if every Spine project uses an images
subfolder relative to the Spine project, then unpack (or move) the PNG files to that location.
If each Spine project has a different images path, then that isn't great. Maybe you could export all the projects to JSON, then edit (or write a tool to edit) the JSON files so they have a consistent images path. We don't yet have importing JSON/binary into a Spine project (issue is here), but we plan to have that done soon. You can however specify a JSON or binary file instead of a Spine project file when doing a CLI export. Eg, instead of specifying a .spine
project file:
Spine
---
input /path/to/skeleton.spine
---
output /path/to/output/
---
export /path/to/export.json
You can specify a JSON or binary data file:
Spine
---
input /path/to/skeleton.json
---
output /path/to/output/
---
export /path/to/export.json
Hey Nate!
Thank you for your reply!
You can use the CLI to unpack many atlases to their images. Can you just unpack those images to the right place? Eg, if every Spine project uses an images subfolder relative to the Spine project, then unpack (or move) the PNG files to that location.
If this was the case, it would have been so easy! But unfortunately, the way our artists made them were with different folders names for each project.
I like your idea of using the json/binary files as input instead, but the project files I have were done in Spine 3.2.01 . Every time I use the json file (made with Spine 3.2.01) as input in CLI, I get this error saying 'Not a valid project file'. One of the ways will be to update all the hundreds of projects but that too will be resource intensive (as it seems there are quite a few changes we will need to do to update a project to latest spine).
The best way could be if I could modify a spine file in some way through command line so it points to another image path. I am not sure how hard or easy that will be.
In any case, thank you so much for your assistance again.
Modifying the .spine file isn't really possible. The format is complex and will only make sense to the editor.
Unfortunately the 3.2.01 CLI won't accept a JSON file as input, that was added in 3.5.00-beta. You said you need to export png sequences, so there should be no problem using the latest Spine, right?
Otherwise you could try using the latest (3.6.52 or even the latest beta) to export to JSON, then try importing the JSON into 3.2.01. That probably won't work, but you might be able to use JsonRollback or otherwise massage the JSON data so 3.2.01 will accept it.