SkinnedMesh / Animation Support in toJSON() export

Was trying to understand support issues for Skinned Animation in toJSON(),

  1. SkinnedMesh just a mesh with additional skeleton (array of bones) binded to it
    We just need to export this in SkinnedMesh.toJSON()?
  2. Buffered geometry is already set to export bone indices and weight?
  3. Bone is again just a bone in all its entirety could just have been an object3d, if no one is finicky abt it, just as target of TargetLight is
  4. Are there other Animation like morphs which are an issue in toJSON() and ObjectLoader?

When I recall correctly, one open issue is the fact that bones can be positioned in the scene graph at arbitrary places. They are not necessarily children of the skinned mesh which makes it impossible to export it in an isolated fashion.

BufferGeometry can export all kinds of attributes meaning skin indices and weights are supported, too.

Not sure why you mean here. Yes, bones are just special 3d objects. The problem is not their properties but their location in the scene graph.

Animations can’t be exported, yet see (Would like animations on models imported in the editor included on scene export · Issue #11642 · mrdoob/three.js · GitHub). One reason for this is the fact that there is no dedicated location where animations should be stored (e.g. Object3D.animations). Hence, toJSON() does not know where to look for animation clips and thus can’t serialize them.

so we have an option:

  1. While Importing
    We set the skeleton as a second pass, after the whole scene is set with bones in proper hierarchey

  2. While Exporting
    Just use uuid of the bones for the skeleton ( the skeleton is just an array of uuids when exported in toJSON() )

I can try this and let you know if its ok !

I tried, and it seems to be working …