@galacean/engine 1.0.0-beta.12 → 1.0.0-beta.13

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.
package/dist/browser.js CHANGED
@@ -7133,29 +7133,7 @@
7133
7133
  * @remarks The release principle is that it is not referenced by the components, including direct and indirect reference.
7134
7134
  */ _proto.gc = function gc() {
7135
7135
  this._gc(false);
7136
- var engine = this.engine;
7137
- engine._renderElementPool.garbageCollection();
7138
- engine._meshRenderDataPool.garbageCollection();
7139
- engine._spriteRenderDataPool.garbageCollection();
7140
- engine._spriteMaskRenderDataPool.garbageCollection();
7141
- engine._textRenderDataPool.garbageCollection();
7142
- var _componentsManager = engine._componentsManager, _lightManager = engine._lightManager;
7143
- _componentsManager._renderers.garbageCollection();
7144
- // @ts-ignore
7145
- _componentsManager._onStartScripts.garbageCollection();
7146
- // @ts-ignore
7147
- _componentsManager._onUpdateScripts.garbageCollection();
7148
- // @ts-ignore
7149
- _componentsManager._onLateUpdateScripts.garbageCollection();
7150
- // @ts-ignore
7151
- _componentsManager._onPhysicsUpdateScripts.garbageCollection();
7152
- // @ts-ignore
7153
- _componentsManager._onUpdateAnimations.garbageCollection();
7154
- // @ts-ignore
7155
- _componentsManager._onUpdateRenderers.garbageCollection();
7156
- _lightManager._spotLights.garbageCollection();
7157
- _lightManager._pointLights.garbageCollection();
7158
- _lightManager._directLights.garbageCollection();
7136
+ this.engine._pendingGC();
7159
7137
  };
7160
7138
  /**
7161
7139
  * Add content restorer.
@@ -8073,6 +8051,17 @@
8073
8051
  componentContainer.length = 0;
8074
8052
  this._componentsContainerPool.push(componentContainer);
8075
8053
  };
8054
+ /**
8055
+ * @internal
8056
+ */ _proto._gc = function _gc() {
8057
+ this._renderers.garbageCollection();
8058
+ this._onStartScripts.garbageCollection();
8059
+ this._onUpdateScripts.garbageCollection();
8060
+ this._onLateUpdateScripts.garbageCollection();
8061
+ this._onPhysicsUpdateScripts.garbageCollection();
8062
+ this._onUpdateAnimations.garbageCollection();
8063
+ this._onUpdateRenderers.garbageCollection();
8064
+ };
8076
8065
  return ComponentsManager;
8077
8066
  }();
8078
8067
  /**
@@ -10682,6 +10671,11 @@
10682
10671
  elements[i]._onLateUpdate();
10683
10672
  }
10684
10673
  };
10674
+ /**
10675
+ * @internal
10676
+ */ _proto._gc = function _gc() {
10677
+ this._colliders.garbageCollection();
10678
+ };
10685
10679
  _proto._setGravity = function _setGravity() {
10686
10680
  this._nativePhysicsManager.setGravity(this._gravity);
10687
10681
  };
@@ -13226,6 +13220,13 @@
13226
13220
  shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
13227
13221
  }
13228
13222
  };
13223
+ /**
13224
+ * @internal
13225
+ */ _proto._gc = function _gc() {
13226
+ this._spotLights.garbageCollection();
13227
+ this._pointLights.garbageCollection();
13228
+ this._directLights.garbageCollection();
13229
+ };
13229
13230
  return LightManager;
13230
13231
  }();
13231
13232
  /**
@@ -21502,6 +21503,7 @@
21502
21503
  _this._frameInProcess = false;
21503
21504
  _this._waitingDestroy = false;
21504
21505
  _this._isDeviceLost = false;
21506
+ _this._waitingGC = false;
21505
21507
  _this._animate = function() {
21506
21508
  if (_this._vSyncCount) {
21507
21509
  _this._requestId = requestAnimationFrame(_this._animate);
@@ -21605,6 +21607,10 @@
21605
21607
  if (this._waitingDestroy) {
21606
21608
  this._destroy();
21607
21609
  }
21610
+ if (this._waitingGC) {
21611
+ this._gc();
21612
+ this._waitingGC = false;
21613
+ }
21608
21614
  this._frameInProcess = false;
21609
21615
  };
21610
21616
  /**
@@ -21763,6 +21769,15 @@
21763
21769
  };
21764
21770
  /**
21765
21771
  * @internal
21772
+ */ _proto._pendingGC = function _pendingGC() {
21773
+ if (this._frameInProcess) {
21774
+ this._waitingGC = true;
21775
+ } else {
21776
+ this._gc();
21777
+ }
21778
+ };
21779
+ /**
21780
+ * @internal
21766
21781
  */ _proto._initialize = function _initialize(configuration) {
21767
21782
  var _this = this;
21768
21783
  var physics = configuration.physics;
@@ -21825,6 +21840,16 @@
21825
21840
  console.error(error);
21826
21841
  });
21827
21842
  };
