@onerjs/serializers 8.23.8 → 8.23.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,11 +17,11 @@ var _TangentType;
17
17
  /**
18
18
  * Specifies that input tangents are used.
19
19
  */
20
- _TangentType[(_TangentType["INTANGENT"] = 0)] = "INTANGENT";
20
+ _TangentType[_TangentType["INTANGENT"] = 0] = "INTANGENT";
21
21
  /**
22
22
  * Specifies that output tangents are used.
23
23
  */
24
- _TangentType[(_TangentType["OUTTANGENT"] = 1)] = "OUTTANGENT";
24
+ _TangentType[_TangentType["OUTTANGENT"] = 1] = "OUTTANGENT";
25
25
  })(_TangentType || (_TangentType = {}));
26
26
  /**
27
27
  * @internal
@@ -56,38 +56,17 @@ export class _GLTFAnimation {
56
56
  const interpolation = interpolationOrBake.interpolationType;
57
57
  const shouldBakeAnimation = interpolationOrBake.shouldBakeAnimation;
58
58
  if (shouldBakeAnimation) {
59
- _GLTFAnimation._CreateBakedAnimation(
60
- babylonTransformNode,
61
- animation,
62
- animationChannelTargetPath,
63
- minMaxKeyFrames.min,
64
- minMaxKeyFrames.max,
65
- animation.framePerSecond,
66
- animationSampleRate,
67
- inputs,
68
- outputs,
69
- minMaxKeyFrames,
70
- useQuaternion
71
- );
72
- } else {
59
+ _GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, useQuaternion);
60
+ }
61
+ else {
73
62
  if (interpolation === "LINEAR" /* AnimationSamplerInterpolation.LINEAR */ || interpolation === "STEP" /* AnimationSamplerInterpolation.STEP */) {
74
63
  _GLTFAnimation._CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion);
75
- } else if (interpolation === "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */) {
64
+ }
65
+ else if (interpolation === "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */) {
76
66
  _GLTFAnimation._CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion);
77
- } else {
78
- _GLTFAnimation._CreateBakedAnimation(
79
- babylonTransformNode,
80
- animation,
81
- animationChannelTargetPath,
82
- minMaxKeyFrames.min,
83
- minMaxKeyFrames.max,
84
- animation.framePerSecond,
85
- animationSampleRate,
86
- inputs,
87
- outputs,
88
- minMaxKeyFrames,
89
- useQuaternion
90
- );
67
+ }
68
+ else {
69
+ _GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, useQuaternion);
91
70
  }
92
71
  }
