babylonjs-serializers 5.38.0 → 5.40.0

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.
@@ -2121,80 +2121,72 @@ var _GLTFAnimation = /** @class */ (function () {
2121
2121
  minMaxFrames.max = maxUsedFrame;
2122
2122
  }
2123
2123
  };
2124
- _GLTFAnimation._ConvertFactorToVector3OrQuaternion = function (factor, babylonTransformNode, animation, animationType, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion) {
2125
- var property;
2126
- var componentName;
2127
- var value = null;
2124
+ _GLTFAnimation._ConvertFactorToVector3OrQuaternion = function (factor, babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion) {
2128
2125
  var basePositionRotationOrScale = _GLTFAnimation._GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
2129
- if (animationType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_FLOAT) {
2130
- // handles single component x, y, z or w component animation by using a base property and animating over a component.
2131
- property = animation.targetProperty.split(".");
2132
- componentName = property ? property[1] : ""; // x, y, or z component
2133
- value = useQuaternion ? core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(basePositionRotationOrScale).normalize() : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(basePositionRotationOrScale);
2134
- switch (componentName) {
2135
- case "x": {
2136
- value[componentName] = convertToRightHandedSystem && useQuaternion && animationChannelTargetPath !== "scale" /* SCALE */ ? -factor : factor;
2137
- break;
2138
- }
2139
- case "y": {
2140
- value[componentName] = convertToRightHandedSystem && useQuaternion && animationChannelTargetPath !== "scale" /* SCALE */ ? -factor : factor;
2141
- break;
2142
- }
2143
- case "z": {
2144
- value[componentName] = convertToRightHandedSystem && !useQuaternion && animationChannelTargetPath !== "scale" /* SCALE */ ? -factor : factor;
2145
- break;
2146
- }
2147
- case "w": {
2148
- value.w = factor;
2149
- break;
2150
- }
2151
- default: {
2152
- core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("glTFAnimation: Unsupported component type \"".concat(componentName, "\" for scale animation!"));
2153
- }
2126
+ // handles single component x, y, z or w component animation by using a base property and animating over a component.
2127
+ var property = animation.targetProperty.split(".");
2128
+ var componentName = property ? property[1] : ""; // x, y, or z component
2129
+ var value = useQuaternion ? core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(basePositionRotationOrScale).normalize() : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(basePositionRotationOrScale);
2130
+ switch (componentName) {
2131
+ case "x": {
2132
+ value[componentName] = convertToRightHandedSystem && useQuaternion && animationChannelTargetPath !== "scale" /* SCALE */ ? -factor : factor;
2133
+ break;
2134
+ }
2135
+ case "y": {
2136
+ value[componentName] = convertToRightHandedSystem && useQuaternion && animationChannelTargetPath !== "scale" /* SCALE */ ? -factor : factor;
2137
+ break;
2138
+ }
2139
+ case "z": {
2140
+ value[componentName] = convertToRightHandedSystem && !useQuaternion && animationChannelTargetPath !== "scale" /* SCALE */ ? -factor : factor;
2141
+ break;
2142
+ }
2143
+ case "w": {
2144
+ value.w = factor;
2145
+ break;
2146
+ }
2147
+ default: {
2148
+ core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("glTFAnimation: Unsupported component name \"".concat(componentName, "\"!"));
2154
2149
  }
2155
2150
  }
2156
2151
  return value;
2157
2152
  };
2158
2153
  _GLTFAnimation._SetInterpolatedValue = function (babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, convertToRightHandedSystem, useQuaternion) {
2159
- var animationType = animation.dataType;
2160
2154
  var cacheValue;
2161
2155
  inputs.push(time);
2162
- if (value) {
2163
- if (animationChannelTargetPath === "weights" /* WEIGHTS */) {
2164
- outputs.push([value]);
2165
- return;
2156
+ if (animationChannelTargetPath === "weights" /* WEIGHTS */) {
2157
+ outputs.push([value]);
2158
+ return;
2159
+ }
2160
+ if (animation.dataType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_FLOAT) {
2161
+ value = this._ConvertFactorToVector3OrQuaternion(value, babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
2162
+ }
2163
+ if (animationChannelTargetPath === "rotation" /* ROTATION */) {
2164
+ if (useQuaternion) {
2165
+ quaternionCache = value;
2166
2166
  }
2167
- if (typeof value === "number") {
2168
- value = this._ConvertFactorToVector3OrQuaternion(value, babylonTransformNode, animation, animationType, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
2167
+ else {
2168
+ cacheValue = value;
2169
+ core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRollToRef(cacheValue.y, cacheValue.x, cacheValue.z, quaternionCache);
2169
2170
  }
2170
- if (animationChannelTargetPath === "rotation" /* ROTATION */) {
2171
- if (useQuaternion) {
2172
- quaternionCache = value;
2173
- }
2174
- else {
2175
- cacheValue = value;
2176
- core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRollToRef(cacheValue.y, cacheValue.x, cacheValue.z, quaternionCache);
2177
- }
2178
- if (convertToRightHandedSystem) {
2179
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionFromRef(quaternionCache);
2180
- if (!babylonTransformNode.parent) {
2181
- quaternionCache = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(quaternionCache);
2182
- }
2171
+ if (convertToRightHandedSystem) {
2172
+ _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionFromRef(quaternionCache);
2173
+ if (!babylonTransformNode.parent) {
2174
+ quaternionCache = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(quaternionCache);
2183
2175
  }
2184
- outputs.push(quaternionCache.asArray());
2185
2176
  }
2186
- else {
2187
- // scaling and position animation
2188
- cacheValue = value;
2189
- if (convertToRightHandedSystem && animationChannelTargetPath !== "scale" /* SCALE */) {
2190
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedPositionVector3FromRef(cacheValue);
2191
- if (!babylonTransformNode.parent) {
2192
- cacheValue.x *= -1;
2193
- cacheValue.z *= -1;
2194
- }
2177
+ outputs.push(quaternionCache.asArray());
2178
+ }
2179
+ else {
2180
+ // scaling and position animation
2181
+ cacheValue = value;
2182
+ if (convertToRightHandedSystem && animationChannelTargetPath !== "scale" /* SCALE */) {
2183
+ _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedPositionVector3FromRef(cacheValue);
2184
+ if (!babylonTransformNode.parent) {
2185
+ cacheValue.x *= -1;
2186
+ cacheValue.z *= -1;
2195
2187
  }
2196
- outputs.push(cacheValue.asArray());
2197
2188
  }
2189
+ outputs.push(cacheValue.asArray());
2198
2190
  }
2199
2191
  };
2200
2192
  /**
@@ -2311,7 +2303,7 @@ var _GLTFAnimation = /** @class */ (function () {
2311
2303
  }
2312
2304
  else {
2313
2305
  // handles single component x, y, z or w component animation by using a base property and animating over a component.
2314
- newPositionRotationOrScale = this._ConvertFactorToVector3OrQuaternion(keyFrame.value, babylonTransformNode, animation, animationType, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
2306
+ newPositionRotationOrScale = this._ConvertFactorToVector3OrQuaternion(keyFrame.value, babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
2315
2307
  if (newPositionRotationOrScale) {
2316
2308
  if (animationChannelTargetPath === "rotation" /* ROTATION */) {
2317
2309
  var posRotScale = useQuaternion