parseModels method

dynamic parseModels(
  1. dynamic skeletons,
  2. dynamic geometryMap,
  3. dynamic materialMap
)

Implementation

parseModels(skeletons, geometryMap, materialMap) {
  var modelMap = {};
  var modelNodes = fbxTree.objects["Model"];

  for (var nodeID in modelNodes.keys) {
    var id = parseInt(nodeID);
    var node = modelNodes[nodeID];
    var relationships = connections[id];

    var model = buildSkeleton(relationships, skeletons, id, node["attrName"]);

    if (model == null) {
      switch (node["attrType"]) {
        case 'Camera':
          model = createCamera(relationships);
          break;
        case 'Light':
          model = createLight(relationships);
          break;
        case 'Mesh':
          model = createMesh(relationships, geometryMap, materialMap);
          break;
        case 'NurbsCurve':
          model = createCurve(relationships, geometryMap);
          break;
        case 'LimbNode':
        case 'Root':
          model = Bone();
          break;
        case 'Null':
        default:
          model = Group();
          break;
      }

      model.name = node["attrName"] != null ? PropertyBinding.sanitizeNodeName(node["attrName"]) : '';

      model.id = id;
    }

    getTransformData(model, node);
    modelMap[id] = model;
  }

  return modelMap;
}