parseDeformers method

Map parseDeformers()

Implementation

Map parseDeformers() {
  Map skeletons = {};
  Map morphTargets = {};

  if (fbxTree.Objects["Deformer"] != null) {
    var DeformerNodes = fbxTree.Objects["Deformer"];

    for (var nodeID in DeformerNodes.keys) {
      Map deformerNode = DeformerNodes[nodeID];

      var relationships = connections[parseInt(nodeID)];

      if (deformerNode["attrType"] == 'Skin') {
        var skeleton = this.parseSkeleton(relationships, DeformerNodes);
        skeleton["ID"] = nodeID;

        if (relationships["parents"].length > 1)
          print(
              'THREE.FBXLoader: skeleton attached to more than one geometry is not supported.');
        skeleton["geometryID"] = relationships["parents"][0]["ID"];

        skeletons[nodeID] = skeleton;
      } else if (deformerNode["attrType"] == 'BlendShape') {
        Map<String, dynamic> morphTarget = {
          "id": nodeID,
        };

        morphTarget["rawTargets"] =
            this.parseMorphTargets(relationships, DeformerNodes);
        morphTarget["id"] = nodeID;

        if (relationships["parents"].length > 1)
          print(
              'THREE.FBXLoader: morph target attached to more than one geometry is not supported.');

        morphTargets[nodeID] = morphTarget;
      }
    }
  }

  return {
    "skeletons": skeletons,
    "morphTargets": morphTargets,
  };
}