toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  Map<String, dynamic> data = {
    "metadata": {
      "version": 4.5,
      "type": 'Skeleton',
      "generator": 'Skeleton.toJson'
    },
    "bones": [],
    "boneInverses": []
  };

  data["uuid"] = uuid;

  final bones = this.bones;
  final boneInverses = this.boneInverses;

  for (int i = 0, l = bones.length; i < l; i++) {
    final bone = bones[i];
    data["bones"].add(bone.uuid);

    final boneInverse = boneInverses[i];
    data["boneInverses"].add(boneInverse.storage.toList());
  }

  return data;
}