21843
+ _proto._gc = function _gc() {
21844
+ this._renderElementPool.garbageCollection();
21845
+ this._meshRenderDataPool.garbageCollection();
21846
+ this._spriteRenderDataPool.garbageCollection();
21847
+ this._spriteMaskRenderDataPool.garbageCollection();
21848
+ this._textRenderDataPool.garbageCollection();
21849
+ this._componentsManager._gc();
21850
+ this._lightManager._gc();
21851
+ this.physicsManager._gc();
21852
+ };
21828
21853
  _create_class$3(Engine, [
21829
21854
  {
21830
21855
  key: "settings",
@@ -27204,7 +27229,6 @@
27204
27229
  * @internal
27205
27230
  */ var AnimationCurveOwner = /*#__PURE__*/ function() {
27206
27231
  function AnimationCurveOwner(target, type, property, cureType) {
27207
- this.hasSavedDefaultValue = false;
27208
27232
  this.baseEvaluateData = {
27209
27233
  curKeyframeIndex: 0,
27210
27234
  value: null
@@ -27217,7 +27241,7 @@
27217
27241
  this.type = type;
27218
27242
  this.property = property;
27219
27243
  this.component = target.getComponent(type);
27220
- this._cureType = cureType;
27244
+ this.cureType = cureType;
27221
27245
  var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
27222
27246
  this._assembler = new assemblerType();
27223
27247
  this._assembler.initialize(this);
@@ -27226,89 +27250,80 @@
27226
27250
  }
27227
27251
  }
27228
27252
  var _proto = AnimationCurveOwner.prototype;
27229
- _proto.evaluateAndApplyValue = function evaluateAndApplyValue(curve, time, layerWeight, additive) {
27230
- if (curve.keys.length) {
27231
- if (additive) {
27232
- var value = curve._evaluateAdditive(time, this.baseEvaluateData);
27233
- var cureType = this._cureType;
27234
- if (cureType._isReferenceType) {
27235
- cureType._additiveValue(value, layerWeight, this.referenceTargetValue);
27236
- } else {
27237
- var assembler = this._assembler;
27238
- var originValue = assembler.getTargetValue();
27239
- var additiveValue = cureType._additiveValue(value, layerWeight, originValue);
27240
- assembler.setTargetValue(additiveValue);
27241
- }
27242
- } else {
27243
- var value1 = curve._evaluate(time, this.baseEvaluateData);
27244
- this._applyValue(value1, layerWeight);
27245
- }
27246
- }
27253
+ _proto.evaluateValue = function evaluateValue(curve, time, additive) {
27254
+ return additive ? curve._evaluateAdditive(time, this.baseEvaluateData) : curve._evaluate(time, this.baseEvaluateData);
27247
27255
  };
27248
- _proto.crossFadeAndApplyValue = function crossFadeAndApplyValue(srcCurve, destCurve, srcTime, destTime, crossWeight, layerWeight, additive) {
27249
- var srcValue = srcCurve && srcCurve.keys.length ? additive ? srcCurve._evaluateAdditive(srcTime, this.baseEvaluateData) : srcCurve._evaluate(srcTime, this.baseEvaluateData) : additive ? this._cureType._getZeroValue(this.baseEvaluateData.value) : this.defaultValue;
27250
- var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this._cureType._getZeroValue(this.crossEvaluateData.value) : this.defaultValue;
27251
- this._applyCrossValue(srcValue, destValue, crossWeight, layerWeight, additive);
27256
+ _proto.evaluateCrossFadeValue = function evaluateCrossFadeValue(srcCurve, destCurve, srcTime, destTime, crossWeight, additive) {
27257
+ var srcValue = srcCurve && srcCurve.keys.length ? additive ? srcCurve._evaluateAdditive(srcTime, this.baseEvaluateData) : srcCurve._evaluate(srcTime, this.baseEvaluateData) : additive ? this.cureType._getZeroValue(this.baseEvaluateData.value) : this.defaultValue;
27258
+ var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.cureType._getZeroValue(this.crossEvaluateData.value) : this.defaultValue;
27259
+ return this._lerpValue(srcValue, destValue, crossWeight);
27252
27260
  };
27253
- _proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight, layerWeight, additive) {
27254
- var srcValue = additive ? this._cureType._subtractValue(this.fixedPoseValue, this.defaultValue, this.baseEvaluateData.value) : this.fixedPoseValue;
27255
- var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this._cureType._getZeroValue(this.crossEvaluateData.value) : this.defaultValue;
27256
- this._applyCrossValue(srcValue, destValue, crossWeight, layerWeight, additive);
27261
+ _proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight, additive) {
27262
+ var srcValue = additive ? this.cureType._subtractValue(this.fixedPoseValue, this.defaultValue, this.baseEvaluateData.value) : this.fixedPoseValue;
27263
+ var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.cureType._getZeroValue(this.crossEvaluateData.value) : this.defaultValue;
27264
+ return this._lerpValue(srcValue, destValue, crossWeight);
27257
27265
  };
27258
27266
  _proto.revertDefaultValue = function revertDefaultValue() {
27259
27267
  this._assembler.setTargetValue(this.defaultValue);
27260
27268
  };
27269
+ _proto.getEvaluateValue = function getEvaluateValue(out) {
27270
+ if (this.cureType._isReferenceType) {
27271
+ this.cureType._copyValue(this.baseEvaluateData.value, out);
27272
+ return out;
27273
+ } else {
27274
+ return this.baseEvaluateData.value;
27275
+ }
27276
+ };
27261
27277
  _proto.saveDefaultValue = function saveDefaultValue() {
27262
- if (this._cureType._isReferenceType) {
27263
- this._cureType._copyValue(this.referenceTargetValue, this.defaultValue);
27278
+ if (this.cureType._isReferenceType) {
27279
+ this.cureType._copyValue(this.referenceTargetValue, this.defaultValue);
27264
27280
  } else {
27265
27281
  this.defaultValue = this._assembler.getTargetValue();
27266
27282
  }
27267
- this.hasSavedDefaultValue = true;
27268
27283
  };
27269
27284
  _proto.saveFixedPoseValue = function saveFixedPoseValue() {
27270
- if (this._cureType._isReferenceType) {
27271
- this._cureType._copyValue(this.referenceTargetValue, this.fixedPoseValue);
27285
+ if (this.cureType._isReferenceType) {
27286
+ this.cureType._copyValue(this.referenceTargetValue, this.fixedPoseValue);
27272
27287
  } else {
27273
27288
  this.fixedPoseValue = this._assembler.getTargetValue();
27274
27289
  }
27275
27290
  };
27276
- _proto._applyValue = function _applyValue(value, weight) {
27277
- if (weight === 1.0) {
27278
- if (this._cureType._isReferenceType) {
27279
- this._cureType._copyValue(value, this.referenceTargetValue);
27291
+ _proto.applyValue = function applyValue(value, weight, additive) {
27292
+ var cureType = this.cureType;
27293
+ if (additive) {
27294
+ if (cureType._isReferenceType) {
27295
+ cureType._additiveValue(value, weight, this.referenceTargetValue);
27280
27296
  } else {
27281
- this._assembler.setTargetValue(value);
27297
+ var assembler = this._assembler;
27298
+ var originValue = assembler.getTargetValue();
27299
+ var additiveValue = cureType._additiveValue(value, weight, originValue);
27300
+ assembler.setTargetValue(additiveValue);
27282
27301
  }
27283
27302
  } else {
27284
- if (this._cureType._isReferenceType) {
27285
- var targetValue = this.referenceTargetValue;
27286
- this._cureType._lerpValue(targetValue, value, weight, targetValue);
27303
+ if (weight === 1.0) {
27304
+ if (cureType._isReferenceType) {
27305
+ cureType._copyValue(value, this.referenceTargetValue);
27306
+ } else {
27307
+ this._assembler.setTargetValue(value);
27308
+ }
27287
27309
  } else {
27288
- var originValue = this._assembler.getTargetValue();
27289
- var lerpValue = this._cureType._lerpValue(originValue, value, weight);
27290
- this._assembler.setTargetValue(lerpValue);
27310
+ if (cureType._isReferenceType) {
27311
+ var targetValue = this.referenceTargetValue;
27312
+ cureType._lerpValue(targetValue, value, weight, targetValue);
27313
+ } else {
27314
+ var originValue1 = this._assembler.getTargetValue();
27315
+ var lerpValue = cureType._lerpValue(originValue1, value, weight);
27316
+ this._assembler.setTargetValue(lerpValue);
27317
+ }
27291
27318
  }
27292
27319
  }
27293
27320
  };
27294
- _proto._applyCrossValue = function _applyCrossValue(srcValue, destValue, crossWeight, layerWeight, additive) {
27295
- var out;
27296
- if (this._cureType._isReferenceType) {
27297
- out = this.baseEvaluateData.value;
27298
- this._cureType._lerpValue(srcValue, destValue, crossWeight, out);
27299
- } else {
27300
- out = this._cureType._lerpValue(srcValue, destValue, crossWeight);
27301
- }
27302
- if (additive) {
27303
- if (this._cureType._isReferenceType) {
27304
- this._cureType._additiveValue(out, layerWeight, this.referenceTargetValue);
27305
- } else {
27306
- var originValue = this._assembler.getTargetValue();
27307
- var lerpValue = this._cureType._additiveValue(out, layerWeight, originValue);
27308
- this._assembler.setTargetValue(lerpValue);
27309
- }
27321
+ _proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
27322
+ if (this.cureType._isReferenceType) {
27323
+ return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
27310
27324
  } else {
27311
- this._applyValue(out, layerWeight);
27325
+ this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
27326
+ return this.baseEvaluateData.value;
27312
27327
  }
27313
27328
  };
27314
27329
  AnimationCurveOwner.registerAssembler = function registerAssembler(componentType, property, assemblerType) {
@@ -27399,9 +27414,24 @@
27399
27414
  AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights", BlendShapeWeightsAnimationCurveOwnerAssembler);
27400
27415
  /**
27401
27416
  * @internal
27402
- */ var AnimationCurveLayerOwner = function AnimationCurveLayerOwner() {
27403
- this.crossCurveMark = 0;
27404
- };
27417
+ */ var AnimationCurveLayerOwner = /*#__PURE__*/ function() {
27418
+ var AnimationCurveLayerOwner = function AnimationCurveLayerOwner() {
27419
+ this.crossCurveMark = 0;
27420
+ };
27421
+ var _proto = AnimationCurveLayerOwner.prototype;
27422
+ _proto.initFinalValue = function initFinalValue() {
27423
+ var _this_curveOwner = this.curveOwner, cureType = _this_curveOwner.cureType, defaultValue = _this_curveOwner.defaultValue;
27424
+ if (cureType._isReferenceType) {
27425
+ cureType._copyValue(defaultValue, this.finalValue);
27426
+ } else {
27427
+ this.finalValue = defaultValue;
27428
+ }
27429
+ };
27430
+ _proto.saveFinalValue = function saveFinalValue() {
27431
+ this.finalValue = this.curveOwner.getEvaluateValue(this.finalValue);
27432
+ };
27433
+ return AnimationCurveLayerOwner;
27434
+ }();
27405
27435
  /**
27406
27436
  * Associate AnimationCurve and the Entity
27407
27437
  */ var AnimationClipCurveBinding = /*#__PURE__*/ function() {
@@ -27415,13 +27445,18 @@
27415
27445
  var curveType = this.curve.constructor;
27416
27446
  var owner = new AnimationCurveOwner(entity, this.type, this.property, curveType);
27417
27447
  curveType._initializeOwner(owner);
27448
+ owner.saveDefaultValue();
27418
27449
  return owner;
27419
27450
  };
27420
27451
  /**
27421
27452
  * @internal
27422
27453
  */ _proto._createCurveLayerOwner = function _createCurveLayerOwner(owner) {
27454
+ var curveType = this.curve.constructor;
27423
27455
  var layerOwner = new AnimationCurveLayerOwner();
27424
27456
  layerOwner.curveOwner = owner;
27457
+ curveType._initializeLayerOwner(layerOwner);
27458
+ // If curve.keys.length is 0, updateFinishedState will assign 0 to the target, causing an error, so initialize by assigning defaultValue to finalValue.
27459
+ layerOwner.initFinalValue();
27425
27460
  return layerOwner;
27426
27461
  };
27427
27462
  /**
@@ -27506,7 +27541,8 @@
27506
27541
  var targetEntity = entity.findByPath(curveData.relativePath);
27507
27542
  if (targetEntity) {
27508
27543
  var curveOwner = curveData._getTempCurveOwner(targetEntity);
27509
- curveOwner.evaluateAndApplyValue(curveData.curve, time, 1, false);
27544
+ var value = curveOwner.evaluateValue(curveData.curve, time, false);
27545
+ curveOwner.applyValue(value, 1, false);
27510
27546
  }
27511
27547
  }
27512
27548
  };
@@ -27648,6 +27684,7 @@
27648
27684
  break;
27649
27685
  }
27650
27686
  }
27687
+ evaluateData.value = value;
27651
27688
  return value;
27652
27689
  };
27653
27690
  /**
@@ -27703,6 +27740,11 @@
27703
27740
  };
27704
27741
  /**
27705
27742
  * @internal
27743
+ */ AnimationArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
27744
+ owner.finalValue = [];
27745
+ };
27746
+ /**
27747
+ * @internal
27706
27748
  */ AnimationArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
27707
27749
  for(var i = 0, n = out.length; i < n; ++i){
27708
27750
  var src = srcValue[i];
@@ -27792,6 +27834,11 @@
27792
27834
  };
27793
27835
  /**
27794
27836
  * @internal
27837
+ */ AnimationBoolCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
27838
+ owner.finalValue = false;
27839
+ };
27840
+ /**
27841
+ * @internal
27795
27842
  */ AnimationBoolCurve._lerpValue = function _lerpValue(srcValue, destValue) {
27796
27843
  return destValue;
27797
27844
  };
@@ -27848,6 +27895,11 @@
27848
27895
  };
27849
27896
  /**
27850
27897
  * @internal
27898
+ */ AnimationColorCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
27899
+ owner.finalValue = new Color$1();
27900
+ };
27901
+ /**
27902
+ * @internal
27851
27903
  */ AnimationColorCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
27852
27904
  Color$1.lerp(srcValue, destValue, weight, out);
27853
27905
  return out;
@@ -27953,6 +28005,12 @@
27953
28005
  };
27954
28006
  /**
27955
28007
  * @internal
28008
+ */ AnimationFloatArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
28009
+ var size = owner.curveOwner.referenceTargetValue.length;
28010
+ owner.finalValue = new Float32Array(size);
28011
+ };
28012
+ /**
28013
+ * @internal
27956
28014
  */ AnimationFloatArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
27957
28015
  for(var i = 0, n = out.length; i < n; ++i){
27958
28016
  var src = srcValue[i];
@@ -28042,6 +28100,11 @@
28042
28100
  };
28043
28101
  /**
28044
28102
  * @internal
28103
+ */ AnimationFloatCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
28104
+ owner.finalValue = 0;
28105
+ };
28106
+ /**
28107
+ * @internal
28045
28108
  */ AnimationFloatCurve._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
28046
28109
  return srcValue + (destValue - srcValue) * crossWeight;
28047
28110
  };
@@ -28110,6 +28173,11 @@
28110
28173
  };
28111
28174
  /**
28112
28175
  * @internal
28176
+ */ AnimationQuaternionCurve1._initializeLayerOwner = function _initializeLayerOwner(owner) {
28177
+ owner.finalValue = new Quaternion();
28178
+ };
28179
+ /**
28180
+ * @internal
28113
28181
  */ AnimationQuaternionCurve1._lerpValue = function _lerpValue(src, dest, weight, out) {
28114
28182
  Quaternion.slerp(src, dest, weight, out);
28115
28183
  return out;
@@ -28213,6 +28281,11 @@
28213
28281
  };
28214
28282
  /**
28215
28283
  * @internal
28284
+ */ AnimationVector2Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
28285
+ owner.finalValue = new Vector2();
28286
+ };
28287
+ /**
28288
+ * @internal
28216
28289
  */ AnimationVector2Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
28217
28290
  Vector2.lerp(srcValue, destValue, weight, out);
28218
28291
  return out;
@@ -28297,6 +28370,11 @@
28297
28370
  };
28298
28371
  /**
28299
28372
  * @internal
28373
+ */ AnimationVector3Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
28374
+ owner.finalValue = new Vector3();
28375
+ };
28376
+ /**
28377
+ * @internal
28300
28378
  */ AnimationVector3Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
28301
28379
  Vector3.lerp(srcValue, destValue, weight, out);
28302
28380
  return out;
@@ -28393,6 +28471,11 @@
28393
28471
  };
