dinhhai

Hi, after adjust skeleton (in spine-ts), can we export Json file from spine.Skeleton or convert spine.SkeletonData to Json? Thank you.
Bu mesaja eklenen dosyaları görüntülemek için gerekli yetkilere sahip değilsiniz.
dinhhai
  • Mesajlar: 4

Mario

No, that is not possible I'm afraid and we have no plans to add this functionality. What are you trying to achieve? What is your use case?
Kullanıcı avatarı
Mario

Mario
  • Mesajlar: 2968

dinhhai

Mario yazdı:No, that is not possible I'm afraid and we have no plans to add this functionality. What are you trying to achieve? What is your use case?
Hi @Mario, I adjusted bones and changed skins, I want to keep current pose by saving JSON for each pose.
dinhhai
  • Mesajlar: 4

Mario

If you are using AnimationState, there's no reason tomsave out the poses. See our dress-up example here:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-ts/spine-webgl/example/dress-up.html#L112

If you programmatically modify one or more bones, you can simply save their transform:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-ts/spine-core/src/Bone.ts#L53

You can iterate all bones in the skeleton via skeleton.bones and save out their transforms (which are just properties) via Object.assign() to temporary objects:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign

Once you are done modifying the skeleton, i.e. skin changes and set to setup pose, you can apply the AnimationState and the saved transforms again.
Kullanıcı avatarı
Mario

Mario
  • Mesajlar: 2968

dinhhai

Cool. Thank you @Mario
dinhhai
  • Mesajlar: 4


Dön Runtimes