updateMorphTargets method

void updateMorphTargets()

Updates the morphTargets to have no influence on the object. Resets the morphTargetInfluences and morphTargetDictionary properties.

Implementation

void updateMorphTargets() {
  final geometry = this.geometry;

  if (geometry is BufferGeometry) {
    final morphAttributes = geometry.morphAttributes;
    final keys = morphAttributes.keys.toList();

    if (keys.isNotEmpty) {
      final morphAttribute = morphAttributes[keys[0]];

      if (morphAttribute != null) {
        morphTargetInfluences = [];
        morphTargetDictionary = {};

        for (int m = 0, ml = morphAttribute.length; m < ml; m++) {
          final name = morphAttribute[m].name ?? m.toString();

          morphTargetInfluences.add(0);
          morphTargetDictionary![name] = m;
        }
      }
    }
  }
  // else {
  //   final morphTargets = geometry.morphTargets;

  //   if (morphTargets != null && morphTargets.length > 0) {
  //     print(
  //         'THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.');
  //   }
  // }
}