• Editor
  • How to convert UIAtlas.sprite to spine readable atlas?

I have an atlas with HTML 5 game, which is inside JSON. It contains padding values. If I just move the values to the Spine atlas file, the sprite is sliced correctly, but the sequence is not correct, because each frame is slightly offset from the center, there is a shaking effect. I assume this is because I did not take into account the padding value when transferring to a regular Atlas.
These are my inputs:

"Element_1": {
  "x": 871,
  "y": 363,
  "width": 265,
  "height": 271,
  "paddingLeft": 81,
  "paddingTop": 77,
  "paddingRight": 104,
  "paddingBottom": 102
},

Normal Atlas includes the following parameters:

Element_1
rotate: False
  xy: 871, 363
  size: 265, 271
  orig: 265, 271
  offset: 0, 0
  index: -1

But i dont understand, how padding must to impact on spine atlas data? I would be grateful for your help

Related Discussions
...

Where does the UIAtlas.sprite data come from? It's impossible for us to tell what the padding values in that format mean, which makes it impossible to tell how they map onto the Spine atlas format.

Our format is documented here:
http://en.esotericsoftware.com/spine-atlas-format

  • StiF оценил это.
  • Изменено
all.json
3MB

I understand this is Unity.
Thank you for the answer! I tried to add the pad parameter after the "index" parameter, but Spine gives the error that it cannot read the Atlas file.

  • Harald ответили на это сообщение.

    StiF I understand this is Unity.

    I'm afraid I don't understand this sentence. Do you mean that you are using Unity? The all.json file
    does not look like a .spriteatlas file which can be created by the Unity Editor.

    StiF I tried to add the pad parameter after the "index" parameter, but Spine gives the error that it cannot read the Atlas file.

    Likely you don't want to use pad since this would specify padding for ninepatch-sprites. See the offsets: parameter in the documentation instead, which offsets for whitespace (whitespace-padding).

    • StiF ответили на это сообщение.
    • StiF оценил это.

      Harald I'm afraid I don't understand this sentence. Do you mean that you are using Unity? The all.json file
      does not look like a .spriteatlas file which can be created by the Unity Editor.

      I just found the line "UnityEngine.AnimationCurve" and I thought it might have something to do with Unity.

      Harald Likely you don't want to use pad since this would specify padding for ninepatch-sprites. See the offsets: parameter in the documentation instead, which offsets for whitespace (whitespace-padding).

      I would like to use PAD but Spine doesn't read the file when I add this parameter, without the pad parameter the file is read and Spine unpacks the sprite. I tried using offsets, but for some reason it only works when I artificially increase the "orig" parameter, otherwise I don't see any change by changing the offsets parameter.

      • Harald ответили на это сообщение.
        • Изменено

        StiF I tried using offsets, but for some reason it only works when I artificially increase the "orig" parameter, otherwise I don't see any change by changing the offsets parameter.

        [Edit]
        The orig: and size: parameters are the old atlas format (which is still supported by spine 4.1 runtimes). If you want to use the new atlas format instead (as described in the documentation page), please use bounds: instead of both orig: and size:.

        Regarding your issue: When specifying the old atlas format parameters, you also need to adjust orig: accordingly. orig specifies the original attachment image size before whitespace stripping has removed whitespace around it, reducing it to the width and height given in bounds. So for example you have an original attachment image of orig: size 100, 100 px, then whitespace stripping removes 10px at top, bottom, left and right, resulting in offset: 10, 10 and bounds:

        • StiF ответили на это сообщение.
        • StiF оценил это.

          Harald
          I am using spine 3.8.75. The problem is that Offset only has two values, 1 - how many pixels to remove from the left edge, and 2 - how many pixels to remove from the bottom edge, right? And I have 4 padding parameters.
          So, should I try switching to bounds instead of the two parameters Size and Orig and try editing offset?
          I also found this, maybe this is the decoding of the offset parameters, how can I calculate them

          offsetRight = originalWidth - offsetLeft
          offsetTop = originalHeight - packedHeight - offsetBottom

          Thank you so much for the help!
          I've been trying to solve this problem for almost a week and still can't find the answer. Sorry if I'm asking silly questions, I don't know how to work in Spine and this is my first experience with it.

          • Harald ответили на это сообщение.

            StiF I am using spine 3.8.75.

            Please upgrade to the latest 3.8 Spine Editor version, 3.8.75 has known issues.

            If this is your first experience using Spine, why are you using Spine 3.8? We highly recommend using the latest 4.1 version.

            • StiF ответили на это сообщение.

              Harald why are you using Spine 3.8

              I use this version because all the skeletons to work are created in this version and if I try a new one, I get the error that I need the exact version in which this skeleton was created.

              Sorry, you will need to at least use the 3.8.99 editor. It would be much better to use 4.1, all your skeletons will still work and we've fixed thousands of bugs in the editor and runtimes since 3.8.

              • StiF оценил это.
              Nate закрыл(а) дискуссию .