parseMorphTargets method

dynamic parseMorphTargets(
  1. dynamic relationships,
  2. dynamic deformerNodes
)

Implementation

parseMorphTargets(relationships, deformerNodes) {
  var rawMorphTargets = [];

  for (var i = 0; i < relationships.children.length; i++) {
    var child = relationships.children[i];

    var morphTargetNode = deformerNodes[child["ID"]];

    var rawMorphTarget = {
      "name": morphTargetNode.attrName,
      "initialWeight": morphTargetNode.DeformPercent,
      "id": morphTargetNode.id,
      "fullWeights": morphTargetNode.FullWeights.a
    };

    if (morphTargetNode.attrType != 'BlendShapeChannel') return;

    rawMorphTarget["geoID"] =
        connections[parseInt(child["ID"])].children.filter((child) {
      return child.relationship == null;
    })[0].ID;

    rawMorphTargets.add(rawMorphTarget);
  }

  return rawMorphTargets;
}