Arzola

Good day,

I recently made a custom tool to export my spine projects with, as I wanted to easily export different types of maps (normal, emission, etc.) for the same spine project.

My Spine image folders always follow this structure:
Images
|--- Color (These are the only files the spine project uses)
|--- Normals (Unused by spine, but has normal images with the same structure and same dimensioned images like on the Color folder)
|--- Mask (Similar to Normals)
|--- etc.
So the short version of what my tool does, is that it removes all pack.json files within my spine images folders and subfolders, and then adds pack.json files as needed, and runs the cmd version of Spine to pack the "Images" folder.

This way, with custom suffixes and other packer settings, I end up with images such as "face.png", "face_normals.png", and so on. And on that regard, it works as expected:

However, I ran into the issue that the files on the NON "Color" folder, are added a number suffix so as to not to overwrite an existing image of the same name. A short example with a test project:

If I run my tool once, this is the whole export:
Results A.png

Now for the sake of making it obvious, I'll set my tool to ignore adding some folders.
This would be a second run with the new configuration:
Results B.png

As you can see, face.png (the image that is generated with the pack.json on the root of "Images", attached below), overwrites its old file appropriately, while the rest keep making new files.

Did I mess up on my setup? Or am I supposed to do run the command for each main subfolder (Normals, Masks, etc.) or something?

This is the pack.json I used on the root of "Images":
pack.json

On the main subfolders (normals, etc.) I just added a pack.json with:
{"combineSubdirectories":true,"scaleSuffix":["_normals"]}
And there are some ignored folders here and there that just have:
{"ignore":true}
Bu mesaja eklenen dosyaları görüntülemek için gerekli yetkilere sahip değilsiniz.
Arzola
  • Mesajlar: 15

Nate

Interesting tool!

What version of Spine are you using?

Spine should use the packer settings to determine the files names for the images that will be output, delete all of those images, and then do the packing. If it doesn't AND you are using the latest 4.0 or 4.1-beta version, then it sounds like a bug. In that case, if you can provide the images and CLI commands that we can run to see the problem, we'd be happy to fix it!
Kullanıcı avatarı
Nate

Nate
  • Mesajlar: 11802

Arzola

Nate yazdı:What version of Spine are you using?
I updated spine a few days ago, so it should be 4, I can share the specific version later.
Nate yazdı:delete all of those images, and then do the packing
The thing is, it does work if I delete the images manually. But how can I tell which images were from a previous export logically? Or well, are projects that need multiple atlases to fit it all named predictibly?

I use a custom shader that aside from making use of normals, etc, uses some extra images that don't need to be packed (I don't need them to match the spine atlas). So to keep it all organized, I keep those images and the exports on the same folder.
So for the sake of backwards compatibility with what I already exported, I can't just delete all images on the output folder, would be the same case if for whatever reason I decide to pool many spine exports on the same output directory.

So while I have the base name I specify for the export, and the suffixes I'll have, I'd need to know the potential altas sufixes as well (or any other variation that can happen on export), to know the potential names to regex what to delete.

Also piggy backing a bit, but I forgot to include this on the main post. Is there a way to pick a color for transparent pixels when exporting as jpg when packing like this? Let's say I wanted the normal export to have a "normal neutral purple" background, without having to second pass the image.
Arzola
  • Mesajlar: 15

Nate

Arzola yazdı:I can't just delete all images on the output folder
Spine should delete the images. If it doesn't, it's a bug. We'd like to reproduce it so we can fix it.
Arzola yazdı: Is there a way to pick a color for transparent pixels when exporting as jpg
There isn't, sorry. It's pretty rare that anyone uses JPEG, or if they do the input images are PSD. It would be reasonable for us to add though.
Kullanıcı avatarı
Nate

Nate
  • Mesajlar: 11802

Arzola

Alright.

This is my spine version:
Version.png

This is the images folder with the pack.json files included:
images.zip

As for the commands used, I'll leave my code. Hopefully it's clear enough:
// Export Animations
ExecuteSpineCommand($"-i \"{ProjectSettings.SpineProjectPath}\" -o \"{ProjectSettings.OutputFolderPath}\" -e json");
// Pack Images
ExecuteSpineCommand($"-i \"{ProjectSettings.RootImagesFolderPath}\" -o \"{ProjectSettings.OutputFolderPath}\" -p {Path.GetFileNameWithoutExtension(ProjectSettings.SpineProjectPath)}");


---

Were you able to reproduce it?
Bu mesaja eklenen dosyaları görüntülemek için gerekli yetkilere sahip değilsiniz.
Arzola
  • Mesajlar: 15

Nate

Sorry for the delay!

The commands you showed aren't enough to reproduce it. They can't be run directly, so I have to guess at what you are doing. This is what I tried, in the spineboy example project folder:
spine -u 4.0.xx -i spineboy-pro.spine -o export -e json
spine -u 4.0.xx -i images -o export -p spineboy
spine -u 4.0.xx -i images -o export -p spineboy
spine -u 4.0.xx -i images -o export -p spineboy
When I ran the third command, the existing spineboy.png and spineboy.atlas files were deleted and recreated. There were no extra files after the second or third packing.

Can you provide commands I can run on an example project that show the problem? Or if it happens only with your specific project, can you please provide the project file, images, and commands I need to run to see the problem? You can email them if you'd rather they not be public. contact@esotericsoftware.com

Note you can perform multiple actions with one invocation of Spine. The above would become:
spine -u 4.0.xx -i spineboy-pro.spine -o export -e json -i images -o export -p spineboy -i images -o export -p spineboy -i images -o export -p spineboy
Kullanıcı avatarı
Nate

Nate
  • Mesajlar: 11802

Arzola

My previous post has an example project, it's just the images, since it's just the packing what's failing.

I'll try to illustrate the command as if the folder named "Images" within the zip on the previous post was inside the folder ROOT/.

The command would become:
spine -i "ROOT/Images" -o "MyCustomOutputFolder" -p face
So essentially, from your example list of commands, it should be the same as the last three.

I think the difference relies on my particular structure of pack.json files (all included in the zip). The issue might stem from there.

---

Was that enough?
Arzola
  • Mesajlar: 15

Nate

Arzola yazdı:Was that enough?
Sorry, I don't think so.
Arzola yazdı:So essentially, from your example list of commands, it should be the same as the last three.
I agree, it seems you are doing the same as my last three commands. However, I don't see the problem when I do that.

We can't work on a fix until we can reproduce the problem. This is why I asked for commands we can run on an example project, like spineboy, or commands we can run on your project, which you can post or email to us.
Kullanıcı avatarı
Nate

Nate
  • Mesajlar: 11802


Dön Editor