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;

  var bones = this.bones;
  var boneInverses = this.boneInverses;

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

    var boneInverse = boneInverses[i];
    data["boneInverses"].add(boneInverse.toJSON());
  }

  return data;
}