93
72
  if (inputs.length && outputs.length) {
@@ -105,7 +84,7 @@ export class _GLTFAnimation {
105
84
  }
106
85
  static _DeduceAnimationInfo(animation) {
107
86
  let animationChannelTargetPath = null;
108
- let dataAccessorType = "VEC3"; /* AccessorType.VEC3 */
87
+ let dataAccessorType = "VEC3" /* AccessorType.VEC3 */;
109
88
  let useQuaternion = false;
110
89
  const property = animation.targetProperty.split(".");
111
90
  switch (property[0]) {
@@ -139,7 +118,8 @@ export class _GLTFAnimation {
139
118
  }
140
119
  if (animationChannelTargetPath) {
141
120
  return { animationChannelTargetPath: animationChannelTargetPath, dataAccessorType: dataAccessorType, useQuaternion: useQuaternion };
142
- } else {
121
+ }
122
+ else {
143
123
  Tools.Error("animation channel target path and data accessor type could be deduced");
144
124
  }
145
125
  return null;
@@ -157,19 +137,7 @@ export class _GLTFAnimation {
157
137
  * @param accessors
158
138
  * @param animationSampleRate
159
139
  */
160
- static _CreateNodeAnimationFromNodeAnimations(
161
- babylonNode,
162
- runtimeGLTFAnimation,
163
- idleGLTFAnimations,
164
- nodeMap,
165
- nodes,
166
- bufferManager,
167
- bufferViews,
168
- accessors,
169
- animationSampleRate,
170
- useRightHanded,
171
- shouldExportAnimation
172
- ) {
140
+ static _CreateNodeAnimationFromNodeAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, bufferManager, bufferViews, accessors, animationSampleRate, useRightHanded, shouldExportAnimation) {
173
141
  let glTFAnimation;
174
142
  if (_GLTFAnimation._IsTransformable(babylonNode)) {
175
143
  if (babylonNode.animations) {
@@ -184,21 +152,7 @@ export class _GLTFAnimation {
184
152
  samplers: [],
185
153
  channels: [],
186
154
  };
187
- _GLTFAnimation._AddAnimation(
188
- `${animation.name}`,
189
- animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation,
190
- babylonNode,
191
- animation,
192
- animationInfo.dataAccessorType,
193
- animationInfo.animationChannelTargetPath,
194
- nodeMap,
195
- bufferManager,
196
- bufferViews,
197
- accessors,
198
- animationInfo.useQuaternion,
199
- animationSampleRate,
200
- useRightHanded
201
- );
155
+ _GLTFAnimation._AddAnimation(`${animation.name}`, animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, bufferManager, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate, useRightHanded);
202
156
  if (glTFAnimation.samplers.length && glTFAnimation.channels.length) {
203
157
  idleGLTFAnimations.push(glTFAnimation);
204
158
  }
@@ -220,19 +174,7 @@ export class _GLTFAnimation {
220
174
  * @param accessors
221
175
  * @param animationSampleRate
222
176
  */
223
- static _CreateMorphTargetAnimationFromMorphTargetAnimations(
224
- babylonNode,
225
- runtimeGLTFAnimation,
226
- idleGLTFAnimations,
227
- nodeMap,
228
- nodes,
229
- bufferManager,
230
- bufferViews,
231
- accessors,
232
- animationSampleRate,
233
- useRightHanded,
234
- shouldExportAnimation
235
- ) {
177
+ static _CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, bufferManager, bufferViews, accessors, animationSampleRate, useRightHanded, shouldExportAnimation) {
236
178
  let glTFAnimation;
237
179
  if (babylonNode instanceof Mesh) {
238
180
  const morphTargetManager = babylonNode.morphTargetManager;
@@ -243,14 +185,7 @@ export class _GLTFAnimation {
243
185
  if (shouldExportAnimation && !shouldExportAnimation(animation)) {
244
186
  continue;
245
187
  }
246
- const combinedAnimation = new Animation(
247
- `${animation.name}`,
248
- "influence",
249
- animation.framePerSecond,
250
- animation.dataType,
251
- animation.loopMode,
252
- animation.enableBlending
253
- );
188
+ const combinedAnimation = new Animation(`${animation.name}`, "influence", animation.framePerSecond, animation.dataType, animation.loopMode, animation.enableBlending);
254
189
  const combinedAnimationKeys = [];
255
190
  const animationKeys = animation.getKeys();
256
191
  for (let j = 0; j < animationKeys.length; ++j) {
@@ -258,7 +193,8 @@ export class _GLTFAnimation {
258
193
  for (let k = 0; k < morphTargetManager.numTargets; ++k) {
259
194
  if (k == i) {
260
195
  combinedAnimationKeys.push(animationKey);
261
- } else {
196
+ }
197
+ else {
262
198
  combinedAnimationKeys.push({ frame: animationKey.frame, value: 0 });
263
199
  }
264
200
  }
@@ -271,22 +207,7 @@ export class _GLTFAnimation {
271
207
  samplers: [],
272
208
  channels: [],
273
209
  };
274
- _GLTFAnimation._AddAnimation(
275
- animation.name,
276
- animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation,
277
- babylonNode,
278
- combinedAnimation,
279
- animationInfo.dataAccessorType,
280
- animationInfo.animationChannelTargetPath,
281
- nodeMap,
282
- bufferManager,
283
- bufferViews,
284
- accessors,
285
- animationInfo.useQuaternion,
286
- animationSampleRate,
287
- useRightHanded,
288
- morphTargetManager.numTargets
289
- );
210
+ _GLTFAnimation._AddAnimation(animation.name, animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, combinedAnimation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, bufferManager, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate, useRightHanded, morphTargetManager.numTargets);
290
211
  if (glTFAnimation.samplers.length && glTFAnimation.channels.length) {
291
212
  idleGLTFAnimations.push(glTFAnimation);
292
213
  }
@@ -308,17 +229,7 @@ export class _GLTFAnimation {
308
229
  * @param accessors
309
230
  * @param animationSampleRate
310
231
  */
311
- static _CreateNodeAndMorphAnimationFromAnimationGroups(
312
- babylonScene,
313
- glTFAnimations,
314
- nodeMap,
315
- bufferManager,
316
- bufferViews,
317
- accessors,
318
- animationSampleRate,
319
- leftHandedNodes,
320
- shouldExportAnimation
321
- ) {
232
+ static _CreateNodeAndMorphAnimationFromAnimationGroups(babylonScene, glTFAnimations, nodeMap, bufferManager, bufferViews, accessors, animationSampleRate, leftHandedNodes, shouldExportAnimation) {
322
233
  let glTFAnimation;
323
234
  if (babylonScene.animationGroups) {
324
235
  const animationGroups = babylonScene.animationGroups;
@@ -346,24 +257,11 @@ export class _GLTFAnimation {
346
257
  if (animationInfo) {
347
258
  const babylonTransformNode = this._IsTransformable(target) ? target : this._IsTransformable(target[0]) ? target[0] : null;
348
259
  if (babylonTransformNode) {
349
- _GLTFAnimation._AddAnimation(
350
- `${animation.name}`,
351
- glTFAnimation,
352
- babylonTransformNode,
353
- animation,
354
- animationInfo.dataAccessorType,
355
- animationInfo.animationChannelTargetPath,
356
- nodeMap,
357
- bufferManager,
358
- bufferViews,
359
- accessors,
360
- animationInfo.useQuaternion,
361
- animationSampleRate,
362
- convertToRightHanded
363
- );
260
+ _GLTFAnimation._AddAnimation(`${animation.name}`, glTFAnimation, babylonTransformNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, bufferManager, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate, convertToRightHanded);
364
261
  }
365
262
  }
366
- } else if (target instanceof MorphTarget || (target.length === 1 && target[0] instanceof MorphTarget)) {
263
+ }
264
+ else if (target instanceof MorphTarget || (target.length === 1 && target[0] instanceof MorphTarget)) {
367
265
  const animationInfo = _GLTFAnimation._DeduceAnimationInfo(targetAnimation.animation);
368
266
  if (animationInfo) {
369
267
  const babylonMorphTarget = target instanceof MorphTarget ? target : target[0];
@@ -391,7 +289,8 @@ export class _GLTFAnimation {
391
289
  }
392
290
  }
393
291
  }
394
- } else {
292
+ }
293
+ else {
395
294
  // this is the place for the KHR_animation_pointer.
396
295
  }
397
296
  }
@@ -419,17 +318,11 @@ export class _GLTFAnimation {
419
318
  const morphTargetAnimation = animationsByMorphTarget.get(morphTarget);
420
319
  if (morphTargetAnimation) {
421
320
  if (!combinedAnimationGroup) {
422
- combinedAnimationGroup = new Animation(
423
- `${animationGroup.name}_${mesh.name}_MorphWeightAnimation`,
424
- "influence",
425
- morphTargetAnimation.framePerSecond,
426
- Animation.ANIMATIONTYPE_FLOAT,
427
- morphTargetAnimation.loopMode,
428
- morphTargetAnimation.enableBlending
429
- );
321
+ combinedAnimationGroup = new Animation(`${animationGroup.name}_${mesh.name}_MorphWeightAnimation`, "influence", morphTargetAnimation.framePerSecond, Animation.ANIMATIONTYPE_FLOAT, morphTargetAnimation.loopMode, morphTargetAnimation.enableBlending);
430
322
  }
431
323
  animationKeys.push(morphTargetAnimation.getKeys()[i]);
432
- } else {
324
+ }
325
+ else {
433
326
  animationKeys.push({
434
327
  frame: animationGroup.from + (animationGroupFrameDiff / numAnimationKeys) * i,
435
328
  value: morphTarget.influence,
@@ -443,22 +336,7 @@ export class _GLTFAnimation {
443
336
  combinedAnimationGroup.setKeys(animationKeys);
444
337
  const animationInfo = _GLTFAnimation._DeduceAnimationInfo(combinedAnimationGroup);
445
338
  if (animationInfo) {
446
- _GLTFAnimation._AddAnimation(
447
- `${animationGroup.name}_${mesh.name}_MorphWeightAnimation`,
448
- glTFAnimation,
449
- mesh,
450
- combinedAnimationGroup,
451
- animationInfo.dataAccessorType,
452
- animationInfo.animationChannelTargetPath,
453
- nodeMap,
454
- bufferManager,
455
- bufferViews,
456
- accessors,
457
- animationInfo.useQuaternion,
458
- animationSampleRate,
459
- false,
460
- morphTargetManager?.numTargets
461
- );
339
+ _GLTFAnimation._AddAnimation(`${animationGroup.name}_${mesh.name}_MorphWeightAnimation`, glTFAnimation, mesh, combinedAnimationGroup, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, bufferManager, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate, false, morphTargetManager?.numTargets);
462
340
  }
463
341
  });
464
342
  if (glTFAnimation.channels.length && glTFAnimation.samplers.length) {
@@ -467,22 +345,7 @@ export class _GLTFAnimation {
467
345
  }
468
346
  }
469
347
  }
470
- static _AddAnimation(
471
- name,
472
- glTFAnimation,
473
- babylonTransformNode,
474
- animation,
475
- dataAccessorType,
476
- animationChannelTargetPath,
477
- nodeMap,
478
- bufferManager,
479
- bufferViews,
480
- accessors,
481
- useQuaternion,
482
- animationSampleRate,
483
- convertToRightHanded,
484
- morphAnimationChannels
485
- ) {
348
+ static _AddAnimation(name, glTFAnimation, babylonTransformNode, animation, dataAccessorType, animationChannelTargetPath, nodeMap, bufferManager, bufferViews, accessors, useQuaternion, animationSampleRate, convertToRightHanded, morphAnimationChannels) {
486
349
  const animationData = _GLTFAnimation._CreateNodeAnimation(babylonTransformNode, animation, animationChannelTargetPath, useQuaternion, animationSampleRate);
487
350
  let bufferView;
488
351
  let accessor;
@@ -513,17 +376,10 @@ export class _GLTFAnimation {
513
376
  // Create buffer view and accessor for key frames.
514
377
  const inputData = new Float32Array(animationData.inputs);
515
378
  bufferView = bufferManager.createBufferView(inputData);
516
- accessor = bufferManager.createAccessor(
517
- bufferView,
518
- "SCALAR" /* AccessorType.SCALAR */,
519
- 5126 /* AccessorComponentType.FLOAT */,
520
- animationData.inputs.length,
521
- undefined,
522
- {
523
- min: [animationData.inputsMin],
524
- max: [animationData.inputsMax],
525
- }
526
- );
379
+ accessor = bufferManager.createAccessor(bufferView, "SCALAR" /* AccessorType.SCALAR */, 5126 /* AccessorComponentType.FLOAT */, animationData.inputs.length, undefined, {
380
+ min: [animationData.inputsMin],
381
+ max: [animationData.inputsMax],
382
+ });
527
383
  accessors.push(accessor);
528
384
  keyframeAccessorIndex = accessors.length - 1;
529
385
  // Perform conversions on keyed values while also building their buffer.
@@ -546,7 +402,8 @@ export class _GLTFAnimation {
546
402
  case "rotation" /* AnimationChannelTargetPath.ROTATION */:
547
403
  if (output.length === 4) {
548
404
  Quaternion.FromArrayToRef(output, 0, rotationQuaternion);
549
- } else {
405
+ }
406
+ else {
550
407
  outputToWrite = new Array(4); // Will need 4, not 3, for a quaternion
551
408
  Vector3.FromArrayToRef(output, 0, eulerVec3);
552
409
  Quaternion.FromEulerVectorToRef(eulerVec3, rotationQuaternion);
@@ -622,18 +479,22 @@ export class _GLTFAnimation {
622
479
  if (i === 0) {
623
480
  // set the first frame to itself
624
481
  endFrame = currKeyFrame.frame;
625
- } else {
482
+ }
483
+ else {
626
484
  continue;
627
485
  }
628
- } else {
486
+ }
487
+ else {
629
488
  endFrame = nextKeyFrame.frame;
630
489
  }
631
- } else {
490
+ }
491
+ else {
632
492
  // at the last key frame
633
493
  prevKeyFrame = keyFrames[i - 1];
634
494
  if ((currKeyFrame.value.equals && currKeyFrame.value.equals(prevKeyFrame.value)) || currKeyFrame.value === prevKeyFrame.value) {
635
495
  continue;
636
- } else {
496
+ }
497
+ else {
637
498
  endFrame = maxFrame;
638
499
  }
639
500
  }
@@ -695,12 +556,14 @@ export class _GLTFAnimation {
695
556
  if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
696
557
  if (useQuaternion) {
697
558
  quaternionCache = value;
698
- } else {
559
+ }
560
+ else {
699
561
  cacheValue = value;
700
562
  Quaternion.RotationYawPitchRollToRef(cacheValue.y, cacheValue.x, cacheValue.z, quaternionCache);
701
563
  }
702
564
  outputs.push(quaternionCache.asArray());
703
- } else {
565
+ }
566
+ else {
704
567
  // scaling and position animation
705
568
  cacheValue = value;
706
569
  outputs.push(cacheValue.asArray());
@@ -733,23 +596,9 @@ export class _GLTFAnimation {
733
596
  static _CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion) {
734
597
  animation.getKeys().forEach(function (keyFrame) {
735
598
  inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.
736
- _GLTFAnimation._AddSplineTangent(
737
- _TangentType.INTANGENT,
738
- outputs,
739
- animationChannelTargetPath,
740
- "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */,
741
- keyFrame,
742
- useQuaternion
743
- );
599
+ _GLTFAnimation._AddSplineTangent(_TangentType.INTANGENT, outputs, animationChannelTargetPath, "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */, keyFrame, useQuaternion);
744
600
  _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion);
745
- _GLTFAnimation._AddSplineTangent(
746
- _TangentType.OUTTANGENT,
747
- outputs,
748
- animationChannelTargetPath,
749
- "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */,
750
- keyFrame,
751
- useQuaternion
752
- );
601
+ _GLTFAnimation._AddSplineTangent(_TangentType.OUTTANGENT, outputs, animationChannelTargetPath, "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */, keyFrame, useQuaternion);
753
602
  });
754
603
  }
755
604
  static _GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, useQuaternion) {
@@ -758,14 +607,17 @@ export class _GLTFAnimation {
758
607
  if (useQuaternion) {
759
608
  const q = babylonTransformNode.rotationQuaternion;
760
609
  basePositionRotationOrScale = (q ?? Quaternion.Identity()).asArray();
761
- } else {
610
+ }
611
+ else {
762
612
  const r = babylonTransformNode.rotation;
763
613
  basePositionRotationOrScale = (r ?? Vector3.Zero()).asArray();
764
614
  }
765
- } else if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
615
+ }
616
+ else if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
766
617
  const p = babylonTransformNode.position;
767
618
  basePositionRotationOrScale = (p ?? Vector3.Zero()).asArray();
768
- } else {
619
+ }
620
+ else {
769
621
  // scale
770
622
  const s = babylonTransformNode.scaling;
771
623
  basePositionRotationOrScale = (s ?? Vector3.One()).asArray();
@@ -792,10 +644,12 @@ export class _GLTFAnimation {
792
644
  value = rotationQuaternion.asArray();
793
645
  }
794
646
  outputs.push(value); // scale vector.
795
- } else if (animationType === Animation.ANIMATIONTYPE_FLOAT) {
647
+ }
648
+ else if (animationType === Animation.ANIMATIONTYPE_FLOAT) {
796
649
  if (animationChannelTargetPath === "weights" /* AnimationChannelTargetPath.WEIGHTS */) {
797
650
  outputs.push([keyFrame.value]);
798
- } else {
651
+ }
652
+ else {
799
653
  // handles single component x, y, z or w component animation by using a base property and animating over a component.
800
654
  newPositionRotationOrScale = this._ConvertFactorToVector3OrQuaternion(keyFrame.value, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion);
801
655
  if (newPositionRotationOrScale) {
@@ -808,9 +662,11 @@ export class _GLTFAnimation {
808
662
  outputs.push(newPositionRotationOrScale.asArray());
809
663
  }
810
664
  }
811
- } else if (animationType === Animation.ANIMATIONTYPE_QUATERNION) {
665
+ }
666
+ else if (animationType === Animation.ANIMATIONTYPE_QUATERNION) {
812
667
  outputs.push(keyFrame.value.normalize().asArray());
813
- } else {
668
+ }
669
+ else {
814
670
  Tools.Error("glTFAnimation: Unsupported key frame values for animation!");
815
671
  }
816
672
  }
@@ -837,23 +693,25 @@ export class _GLTFAnimation {
837
693
  shouldBakeAnimation = true;
838
694
  break;
839
695
  }
840
- } else {
696
+ }
697
+ else {
841
698
  interpolationType = "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */;
842
699
  }
843
- } else {
700
+ }
701
+ else {
844
702
  if (interpolationType) {
845
- if (
846
- interpolationType === "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */ ||
847
- (key.interpolation && key.interpolation === 1 /* AnimationKeyInterpolation.STEP */ && interpolationType !== "STEP") /* AnimationSamplerInterpolation.STEP */
848
- ) {
703
+ if (interpolationType === "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */ ||
704
+ (key.interpolation && key.interpolation === 1 /* AnimationKeyInterpolation.STEP */ && interpolationType !== "STEP" /* AnimationSamplerInterpolation.STEP */)) {
849
705
  interpolationType = "LINEAR" /* AnimationSamplerInterpolation.LINEAR */;
850
706
  shouldBakeAnimation = true;
851
707
  break;
852
708
  }
853
- } else {
709
+ }
710
+ else {
854
711
  if (key.interpolation && key.interpolation === 1 /* AnimationKeyInterpolation.STEP */) {
855
712
  interpolationType = "STEP" /* AnimationSamplerInterpolation.STEP */;
856
- } else {
713
+ }
714
+ else {
857
715
  interpolationType = "LINEAR" /* AnimationSamplerInterpolation.LINEAR */;
858
716
  }
859
717
  }
@@ -882,23 +740,29 @@ export class _GLTFAnimation {
882
740
  if (tangentValue) {
883
741
  if (useQuaternion) {
884
742
  tangent = tangentValue.asArray();
885
- } else {
743
+ }
744
+ else {
886
745
  const array = tangentValue;
887
746
  tangent = Quaternion.RotationYawPitchRoll(array.y, array.x, array.z).asArray();
888
747
  }
889
- } else {
748
+ }
749
+ else {
890
750
  tangent = [0, 0, 0, 0];
891
751
  }
892
- } else if (animationChannelTargetPath === "weights" /* AnimationChannelTargetPath.WEIGHTS */) {
752
+ }
753
+ else if (animationChannelTargetPath === "weights" /* AnimationChannelTargetPath.WEIGHTS */) {
893
754
  if (tangentValue) {
894
755
  tangent = [tangentValue];
895
- } else {
756
+ }
757
+ else {
896
758
  tangent = [0];
897
759
  }
898
- } else {
760
+ }
761
+ else {
899
762
  if (tangentValue) {
900
763
  tangent = tangentValue.asArray();
901
- } else {
764
+ }
765
+ else {
902
766
  tangent = [0, 0, 0];
903
767
  }
904
768
  }