Hi, after adjust skeleton (in spine-ts), can we export Json file from spine.Skeleton or convert spine.SkeletonData to Json? Thank you.
Export JSON file
- Изменено
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?
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.