• Bugs
  • Inconsistent Origin when importing image Json with scaling

Hello,

Spine 3.8.99
When I import images in Spine after exporting them from photoshop and I scale them at import, their origin end up wrong. If I don't scale them down, their origin is fine.

Repro steps:

  • In photoshop: change the origin of your file
  • In photoshop: Export your images from photoshop with the Spine Script
  • In Spine: Import Data -> Json, change the scale to 0.25 for exemple
  • In Spine: observe that the origin is inconsistent with the one set in Photoshop
Related Discussions
...

When you set the scale at Data Import, it scales only the skeleton data (position of bones, attachments, etc). When using this setting, it's usually because you have images that are a different size. For example, your images are 25% the size of the skeleton in the skeleton data, so you use Import Data with 25% scale so your images and skeleton data match.

When you export from Photoshop, the size of the images and skeleton data match. If you then use a scale != 1 during Import Data the skeleton data will be the wrong size.

My guess is what you want is to set a scale when you export from Photoshop, in the PhotoshopToSpine script's settings dialog. For example, if you set a scale of 25% there, then the images are scaled down 25% from what is in the PSD and the skeleton data is also scaled down 25%. You would then use Import Data and specify a scale of 1 (which is 100%).

Ok, I have to say that I'm a bit confused. I guess I understand that it is not a bug but a mismatch with the information provided to Spine. It's more of a user issue.

Please correct me if I understood wrong.
Here is the intent: I want to work with tinier images in Spine, but at the end, I want to export the project with image at their full size.
Here is what I would do now according to what I understood:

In photoshop : I export images and json at scale 1, to get the correct skeleton size.
In photoshop : I export again but at scale 0.25 to get image downsized
In the explorer : I overwrite my scale 1 images by my 0.25 images : So now I have a scale 1 skeleton, and scale 0.25 images
In spine : I do Data Import with 25% so my images and skeleton data match

Would it be the right procedure? And now, how would I manage to export my images with their right size(resolution)?

FeedMyData escribió

Would it be the right procedure?

It would work, but is unnecessarily complicated.

The size you have images in Spine does not need to match the size at runtime


at runtime the images can be larger or smaller. Export from Photoshop at the size you want to use in Spine. Then export at the size you want to use at runtime and pack those into a texture atlas.

I suggest:

1) Export from Photoshop using a scale of 25%. Import that skeleton JSON data into Spine using an Import Data scale of 1 for use with the 25% scaled images.

2) Export from Photoshop using a scale of 100% and uncheck exporting skeleton JSON data (or discard the JSON file it creates). Pack these 100% images into a texture atlas and use them at runtime. Specify a scale of 4 at runtime so the 25% scaled skeleton data is scaled to 100% to match the images.

You can repeat step 2 with any size(s). Some apps use multiple texture atlases at different scales and choose the best one based on the user's screen resolution.

I discovered that we could feed the spine texture packer with any windows folder. I was unaware of this possibility. Your solution is for sure simpler. Thanks Nate.