dinhhai

Hi, after adjust skeleton (in spine-ts), can we export Json file from spine.Skeleton or convert spine.SkeletonData to Json? Thank you.
Nemaš dopuštenje za pregledavanje privit(a)ka dodan(og)ih postu.
dinhhai
  • Postovi: 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?
Avatar
Mario

Mario
  • Postovi: 2827

dinhhai

Mario je napisao/la: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
  • Postovi: 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.
Avatar
Mario

Mario
  • Postovi: 2827

dinhhai

Cool. Thank you @Mario
dinhhai
  • Postovi: 4


Natrag na Runtimes