fromJson method

Skeleton fromJson(
  1. Map<String, dynamic> json,
  2. Map<String, Bone?> bones
)

Implementation

Skeleton fromJson(Map<String,dynamic> json, Map<String,Bone?> bones) {
  uuid = json['uuid'];

  for (int i = 0, l = json['bones'].length; i < l; i++) {
    final uuid = json['bones'][i];
    Bone? bone = bones[uuid];

    if (bone == null) {
      console.warning('Skeleton: No bone found with UUID: $uuid');
      bone = Bone();
    }

    this.bones.add(bone);
    boneInverses.add(Matrix4.identity()..copyFromArray(json['boneInverses'][i]));
  }

  init();

  return this;
}