28394
28472
  /**
28395
28473
  * @internal
28474
+ */ AnimationVector4Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
28475
+ owner.finalValue = new Vector4();
28476
+ };
28477
+ /**
28478
+ * @internal
28396
28479
  */ AnimationVector4Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
28397
28480
  Vector4.lerp(srcValue, destValue, weight, out);
28398
28481
  return out;
@@ -28498,6 +28581,7 @@
28498
28581
  LayerState[LayerState[/** Playing state. */ "Playing"] = 1] = "Playing";
28499
28582
  LayerState[LayerState[/** CrossFading state. */ "CrossFading"] = 2] = "CrossFading";
28500
28583
  LayerState[LayerState[/** FixedCrossFading state. */ "FixedCrossFading"] = 3] = "FixedCrossFading";
28584
+ LayerState[LayerState[/** Finished state. */ "Finished"] = 4] = "Finished";
28501
28585
  })(LayerState || (LayerState = {}));
28502
28586
  /**
28503
28587
  * @internal
@@ -28569,7 +28653,7 @@
28569
28653
  this.layerState = LayerState.Standby;
28570
28654
  this.crossCurveMark = 0;
28571
28655
  this.manuallyTransition = new AnimatorStateTransition();
28572
- this.crossOwnerLayerDataCollection = [];
28656
+ this.crossLayerOwnerCollection = [];
28573
28657
  };
28574
28658
  var _proto = AnimatorLayerData.prototype;
28575
28659
  _proto.switchPlayData = function switchPlayData() {
@@ -28596,6 +28680,7 @@
28596
28680
  /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
28597
28681
  _this._animatorLayersData = [];
28598
28682
  _this._curveOwnerPool = Object.create(null);
28683
+ _this._needRevertCurveOwners = [];
28599
28684
  _this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
28600
28685
  _this._tempAnimatorStateInfo = {
28601
28686
  layerIndex: -1,
@@ -28619,7 +28704,7 @@
28619
28704
  this._reset();
28620
28705
  }
28621
28706
  var stateInfo = this._getAnimatorStateInfo(stateName, layerIndex);
28622
- var state = stateInfo.state;
28707
+ var state = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
28623
28708
  if (!state) {
28624
28709
  return;
28625
28710
  }
@@ -28628,8 +28713,8 @@
28628
28713
  return;
28629
28714
  }
28630
28715
  var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
28631
- var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData);
28632
- this._preparePlay(animatorLayerData, state, animatorStateData);
28716
+ var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData, playLayerIndex);
28717
+ this._preparePlay(animatorLayerData, state);
28633
28718
  animatorLayerData.layerState = LayerState.Playing;
28634
28719
  animatorLayerData.srcPlayData.reset(state, animatorStateData, state._getDuration() * normalizedTimeOffset);
28635
28720
  };
@@ -28680,6 +28765,7 @@
28680
28765
  return;
28681
28766
  }
28682
28767
  deltaTime *= this.speed;
28768
+ this._revertCurveOwners();
28683
28769
  for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
28684
28770
  var animatorLayerData = this._getAnimatorLayerData(i1);
28685
28771
  if (animatorLayerData.layerState === LayerState.Standby) {
@@ -28723,10 +28809,11 @@
28723
28809
  var propertyOwners = animationCurveOwners[instanceId];
28724
28810
  for(var property in propertyOwners){
28725
28811
  var owner = propertyOwners[property];
28726
- owner.hasSavedDefaultValue && owner.revertDefaultValue();
28812
+ owner.revertDefaultValue();
28727
28813
  }
28728
28814
  }
28729
28815
  this._animatorLayersData.length = 0;
28816
+ this._needRevertCurveOwners.length = 0;
28730
28817
  this._curveOwnerPool = {};
28731
28818
  this._animationEventHandlerPool.resetPool();
28732
28819
  if (this._controllerUpdateFlag) {
@@ -28754,25 +28841,18 @@
28754
28841
  stateInfo.state = state;
28755
28842
  return stateInfo;
28756
28843
  };
28757
- _proto._saveDefaultValues = function _saveDefaultValues(stateData) {
28758
- var curveLayerOwner = stateData.curveLayerOwner;
28759
- for(var i = curveLayerOwner.length - 1; i >= 0; i--){
28760
- var _curveLayerOwner_i;
28761
- (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.saveDefaultValue();
28762
- }
28763
- };
28764
- _proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData) {
28844
+ _proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData, layerIndex) {
28765
28845
  var animatorStateDataMap = animatorLayerData.animatorStateDataMap;
28766
28846
  var animatorStateData = animatorStateDataMap[stateName];
28767
28847
  if (!animatorStateData) {
28768
28848
  animatorStateData = new AnimatorStateData();
28769
28849
  animatorStateDataMap[stateName] = animatorStateData;
28770
- this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData);
28850
+ this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex);
28771
28851
  this._saveAnimatorEventHandlers(animatorState, animatorStateData);
28772
28852
  }
28773
28853
  return animatorStateData;
28774
28854
  };
28775
- _proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData) {
28855
+ _proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex) {
28776
28856
  var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
28777
28857
  var curveLayerOwner = animatorStateData.curveLayerOwner;
28778
28858
  var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
@@ -28784,9 +28864,22 @@
28784
28864
  var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
28785
28865
  var property = curve.property;
28786
28866
  var instanceId = targetEntity.instanceId;
28867
+ var needRevert = false;
28868
+ var baseAnimatorLayerData = this._animatorLayersData[0];
28869
+ var baseLayerCurveOwnerPool = baseAnimatorLayerData.curveOwnerPool;
28870
+ if (this.animatorController.layers[layerIndex].blendingMode === exports.AnimatorLayerBlendingMode.Additive && layerIndex > 0 && !(baseLayerCurveOwnerPool[instanceId] && baseLayerCurveOwnerPool[instanceId][property])) {
28871
+ needRevert = true;
28872
+ }
28787
28873
  // Get owner
28788
28874
  var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
28789
28875
  var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity));
28876
+ //@todo: There is performance waste here, which will be handled together with organizing AnimatorStateData later. The logic is changing from runtime to initialization.
28877
+ if (needRevert) {
28878
+ this._needRevertCurveOwners.push(owner);
28879
+ } else {
28880
+ var index = this._needRevertCurveOwners.indexOf(owner);
28881
+ index > -1 && this._needRevertCurveOwners.splice(index, 1);
28882
+ }
28790
28883
  // Get layer owner
28791
28884
  var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
28792
28885
  var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
@@ -28820,12 +28913,12 @@
28820
28913
  };
28821
28914
  _proto._clearCrossData = function _clearCrossData(animatorLayerData) {
28822
28915
  animatorLayerData.crossCurveMark++;
28823
- animatorLayerData.crossOwnerLayerDataCollection.length = 0;
28916
+ animatorLayerData.crossLayerOwnerCollection.length = 0;
28824
28917
  };
28825
28918
  _proto._addCrossOwner = function _addCrossOwner(animatorLayerData, layerOwner, curCurveIndex, nextCurveIndex) {
28826
28919
  layerOwner.crossSrcCurveIndex = curCurveIndex;
28827
28920
  layerOwner.crossDestCurveIndex = nextCurveIndex;
28828
- animatorLayerData.crossOwnerLayerDataCollection.push(layerOwner);
28921
+ animatorLayerData.crossLayerOwnerCollection.push(layerOwner);
28829
28922
  };
28830
28923
  _proto._prepareCrossFading = function _prepareCrossFading(animatorLayerData) {
28831
28924
  // Add src cross curve data.
@@ -28840,10 +28933,10 @@
28840
28933
  this._prepareDestCrossData(animatorLayerData, true);
28841
28934
  };
28842
28935
  _proto._prepareFixedPoseCrossFading = function _prepareFixedPoseCrossFading(animatorLayerData) {
28843
- var crossOwnerLayerDataCollection = animatorLayerData.crossOwnerLayerDataCollection;
28936
+ var crossLayerOwnerCollection = animatorLayerData.crossLayerOwnerCollection;
28844
28937
  // Save current cross curve data owner fixed pose.
28845
- for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
28846
- var layerOwner = crossOwnerLayerDataCollection[i];
28938
+ for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
28939
+ var layerOwner = crossLayerOwnerCollection[i];
28847
28940
  if (!layerOwner) continue;
28848
28941
  layerOwner.curveOwner.saveFixedPoseValue();
28849
28942
  // Reset destCurveIndex When fixed pose crossFading again.
@@ -28871,7 +28964,6 @@
28871
28964
  layerOwner.crossDestCurveIndex = i;
28872
28965
  } else {
28873
28966
  var owner = layerOwner.curveOwner;
28874
- owner.saveDefaultValue();
28875
28967
  saveFixed && owner.saveFixedPoseValue();
28876
28968
  layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
28877
28969
  this._addCrossOwner(animatorLayerData, layerOwner, -1, i);
@@ -28889,7 +28981,7 @@
28889
28981
  var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData, crossFadeTransitionInfo = layerData.crossFadeTransition;
28890
28982
  var additive = blendingMode === exports.AnimatorLayerBlendingMode.Additive;
28891
28983
  firstLayer && (weight = 1.0);
28892
- //TODO: 任意情况都应该检查,后面要优化
28984
+ //@todo: All situations should be checked, optimizations will follow later.
28893
28985
  layerData.layerState !== LayerState.FixedCrossFading && this._checkTransition(srcPlayData, crossFadeTransitionInfo, layerIndex);
28894
28986
  switch(layerData.layerState){
28895
28987
  case LayerState.Playing:
@@ -28901,6 +28993,9 @@
28901
28993
  case LayerState.CrossFading:
28902
28994
  this._updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, deltaTime, additive, aniUpdate);
28903
28995
  break;
28996
+ case LayerState.Finished:
28997
+ this._updateFinishedState(srcPlayData, weight, additive, aniUpdate);
28998
+ break;
28904
28999
  }
28905
29000
  };
28906
29001
  _proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
@@ -28908,19 +29003,26 @@
28908
29003
  var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
28909
29004
  var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
28910
29005
  playData.update(this.speed < 0);
28911
- if (!aniUpdate) {
28912
- return;
28913
- }
28914
29006
  var clipTime = playData.clipTime, playState = playData.playState;
28915
- eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
28916
- for(var i = curveBindings.length - 1; i >= 0; i--){
28917
- var _curveLayerOwner_i;
28918
- (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.evaluateAndApplyValue(curveBindings[i].curve, clipTime, weight, additive);
29007
+ var finished = playState === AnimatorStatePlayState.Finished;
29008
+ if (aniUpdate || finished) {
29009
+ for(var i = curveBindings.length - 1; i >= 0; i--){
29010
+ var layerOwner = curveLayerOwner[i];
29011
+ var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
29012
+ if (!owner) continue;
29013
+ var curve = curveBindings[i].curve;
29014
+ if (curve.keys.length) {
29015
+ var value = owner.evaluateValue(curve, clipTime, additive);
29016
+ aniUpdate && owner.applyValue(value, weight, additive);
29017
+ finished && layerOwner.saveFinalValue();
29018
+ }
29019
+ }
28919
29020
  }
28920
29021
  playData.frameTime += state.speed * delta;
28921
29022
  if (playState === AnimatorStatePlayState.Finished) {
28922
- layerData.layerState = LayerState.Standby;
29023
+ layerData.layerState = LayerState.Finished;
28923
29024
  }
29025
+ eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
28924
29026
  if (lastPlayState === AnimatorStatePlayState.UnStarted) {
28925
29027
  this._callAnimatorScriptOnEnter(state, layerIndex);
28926
29028
  }
@@ -28931,7 +29033,7 @@
28931
29033
  }
28932
29034
  };
28933
29035
  _proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
28934
- var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
29036
+ var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
28935
29037
  var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
28936
29038
  var srcState = srcPlayData.state, srcStateData = srcPlayData.stateData, lastSrcPlayState = srcPlayData.playState;
28937
29039
  var srcEventHandlers = srcStateData.eventHandlers;
@@ -28940,18 +29042,27 @@
28940
29042
  var _destState_clip = destState.clip, destCurves = _destState_clip._curveBindings;
28941
29043
  var lastSrcClipTime = srcPlayData.clipTime;
28942
29044
  var lastDestClipTime = destPlayData.clipTime;
28943
- var crossWeight = Math.abs(destPlayData.frameTime) / (destState._getDuration() * layerData.crossFadeTransition.duration);
28944
- crossWeight >= 1.0 && (crossWeight = 1.0);
29045
+ var duration = destState._getDuration() * layerData.crossFadeTransition.duration;
29046
+ var crossWeight = Math.abs(destPlayData.frameTime) / duration;
29047
+ (crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
28945
29048
  srcPlayData.update(this.speed < 0);
28946
29049
  destPlayData.update(this.speed < 0);
28947
- var srcPlayState = srcPlayData.playState;
28948
- var destPlayState = destPlayData.playState;
28949
- this._updateCrossFadeData(layerData, crossWeight, delta, false);
28950
- if (!aniUpdate) {
28951
- return;
29050
+ var srcClipTime = srcPlayData.clipTime, srcPlayState = srcPlayData.playState;
29051
+ var destClipTime = destPlayData.clipTime, destPlayState = destPlayData.playState;
29052
+ var finished = destPlayData.playState === AnimatorStatePlayState.Finished;
29053
+ if (aniUpdate || finished) {
29054
+ for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
29055
+ var layerOwner = crossLayerOwnerCollection[i];
29056
+ var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
29057
+ if (!owner) continue;
29058
+ var srcCurveIndex = layerOwner.crossSrcCurveIndex;
29059
+ var destCurveIndex = layerOwner.crossDestCurveIndex;
29060
+ var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
29061
+ aniUpdate && owner.applyValue(value, weight, additive);
29062
+ finished && layerOwner.saveFinalValue();
29063
+ }
28952
29064
  }
28953
- var srcClipTime = srcPlayData.clipTime;
28954
- var destClipTime = destPlayData.clipTime;
29065
+ this._updateCrossFadeData(layerData, crossWeight, delta, false);
28955
29066
  srcEventHandlers.length && this._fireAnimationEvents(srcPlayData, srcEventHandlers, lastSrcClipTime, srcClipTime);
28956
29067
  destEventHandlers.length && this._fireAnimationEvents(destPlayData, destEventHandlers, lastDestClipTime, destClipTime);
28957
29068
  if (lastSrcPlayState === AnimatorStatePlayState.UnStarted) {
@@ -28970,30 +29081,34 @@
28970
29081
  } else {
28971
29082
  this._callAnimatorScriptOnUpdate(destState, layerIndex);
28972
29083
  }
28973
- for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
28974
- var layerOwner = crossOwnerLayerDataCollection[i];
28975
- if (!layerOwner) continue;
28976
- var srcCurveIndex = layerOwner.crossSrcCurveIndex;
28977
- var destCurveIndex = layerOwner.crossDestCurveIndex;
28978
- layerOwner.curveOwner.crossFadeAndApplyValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
28979
- }
28980
29084
  };
28981
- _proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, layerWeight, delta, additive, aniUpdate) {
28982
- var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
29085
+ _proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
29086
+ var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
28983
29087
  var state = destPlayData.state, stateData = destPlayData.stateData, lastPlayState = destPlayData.playState;
28984
29088
  var eventHandlers = stateData.eventHandlers;
28985
29089
  var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
28986
29090
  var lastDestClipTime = destPlayData.clipTime;
28987
- var crossWeight = Math.abs(destPlayData.frameTime) / (state._getDuration() * layerData.crossFadeTransition.duration);
28988
- crossWeight >= 1.0 && (crossWeight = 1.0);
29091
+ var duration = state._getDuration() * layerData.crossFadeTransition.duration;
29092
+ var crossWeight = Math.abs(destPlayData.frameTime) / duration;
29093
+ (crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
28989
29094
  destPlayData.update(this.speed < 0);
28990
29095
  var playState = destPlayData.playState;
28991
29096
  this._updateCrossFadeData(layerData, crossWeight, delta, true);
28992
- if (!aniUpdate) {
28993
- return;
28994
- }
28995
29097
  var destClipTime = destPlayData.clipTime;
28996
- //TODO: srcState 少了最新一段时间的判断
29098
+ var finished = playState === AnimatorStatePlayState.Finished;
29099
+ // When the animator is culled (aniUpdate=false), if the play state has finished, the final value needs to be calculated and saved to be applied directly.
29100
+ if (aniUpdate || finished) {
29101
+ for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
29102
+ var layerOwner = crossLayerOwnerCollection[i];
29103
+ var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
29104
+ if (!owner) continue;
29105
+ var curveIndex = layerOwner.crossDestCurveIndex;
29106
+ var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
29107
+ aniUpdate && owner.applyValue(value, weight, additive);
29108
+ finished && layerOwner.saveFinalValue();
29109
+ }
29110
+ }
29111
+ //@todo: srcState is missing the judgment of the most recent period."
28997
29112
  eventHandlers.length && this._fireAnimationEvents(destPlayData, eventHandlers, lastDestClipTime, destClipTime);
28998
29113
  if (lastPlayState === AnimatorStatePlayState.UnStarted) {
28999
29114
  this._callAnimatorScriptOnEnter(state, layerIndex);
@@ -29003,11 +29118,18 @@
29003
29118
  } else {
29004
29119
  this._callAnimatorScriptOnUpdate(state, layerIndex);
29005
29120
  }
29006
- for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
29007
- var layerOwner = crossOwnerLayerDataCollection[i];
29008
- if (!layerOwner) continue;
29009
- var curveIndex = layerOwner.crossDestCurveIndex;
29010
- layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, layerWeight, additive);
29121
+ };
29122
+ _proto._updateFinishedState = function _updateFinishedState(playData, weight, additive, aniUpdate) {
29123
+ if (!aniUpdate) {
29124
+ return;
29125
+ }
29126
+ var curveLayerOwner = playData.stateData.curveLayerOwner;
29127
+ var _playData_state_clip = playData.state.clip, curveBindings = _playData_state_clip._curveBindings;
29128
+ for(var i = curveBindings.length - 1; i >= 0; i--){
29129
+ var layerOwner = curveLayerOwner[i];
29130
+ var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
29131
+ if (!owner) continue;
29132
+ owner.applyValue(layerOwner.finalValue, weight, additive);
29011
29133
  }
29012
29134
  };
29013
29135
  _proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
@@ -29015,7 +29137,7 @@
29015
29137
  destPlayData.frameTime += destPlayData.state.speed * delta;
29016
29138
  if (crossWeight === 1.0) {
29017
29139
  if (destPlayData.playState === AnimatorStatePlayState.Finished) {
29018
- layerData.layerState = LayerState.Standby;
29140
+ layerData.layerState = LayerState.Finished;
29019
29141
  } else {
29020
29142
  layerData.layerState = LayerState.Playing;
29021
29143
  }
@@ -29025,7 +29147,7 @@
29025
29147
  fixed || (layerData.srcPlayData.frameTime += layerData.srcPlayData.state.speed * delta);
29026
29148
  }
29027
29149
  };
29028
- _proto._preparePlay = function _preparePlay(layerData, playState, playStateData) {
29150
+ _proto._preparePlay = function _preparePlay(layerData, playState) {
29029
29151
  if (layerData.layerState === LayerState.Playing) {
29030
29152
  var srcPlayData = layerData.srcPlayData;
29031
29153
  if (srcPlayData.state !== playState) {
@@ -29033,18 +29155,16 @@
29033
29155
  for(var i = curveLayerOwner.length - 1; i >= 0; i--){
29034
29156
  var _curveLayerOwner_i;
29035
29157
  var owner = (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner;
29036
- (owner == null ? void 0 : owner.hasSavedDefaultValue) && owner.revertDefaultValue();
29158
+ owner.revertDefaultValue();
29037
29159
  }
29038
- this._saveDefaultValues(playStateData);
29039
29160
  }
29040
29161
  } else {
29041
- // layerState is CrossFading, FixedCrossFading, Standby
29042
- var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
29043
- for(var i1 = crossOwnerLayerDataCollection.length - 1; i1 >= 0; i1--){
29044
- var owner1 = crossOwnerLayerDataCollection[i1].curveOwner;
29045
- owner1.hasSavedDefaultValue && owner1.revertDefaultValue();
29162
+ // layerState is CrossFading, FixedCrossFading, Standby, Finished
29163
+ var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
29164
+ for(var i1 = crossLayerOwnerCollection.length - 1; i1 >= 0; i1--){
29165
+ var owner1 = crossLayerOwnerCollection[i1].curveOwner;
29166
+ owner1.revertDefaultValue();
29046
29167
  }
29047
- this._saveDefaultValues(playStateData);
29048
29168
  }
29049
29169
  };
29050
29170
  _proto._checkTransition = function _checkTransition(stateData, crossFadeTransition, layerIndex) {
@@ -29061,7 +29181,7 @@
29061
29181
  _proto._crossFadeByTransition = function _crossFadeByTransition(transition, layerIndex) {
29062
29182
  var name = transition.destinationState.name;
29063
29183
  var stateInfo = this._getAnimatorStateInfo(name, layerIndex);
29064
- var crossState = stateInfo.state;
29184
+ var crossState = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
29065
29185
  if (!crossState) {
29066
29186
  return;
29067
29187
  }
@@ -29069,21 +29189,21 @@
29069
29189
  console.warn("The state named " + name + " has no AnimationClip data.");
29070
29190
  return;
29071
29191
  }
29072
- var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
29192
+ var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
29073
29193
  var layerState = animatorLayerData.layerState;
29074
29194
  var destPlayData = animatorLayerData.destPlayData;
29075
- var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData);
29195
+ var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData, playLayerIndex);
29076
29196
  var duration = crossState._getDuration();
29077
29197
  var offset = duration * transition.offset;
29078
29198
  destPlayData.reset(crossState, animatorStateData, offset);
29079
29199
  switch(layerState){
29080
- // Maybe not play, maybe end.
29081
29200
  case LayerState.Standby:
29082
29201
  animatorLayerData.layerState = LayerState.FixedCrossFading;
29083
29202
  this._clearCrossData(animatorLayerData);
29084
29203
  this._prepareStandbyCrossFading(animatorLayerData);
29085
29204
  break;
29086
29205
  case LayerState.Playing:
29206
+ case LayerState.Finished:
29087
29207
  animatorLayerData.layerState = LayerState.CrossFading;
29088
29208
  this._clearCrossData(animatorLayerData);
29089
29209
  this._prepareCrossFading(animatorLayerData);
@@ -29180,6 +29300,12 @@
29180
29300
  }
29181
29301
  }
29182
29302
  };
29303
+ _proto._revertCurveOwners = function _revertCurveOwners() {
29304
+ var curveOwners = this._needRevertCurveOwners;
29305
+ for(var i = 0, n = curveOwners.length; i < n; ++i){
29306
+ curveOwners[i].revertDefaultValue();
29307
+ }
29308
+ };
29183
29309
  _create_class$3(Animator, [
29184
29310
  {
29185
29311
  key: "animatorController",
@@ -29212,6 +29338,9 @@
29212
29338
  __decorate$1([
29213
29339
  ignoreClone
29214
29340
  ], Animator.prototype, "_curveOwnerPool", void 0);
29341
+ __decorate$1([
29342
+ ignoreClone
29343
+ ], Animator.prototype, "_needRevertCurveOwners", void 0);
29215
29344
  __decorate$1([
29216
29345
  ignoreClone
29217
29346
  ], Animator.prototype, "_animationEventHandlerPool", void 0);
@@ -38178,7 +38307,7 @@
38178
38307
  ], GALACEAN_animation_event);
38179
38308
 
38180
38309
  //@ts-ignore
38181
- var version = "1.0.0-beta.12";
38310
+ var version = "1.0.0-beta.13";
38182
38311
  console.log("Galacean engine version: " + version);
38183
38312
  for(var key in CoreObjects){
38184
38313
  Loader.registerClass(key, CoreObjects[key]);