function updateMorphTargets(mesh, meshDef) {

  mesh.updateMorphTargets();

  if (meshDef.weights !== undefined) {

    for (var i = 0, il = meshDef.weights.length; i < il; i++) {

      mesh.morphTargetInfluences[i] = meshDef.weights[i];

    }

  }

  // .extras has user-defined data, so check that .extras.targetNames is an array.
  if (meshDef.extras && Array.isArray(meshDef.extras.targetNames)) {

    var targetNames = meshDef.extras.targetNames;

    if (mesh.morphTargetInfluences.length === targetNames.length) {

      mesh.morphTargetDictionary = {};

      for (var i = 0, il = targetNames.length; i < il; i++) {

        mesh.morphTargetDictionary[targetNames[i]] = i;

      }

    } else {

      console.warn('THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.');

    }

  }

}
@param {THREE.Mesh} mesh
@param {GLTF.Mesh} meshDef