parse method

dynamic parse(
  1. dynamic onLoad,
  2. dynamic onError
)

Implementation

parse(onLoad, onError) async {
  var parser = this;
  var json = this.json;
  var extensions = this.extensions;

  // Clear the loader cache
  this.cache.removeAll();

  // Mark the special nodes/meshes in json for efficient parse
  this._invokeAll((ext) {
    return ext._markDefs != null && ext._markDefs() != null;
  });

  final _scenes = await this.getDependencies('scene');
  final _animations = await this.getDependencies('animation');
  final _cameras = await this.getDependencies('camera');

  var result = {
    "scene": _scenes[json["scene"] ?? 0],
    "scenes": _scenes,
    "animations": _animations,
    "cameras": _cameras,
    "asset": json["asset"],
    "parser": parser,
    "userData": {}
  };

  addUnknownExtensionsToUserData(extensions, result, json);

  assignExtrasToUserData(result, json);

  onLoad(result);
}