• Bugs
  • Import data images placed wrong

When I import my json file to Spine, all the different layers is placed wrongly and not in the correct place as they are in my original illustrator file. Has anyone had the same issue before?

My script export (IllustratorToSpine) and data import seems to be done correctly.

Related Discussions
...
  • Изменено

Hey MariaThy. I tried to export a few projects from Illustrator and I didn't have any problems. What is the version of Illustrator you are using? You can send us your Illustrator file so we can test it out and try to find a problem.

Hello,
the script seems to be working fine for us, could you please send us the problematic AI file and exported Spine project at contact@esotericsoftware.com to check?

4 месяца спустя

I am also having similar issues. Some layers are correctly placed, but layers that use clipping groups or blur effects are not placed correctly. I am not really familiar with illustrator scripting, but I looked at the script, and to me it looks like the script is checking the position, height, and width of the vector layer in the "parselayer" function and using that to determine the position. THis creates a problem because If you use certain illustrator features such as clip groups The rasterized artwork may not have the same size as the vector art and therefore the positions may get messed up.

I suspected this might be the problem, so I tried to correct the positioning by creating a bounding box in the form of an empty (invisible) rectangle in problematic layers that was big enough to cover any data that is unseen in the blend effect or clip group. This gives me correct positions, but it is wasteful because the images now have a lot of wasted space.

I believe that modifying the script to include a rasterization step in the parselayer function to rasterize each layer before parsing the position would fix the position issue, but I am not sure.

Also, positioning in spine is also incorrect if the user choses anything other than 100% scale (the 100% scale positions are used, the positions should also be scaled)

Thanks @alexatwork, your research sounds accurate. I don't know when we'll be able to update the script to rasterize as you described.

Note that bringing images with a lot of whitespace into Spine may not be a problem if you use whitespace stripping when packing your texture atlas. Given that, your workaround isn't too bad. Some users use full frame images for every attachment. Spine is pretty smart about choosing the image you care about as you mouse over attachments.

Alternatively, is it possible to bring the AI file into Photoshop where you can use the PhotoshopToSpine script? That supports tags in layer names, which can be very helpful.

Good hint about the whitespace stripping, thanks! although I am not sure what our pipeline allows atm.

I actually went ahead and hacked a little workaround in the parselayer function. I realized rasterize probably won't work super easily, because I checked and I think you still need to define a the size of the area you want to rasterize in the script, and you are back to the same problem of the png exporter and the rasterization not necessarily using the same dimensions. What i wound up doing was simply adding a check for a sublayer called "bounds" and use that for the dimensions instead if it exists. that way I could ensure that the exported png and the dimensions used to generate the json were identical without adding tons of extra space. by simply adding an empty rectangle with the desired dimensions called "bounds", I could get it all to work as desired.