@galacean/engine 0.9.13 → 0.9.15

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
@@ -25994,8 +25994,6 @@
25994
25994
  * @internal
25995
25995
  */ var AnimationCurveOwner = /*#__PURE__*/ function() {
25996
25996
  function AnimationCurveOwner(target, type, property, cureType) {
25997
- this.crossCurveMark = 0;
25998
- this.hasSavedDefaultValue = false;
25999
25997
  this.baseEvaluateData = {
26000
25998
  curKeyframeIndex: 0,
26001
25999
  value: null
@@ -26008,7 +26006,7 @@
26008
26006
  this.type = type;
26009
26007
  this.property = property;
26010
26008
  this.component = target.getComponent(type);
26011
- this._cureType = cureType;
26009
+ this.cureType = cureType;
26012
26010
  var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
26013
26011
  this._assembler = new assemblerType();
26014
26012
  this._assembler.initialize(this);
@@ -26017,89 +26015,80 @@
26017
26015
  }
26018
26016
  }
26019
26017
  var _proto = AnimationCurveOwner.prototype;
26020
- _proto.evaluateAndApplyValue = function evaluateAndApplyValue(curve, time, layerWeight, additive) {
26021
- if (curve.keys.length) {
26022
- if (additive) {
26023
- var value = curve._evaluateAdditive(time, this.baseEvaluateData);
26024
- var cureType = this._cureType;
26025
- if (cureType._isReferenceType) {
26026
- cureType._additiveValue(value, layerWeight, this.referenceTargetValue);
26027
- } else {
26028
- var assembler = this._assembler;
26029
- var originValue = assembler.getTargetValue();
26030
- var additiveValue = cureType._additiveValue(value, layerWeight, originValue);
26031
- assembler.setTargetValue(additiveValue);
26032
- }
26033
- } else {
26034
- var value1 = curve._evaluate(time, this.baseEvaluateData);
26035
- this._applyValue(value1, layerWeight);
26036
- }
26037
- }
26018
+ _proto.evaluateValue = function evaluateValue(curve, time, additive) {
26019
+ return additive ? curve._evaluateAdditive(time, this.baseEvaluateData) : curve._evaluate(time, this.baseEvaluateData);
26038
26020
  };
26039
- _proto.crossFadeAndApplyValue = function crossFadeAndApplyValue(srcCurve, destCurve, srcTime, destTime, crossWeight, layerWeight, additive) {
26040
- 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;
26041
- 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;
26042
- this._applyCrossValue(srcValue, destValue, crossWeight, layerWeight, additive);
26021
+ _proto.evaluateCrossFadeValue = function evaluateCrossFadeValue(srcCurve, destCurve, srcTime, destTime, crossWeight, additive) {
26022
+ 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;
26023
+ 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;
26024
+ return this._lerpValue(srcValue, destValue, crossWeight);
26043
26025
  };
26044
- _proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight, layerWeight, additive) {
26045
- var srcValue = additive ? this._cureType._subtractValue(this.fixedPoseValue, this.defaultValue, this.baseEvaluateData.value) : this.fixedPoseValue;
26046
- 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;
26047
- this._applyCrossValue(srcValue, destValue, crossWeight, layerWeight, additive);
26026
+ _proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight, additive) {
26027
+ var srcValue = additive ? this.cureType._subtractValue(this.fixedPoseValue, this.defaultValue, this.baseEvaluateData.value) : this.fixedPoseValue;
26028
+ 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;
26029
+ return this._lerpValue(srcValue, destValue, crossWeight);
26048
26030
  };
26049
26031
  _proto.revertDefaultValue = function revertDefaultValue() {
26050
26032
  this._assembler.setTargetValue(this.defaultValue);
26051
26033
  };
26034
+ _proto.getEvaluateValue = function getEvaluateValue(out) {
26035
+ if (this.cureType._isReferenceType) {
26036
+ this.cureType._copyValue(this.baseEvaluateData.value, out);
26037
+ return out;
26038
+ } else {
26039
+ return this.baseEvaluateData.value;
26040
+ }
26041
+ };
26052
26042
  _proto.saveDefaultValue = function saveDefaultValue() {
26053
- if (this._cureType._isReferenceType) {
26054
- this._cureType._copyValue(this.referenceTargetValue, this.defaultValue);
26043
+ if (this.cureType._isReferenceType) {
26044
+ this.cureType._copyValue(this.referenceTargetValue, this.defaultValue);
26055
26045
  } else {
26056
26046
  this.defaultValue = this._assembler.getTargetValue();
26057
26047
  }
26058
- this.hasSavedDefaultValue = true;
26059
26048
  };
26060
26049
  _proto.saveFixedPoseValue = function saveFixedPoseValue() {
26061
- if (this._cureType._isReferenceType) {
26062
- this._cureType._copyValue(this.referenceTargetValue, this.fixedPoseValue);
26050
+ if (this.cureType._isReferenceType) {
26051
+ this.cureType._copyValue(this.referenceTargetValue, this.fixedPoseValue);
26063
26052
  } else {
26064
26053
  this.fixedPoseValue = this._assembler.getTargetValue();
26065
26054
  }
26066
26055
  };
26067
- _proto._applyValue = function _applyValue(value, weight) {
26068
- if (weight === 1.0) {
26069
- if (this._cureType._isReferenceType) {
26070
- this._cureType._copyValue(value, this.referenceTargetValue);
26056
+ _proto.applyValue = function applyValue(value, weight, additive) {
26057
+ var cureType = this.cureType;
26058
+ if (additive) {
26059
+ if (cureType._isReferenceType) {
26060
+ cureType._additiveValue(value, weight, this.referenceTargetValue);
26071
26061
  } else {
26072
- this._assembler.setTargetValue(value);
26062
+ var assembler = this._assembler;
26063
+ var originValue = assembler.getTargetValue();
26064
+ var additiveValue = cureType._additiveValue(value, weight, originValue);
26065
+ assembler.setTargetValue(additiveValue);
26073
26066
  }
26074
26067
  } else {
26075
- if (this._cureType._isReferenceType) {
26076
- var targetValue = this.referenceTargetValue;
26077
- this._cureType._lerpValue(targetValue, value, weight, targetValue);
26068
+ if (weight === 1.0) {
26069
+ if (cureType._isReferenceType) {
26070
+ cureType._copyValue(value, this.referenceTargetValue);
26071
+ } else {
26072
+ this._assembler.setTargetValue(value);
26073
+ }
26078
26074
  } else {
26079
- var originValue = this._assembler.getTargetValue();
26080
- var lerpValue = this._cureType._lerpValue(originValue, value, weight);
26081
- this._assembler.setTargetValue(lerpValue);
26075
+ if (cureType._isReferenceType) {
26076
+ var targetValue = this.referenceTargetValue;
26077
+ cureType._lerpValue(targetValue, value, weight, targetValue);
26078
+ } else {
26079
+ var originValue1 = this._assembler.getTargetValue();
26080
+ var lerpValue = cureType._lerpValue(originValue1, value, weight);
26081
+ this._assembler.setTargetValue(lerpValue);
26082
+ }
26082
26083
  }
26083
26084
  }
26084
26085
  };
26085
- _proto._applyCrossValue = function _applyCrossValue(srcValue, destValue, crossWeight, layerWeight, additive) {
26086
- var out;
26087
- if (this._cureType._isReferenceType) {
26088
- out = this.baseEvaluateData.value;
26089
- this._cureType._lerpValue(srcValue, destValue, crossWeight, out);
26090
- } else {
26091
- out = this._cureType._lerpValue(srcValue, destValue, crossWeight);
26092
- }
26093
- if (additive) {
26094
- if (this._cureType._isReferenceType) {
26095
- this._cureType._additiveValue(out, layerWeight, this.referenceTargetValue);
26096
- } else {
26097
- var originValue = this._assembler.getTargetValue();
26098
- var lerpValue = this._cureType._additiveValue(out, layerWeight, originValue);
26099
- this._assembler.setTargetValue(lerpValue);
26100
- }
26086
+ _proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
26087
+ if (this.cureType._isReferenceType) {
26088
+ return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
26101
26089
  } else {
26102
- this._applyValue(out, layerWeight);
26090
+ this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
26091
+ return this.baseEvaluateData.value;
26103
26092
  }
26104
26093
  };
26105
26094
  AnimationCurveOwner.registerAssembler = function registerAssembler(componentType, property, assemblerType) {
@@ -26188,6 +26177,26 @@
26188
26177
  return BlendShapeWeightsAnimationCurveOwnerAssembler;
26189
26178
  }();
26190
26179
  AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights", BlendShapeWeightsAnimationCurveOwnerAssembler);
26180
+ /**
26181
+ * @internal
26182
+ */ var AnimationCurveLayerOwner = /*#__PURE__*/ function() {
26183
+ var AnimationCurveLayerOwner = function AnimationCurveLayerOwner() {
26184
+ this.crossCurveMark = 0;
26185
+ };
26186
+ var _proto = AnimationCurveLayerOwner.prototype;
26187
+ _proto.initFinalValue = function initFinalValue() {
26188
+ var _this_curveOwner = this.curveOwner, cureType = _this_curveOwner.cureType, defaultValue = _this_curveOwner.defaultValue;
26189
+ if (cureType._isReferenceType) {
26190
+ cureType._copyValue(defaultValue, this.finalValue);
26191
+ } else {
26192
+ this.finalValue = defaultValue;
26193
+ }
26194
+ };
26195
+ _proto.saveFinalValue = function saveFinalValue() {
26196
+ this.finalValue = this.curveOwner.getEvaluateValue(this.finalValue);
26197
+ };
26198
+ return AnimationCurveLayerOwner;
26199
+ }();
26191
26200
  /**
26192
26201
  * Associate AnimationCurve and the Entity
26193
26202
  */ var AnimationClipCurveBinding = /*#__PURE__*/ function() {
@@ -26201,10 +26210,22 @@
26201
26210
  var curveType = this.curve.constructor;
26202
26211
  var owner = new AnimationCurveOwner(entity, this.type, this.property, curveType);
26203
26212
  curveType._initializeOwner(owner);
26213
+ owner.saveDefaultValue();
26204
26214
  return owner;
26205
26215
  };
26206
26216
  /**
26207
26217
  * @internal
26218
+ */ _proto._createCurveLayerOwner = function _createCurveLayerOwner(owner) {
26219
+ var curveType = this.curve.constructor;
26220
+ var layerOwner = new AnimationCurveLayerOwner();
26221
+ layerOwner.curveOwner = owner;
26222
+ curveType._initializeLayerOwner(layerOwner);
26223
+ // If curve.keys.length is 0, updateFinishedState will assign 0 to the target, causing an error, so initialize by assigning defaultValue to finalValue.
26224
+ layerOwner.initFinalValue();
26225
+ return layerOwner;
26226
+ };
26227
+ /**
26228
+ * @internal
26208
26229
  */ _proto._getTempCurveOwner = function _getTempCurveOwner(entity) {
26209
26230
  var instanceId = entity.instanceId;
26210
26231
  if (!this._tempCurveOwner[instanceId]) {
@@ -26281,7 +26302,8 @@
26281
26302
  var targetEntity = entity.findByPath(curveData.relativePath);
26282
26303
  if (targetEntity) {
26283
26304
  var curveOwner = curveData._getTempCurveOwner(targetEntity);
26284
- curveOwner.evaluateAndApplyValue(curveData.curve, time, 1, false);
26305
+ var value = curveOwner.evaluateValue(curveData.curve, time, false);
26306
+ curveOwner.applyValue(value, 1, false);
26285
26307
  }
26286
26308
  }
26287
26309
  };
@@ -26423,6 +26445,7 @@
26423
26445
  break;
26424
26446
  }
26425
26447
  }
26448
+ evaluateData.value = value;
26426
26449
  return value;
26427
26450
  };
26428
26451
  /**
@@ -26478,6 +26501,11 @@
26478
26501
  };
26479
26502
  /**
26480
26503
  * @internal
26504
+ */ AnimationArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
26505
+ owner.finalValue = [];
26506
+ };
26507
+ /**
26508
+ * @internal
26481
26509
  */ AnimationArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
26482
26510
  for(var i = 0, n = out.length; i < n; ++i){
26483
26511
  var src = srcValue[i];
@@ -26567,6 +26595,11 @@
26567
26595
  };
26568
26596
  /**
26569
26597
  * @internal
26598
+ */ AnimationBoolCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
26599
+ owner.finalValue = false;
26600
+ };
26601
+ /**
26602
+ * @internal
26570
26603
  */ AnimationBoolCurve._lerpValue = function _lerpValue(srcValue, destValue) {
26571
26604
  return destValue;
26572
26605
  };
@@ -26623,6 +26656,11 @@
26623
26656
  };
26624
26657
  /**
26625
26658
  * @internal
26659
+ */ AnimationColorCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
26660
+ owner.finalValue = new Color$1();
26661
+ };
26662
+ /**
26663
+ * @internal
26626
26664
  */ AnimationColorCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
26627
26665
  Color$1.lerp(srcValue, destValue, weight, out);
26628
26666
  return out;
@@ -26729,6 +26767,12 @@
26729
26767
  };
26730
26768
  /**
26731
26769
  * @internal
26770
+ */ AnimationFloatArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
26771
+ var size = owner.curveOwner.referenceTargetValue.length;
26772
+ owner.finalValue = new Float32Array(size);
26773
+ };
26774
+ /**
26775
+ * @internal
26732
26776
  */ AnimationFloatArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
26733
26777
  for(var i = 0, n = out.length; i < n; ++i){
26734
26778
  var src = srcValue[i];
@@ -26818,6 +26862,11 @@
26818
26862
  };
26819
26863
  /**
26820
26864
  * @internal
26865
+ */ AnimationFloatCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
26866
+ owner.finalValue = 0;
26867
+ };
26868
+ /**
26869
+ * @internal
26821
26870
  */ AnimationFloatCurve._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
26822
26871
  return srcValue + (destValue - srcValue) * crossWeight;
26823
26872
  };
@@ -26886,6 +26935,11 @@
26886
26935
  };
26887
26936
  /**
26888
26937
  * @internal
26938
+ */ AnimationQuaternionCurve1._initializeLayerOwner = function _initializeLayerOwner(owner) {
26939
+ owner.finalValue = new Quaternion();
26940
+ };
26941
+ /**
26942
+ * @internal
26889
26943
  */ AnimationQuaternionCurve1._lerpValue = function _lerpValue(src, dest, weight, out) {
26890
26944
  Quaternion.slerp(src, dest, weight, out);
26891
26945
  return out;
@@ -26989,6 +27043,11 @@
26989
27043
  };
26990
27044
  /**
26991
27045
  * @internal
27046
+ */ AnimationVector2Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
27047
+ owner.finalValue = new Vector2();
27048
+ };
27049
+ /**
27050
+ * @internal
26992
27051
  */ AnimationVector2Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
26993
27052
  Vector2.lerp(srcValue, destValue, weight, out);
26994
27053
  return out;
@@ -27073,6 +27132,11 @@
27073
27132
  };
27074
27133
  /**
27075
27134
  * @internal
27135
+ */ AnimationVector3Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
27136
+ owner.finalValue = new Vector3();
27137
+ };
27138
+ /**
27139
+ * @internal
27076
27140
  */ AnimationVector3Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
27077
27141
  Vector3.lerp(srcValue, destValue, weight, out);
27078
27142
  return out;
@@ -27169,6 +27233,11 @@
27169
27233
  };
27170
27234
  /**
27171
27235
  * @internal
27236
+ */ AnimationVector4Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
27237
+ owner.finalValue = new Vector4();
27238
+ };
27239
+ /**
27240
+ * @internal
27172
27241
  */ AnimationVector4Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
27173
27242
  Vector4.lerp(srcValue, destValue, weight, out);
27174
27243
  return out;
@@ -27274,6 +27343,7 @@
27274
27343
  LayerState[LayerState[/** Playing state. */ "Playing"] = 1] = "Playing";
27275
27344
  LayerState[LayerState[/** CrossFading state. */ "CrossFading"] = 2] = "CrossFading";
27276
27345
  LayerState[LayerState[/** FixedCrossFading state. */ "FixedCrossFading"] = 3] = "FixedCrossFading";
27346
+ LayerState[LayerState[/** Finished state. */ "Finished"] = 4] = "Finished";
27277
27347
  })(LayerState || (LayerState = {}));
27278
27348
  /**
27279
27349
  * @internal
@@ -27340,12 +27410,14 @@
27340
27410
  * @internal
27341
27411
  */ var AnimatorLayerData = /*#__PURE__*/ function() {
27342
27412
  var AnimatorLayerData = function AnimatorLayerData() {
27413
+ this.curveOwnerPool = Object.create(null);
27343
27414
  this.animatorStateDataMap = {};
27344
27415
  this.srcPlayData = new AnimatorStatePlayData();
27345
27416
  this.destPlayData = new AnimatorStatePlayData();
27346
27417
  this.layerState = LayerState.Standby;
27347
27418
  this.crossCurveMark = 0;
27348
27419
  this.manuallyTransition = new AnimatorStateTransition();
27420
+ this.crossLayerOwnerCollection = [];
27349
27421
  };
27350
27422
  var _proto = AnimatorLayerData.prototype;
27351
27423
  _proto.switchPlayData = function switchPlayData() {
@@ -27359,7 +27431,7 @@
27359
27431
  /**
27360
27432
  * @internal
27361
27433
  */ var AnimatorStateData = function AnimatorStateData() {
27362
- this.curveOwners = [];
27434
+ this.curveLayerOwner = [];
27363
27435
  this.eventHandlers = [];
27364
27436
  };
27365
27437
  /**
@@ -27371,8 +27443,8 @@
27371
27443
  /** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
27372
27444
  /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
27373
27445
  _this._animatorLayersData = [];
27374
- _this._crossOwnerCollection = [];
27375
- _this._animationCurveOwners = [];
27446
+ _this._curveOwnerPool = Object.create(null);
27447
+ _this._needRevertCurveOwners = [];
27376
27448
  _this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
27377
27449
  _this._tempAnimatorStateInfo = {
27378
27450
  layerIndex: -1,
@@ -27396,7 +27468,7 @@
27396
27468
  this._reset();
27397
27469
  }
27398
27470
  var stateInfo = this._getAnimatorStateInfo(stateName, layerIndex);
27399
- var state = stateInfo.state;
27471
+ var state = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
27400
27472
  if (!state) {
27401
27473
  return;
27402
27474
  }
@@ -27405,9 +27477,8 @@
27405
27477
  return;
27406
27478
  }
27407
27479
  var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
27408
- //TODO CM: Not consider same stateName, but different animation
27409
- var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData);
27410
- this._preparePlay(animatorLayerData, state, animatorStateData);
27480
+ var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData, playLayerIndex);
27481
+ this._preparePlay(animatorLayerData, state);
27411
27482
  animatorLayerData.layerState = LayerState.Playing;
27412
27483
  animatorLayerData.srcPlayData.reset(state, animatorStateData, state._getDuration() * normalizedTimeOffset);
27413
27484
  };
@@ -27458,6 +27529,7 @@
27458
27529
  return;
27459
27530
  }
27460
27531
  deltaTime *= this.speed;
27532
+ this._revertCurveOwners();
27461
27533
  for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
27462
27534
  var animatorLayerData = this._getAnimatorLayerData(i1);
27463
27535
  if (animatorLayerData.layerState === LayerState.Standby) {
@@ -27498,17 +27570,17 @@
27498
27570
  /**
27499
27571
  * @internal
27500
27572
  */ _proto._reset = function _reset() {
27501
- var _this = this, animationCurveOwners = _this._animationCurveOwners;
27573
+ var _this = this, animationCurveOwners = _this._curveOwnerPool;
27502
27574
  for(var instanceId in animationCurveOwners){
27503
27575
  var propertyOwners = animationCurveOwners[instanceId];
27504
27576
  for(var property in propertyOwners){
27505
27577
  var owner = propertyOwners[property];
27506
- owner.hasSavedDefaultValue && owner.revertDefaultValue();
27578
+ owner.revertDefaultValue();
27507
27579
  }
27508
27580
  }
27509
27581
  this._animatorLayersData.length = 0;
27510
- this._crossOwnerCollection.length = 0;
27511
- this._animationCurveOwners.length = 0;
27582
+ this._needRevertCurveOwners.length = 0;
27583
+ this._curveOwnerPool = {};
27512
27584
  this._animationEventHandlerPool.resetPool();
27513
27585
  if (this._controllerUpdateFlag) {
27514
27586
  this._controllerUpdateFlag.flag = false;
@@ -27535,38 +27607,51 @@
27535
27607
  stateInfo.state = state;
27536
27608
  return stateInfo;
27537
27609
  };
27538
- _proto._saveDefaultValues = function _saveDefaultValues(stateData) {
27539
- var curveOwners = stateData.curveOwners;
27540
- for(var i = curveOwners.length - 1; i >= 0; i--){
27541
- var _curveOwners_i;
27542
- (_curveOwners_i = curveOwners[i]) == null ? void 0 : _curveOwners_i.saveDefaultValue();
27543
- }
27544
- };
27545
- _proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData) {
27610
+ _proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData, layerIndex) {
27546
27611
  var animatorStateDataMap = animatorLayerData.animatorStateDataMap;
27547
27612
  var animatorStateData = animatorStateDataMap[stateName];
27548
27613
  if (!animatorStateData) {
27549
27614
  animatorStateData = new AnimatorStateData();
27550
27615
  animatorStateDataMap[stateName] = animatorStateData;
27551
- this._saveAnimatorStateData(animatorState, animatorStateData);
27616
+ this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex);
27552
27617
  this._saveAnimatorEventHandlers(animatorState, animatorStateData);
27553
27618
  }
27554
27619
  return animatorStateData;
27555
27620
  };
27556
- _proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData) {
27557
- var _this = this, entity = _this.entity, animationCureOwners = _this._animationCurveOwners;
27558
- var curveOwners = animatorStateData.curveOwners;
27621
+ _proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex) {
27622
+ var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
27623
+ var curveLayerOwner = animatorStateData.curveLayerOwner;
27624
+ var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
27559
27625
  var _animatorState_clip = animatorState.clip, curves = _animatorState_clip._curveBindings;
27560
27626
  for(var i = curves.length - 1; i >= 0; i--){
27561
27627
  var curve = curves[i];
27562
27628
  var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
27563
27629
  if (targetEntity) {
27630
+ var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
27564
27631
  var property = curve.property;
27565
27632
  var instanceId = targetEntity.instanceId;
27566
- var propertyOwners = animationCureOwners[instanceId] || (animationCureOwners[instanceId] = {});
27567
- curveOwners[i] = propertyOwners[property] || (propertyOwners[property] = curve._createCurveOwner(targetEntity));
27633
+ var needRevert = false;
27634
+ var baseAnimatorLayerData = this._animatorLayersData[0];
27635
+ var baseLayerCurveOwnerPool = baseAnimatorLayerData.curveOwnerPool;
27636
+ if (this.animatorController.layers[layerIndex].blendingMode === exports.AnimatorLayerBlendingMode.Additive && layerIndex > 0 && !(baseLayerCurveOwnerPool[instanceId] && baseLayerCurveOwnerPool[instanceId][property])) {
27637
+ needRevert = true;
27638
+ }
27639
+ // Get owner
27640
+ var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
27641
+ var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity));
27642
+ //@todo: There is performance waste here, which will be handled together with organizing AnimatorStateData later. The logic is changing from runtime to initialization.
27643
+ if (needRevert) {
27644
+ this._needRevertCurveOwners.push(owner);
27645
+ } else {
27646
+ var index = this._needRevertCurveOwners.indexOf(owner);
27647
+ index > -1 && this._needRevertCurveOwners.splice(index, 1);
27648
+ }
27649
+ // Get layer owner
27650
+ var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
27651
+ var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
27652
+ curveLayerOwner[i] = layerOwner;
27568
27653
  } else {
27569
- curveOwners[i] = null;
27654
+ curveLayerOwner[i] = null;
27570
27655
  console.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
27571
27656
  }
27572
27657
  }
@@ -27594,65 +27679,60 @@
27594
27679
  };
27595
27680
  _proto._clearCrossData = function _clearCrossData(animatorLayerData) {
27596
27681
  animatorLayerData.crossCurveMark++;
27597
- this._crossOwnerCollection.length = 0;
27682
+ animatorLayerData.crossLayerOwnerCollection.length = 0;
27598
27683
  };
27599
- _proto._addCrossCurveData = function _addCrossCurveData(crossCurveData, owner, curCurveIndex, nextCurveIndex) {
27600
- owner.crossSrcCurveIndex = curCurveIndex;
27601
- owner.crossDestCurveIndex = nextCurveIndex;
27602
- crossCurveData.push(owner);
27684
+ _proto._addCrossOwner = function _addCrossOwner(animatorLayerData, layerOwner, curCurveIndex, nextCurveIndex) {
27685
+ layerOwner.crossSrcCurveIndex = curCurveIndex;
27686
+ layerOwner.crossDestCurveIndex = nextCurveIndex;
27687
+ animatorLayerData.crossLayerOwnerCollection.push(layerOwner);
27603
27688
  };
27604
27689
  _proto._prepareCrossFading = function _prepareCrossFading(animatorLayerData) {
27605
- var crossCurveData = this._crossOwnerCollection;
27606
- var crossCurveMark = animatorLayerData.crossCurveMark;
27607
27690
  // Add src cross curve data.
27608
- this._prepareSrcCrossData(crossCurveData, animatorLayerData.srcPlayData, crossCurveMark, false);
27691
+ this._prepareSrcCrossData(animatorLayerData, false);
27609
27692
  // Add dest cross curve data.
27610
- this._prepareDestCrossData(crossCurveData, animatorLayerData.destPlayData, crossCurveMark, false);
27693
+ this._prepareDestCrossData(animatorLayerData, false);
27611
27694
  };
27612
27695
  _proto._prepareStandbyCrossFading = function _prepareStandbyCrossFading(animatorLayerData) {
27613
- var crossOwnerCollection = this._crossOwnerCollection;
27614
- var srcPlayData = animatorLayerData.srcPlayData, crossCurveMark = animatorLayerData.crossCurveMark;
27615
27696
  // Standby have two sub state, one is never play, one is finished, never play srcPlayData.state is null.
27616
- srcPlayData.state && this._prepareSrcCrossData(crossOwnerCollection, srcPlayData, crossCurveMark, true);
27697
+ animatorLayerData.srcPlayData.state && this._prepareSrcCrossData(animatorLayerData, true);
27617
27698
  // Add dest cross curve data.
27618
- this._prepareDestCrossData(crossOwnerCollection, animatorLayerData.destPlayData, crossCurveMark, true);
27699
+ this._prepareDestCrossData(animatorLayerData, true);
27619
27700
  };
27620
27701
  _proto._prepareFixedPoseCrossFading = function _prepareFixedPoseCrossFading(animatorLayerData) {
27621
- var crossOwnerCollection = this._crossOwnerCollection;
27702
+ var crossLayerOwnerCollection = animatorLayerData.crossLayerOwnerCollection;
27622
27703
  // Save current cross curve data owner fixed pose.
27623
- for(var i = crossOwnerCollection.length - 1; i >= 0; i--){
27624
- var item = crossOwnerCollection[i];
27625
- item.saveFixedPoseValue();
27704
+ for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
27705
+ var layerOwner = crossLayerOwnerCollection[i];
27706
+ if (!layerOwner) continue;
27707
+ layerOwner.curveOwner.saveFixedPoseValue();
27626
27708
  // Reset destCurveIndex When fixed pose crossFading again.
27627
- item.crossDestCurveIndex = -1;
27709
+ layerOwner.crossDestCurveIndex = -1;
27628
27710
  }
27629
27711
  // prepare dest AnimatorState cross data.
27630
- this._prepareDestCrossData(crossOwnerCollection, animatorLayerData.destPlayData, animatorLayerData.crossCurveMark, true);
27631
- };
27632
- _proto._prepareSrcCrossData = function _prepareSrcCrossData(crossCurveData, srcPlayData, crossCurveMark, saveFixed) {
27633
- var curveOwners = srcPlayData.stateData.curveOwners;
27634
- for(var i = curveOwners.length - 1; i >= 0; i--){
27635
- var owner = curveOwners[i];
27636
- if (!owner) continue;
27637
- owner.crossCurveMark = crossCurveMark;
27638
- owner.crossCurveDataIndex = crossCurveData.length;
27639
- saveFixed && owner.saveFixedPoseValue();
27640
- this._addCrossCurveData(crossCurveData, owner, i, -1);
27641
- }
27642
- };
27643
- _proto._prepareDestCrossData = function _prepareDestCrossData(crossCurveData, destPlayData, crossCurveMark, saveFixed) {
27644
- var curveOwners = destPlayData.stateData.curveOwners;
27645
- for(var i = curveOwners.length - 1; i >= 0; i--){
27646
- var owner = curveOwners[i];
27647
- if (!owner) continue;
27648
- if (owner.crossCurveMark === crossCurveMark) {
27649
- crossCurveData[owner.crossCurveDataIndex].crossDestCurveIndex = i;
27712
+ this._prepareDestCrossData(animatorLayerData, true);
27713
+ };
27714
+ _proto._prepareSrcCrossData = function _prepareSrcCrossData(animatorLayerData, saveFixed) {
27715
+ var curveLayerOwner = animatorLayerData.srcPlayData.stateData.curveLayerOwner;
27716
+ for(var i = curveLayerOwner.length - 1; i >= 0; i--){
27717
+ var layerOwner = curveLayerOwner[i];
27718
+ if (!layerOwner) continue;
27719
+ layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
27720
+ saveFixed && layerOwner.curveOwner.saveFixedPoseValue();
27721
+ this._addCrossOwner(animatorLayerData, layerOwner, i, -1);
27722
+ }
27723
+ };
27724
+ _proto._prepareDestCrossData = function _prepareDestCrossData(animatorLayerData, saveFixed) {
27725
+ var curveLayerOwner = animatorLayerData.destPlayData.stateData.curveLayerOwner;
27726
+ for(var i = curveLayerOwner.length - 1; i >= 0; i--){
27727
+ var layerOwner = curveLayerOwner[i];
27728
+ if (!layerOwner) continue;
27729
+ if (layerOwner.crossCurveMark === animatorLayerData.crossCurveMark) {
27730
+ layerOwner.crossDestCurveIndex = i;
27650
27731
  } else {
27651
- owner.saveDefaultValue();
27732
+ var owner = layerOwner.curveOwner;
27652
27733
  saveFixed && owner.saveFixedPoseValue();
27653
- owner.crossCurveMark = crossCurveMark;
27654
- owner.crossCurveDataIndex = crossCurveData.length;
27655
- this._addCrossCurveData(crossCurveData, owner, -1, i);
27734
+ layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
27735
+ this._addCrossOwner(animatorLayerData, layerOwner, -1, i);
27656
27736
  }
27657
27737
  }
27658
27738
  };
@@ -27667,7 +27747,7 @@
27667
27747
  var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData, crossFadeTransitionInfo = layerData.crossFadeTransition;
27668
27748
  var additive = blendingMode === exports.AnimatorLayerBlendingMode.Additive;
27669
27749
  firstLayer && (weight = 1.0);
27670
- //TODO: 任意情况都应该检查,后面要优化
27750
+ //@todo: All situations should be checked, optimizations will follow later.
27671
27751
  layerData.layerState !== LayerState.FixedCrossFading && this._checkTransition(srcPlayData, crossFadeTransitionInfo, layerIndex);
27672
27752
  switch(layerData.layerState){
27673
27753
  case LayerState.Playing:
@@ -27679,26 +27759,36 @@
27679
27759
  case LayerState.CrossFading:
27680
27760
  this._updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, deltaTime, additive, aniUpdate);
27681
27761
  break;
27762
+ case LayerState.Finished:
27763
+ this._updateFinishedState(srcPlayData, weight, additive, aniUpdate);
27764
+ break;
27682
27765
  }
27683
27766
  };
27684
27767
  _proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
27685
- var _playData_stateData = playData.stateData, curveOwners = _playData_stateData.curveOwners, eventHandlers = _playData_stateData.eventHandlers;
27768
+ var _playData_stateData = playData.stateData, curveLayerOwner = _playData_stateData.curveLayerOwner, eventHandlers = _playData_stateData.eventHandlers;
27686
27769
  var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
27687
27770
  var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
27688
27771
  playData.update(this.speed < 0);
27689
- if (!aniUpdate) {
27690
- return;
27691
- }
27692
27772
  var clipTime = playData.clipTime, playState = playData.playState;
27693
- eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
27694
- for(var i = curveBindings.length - 1; i >= 0; i--){
27695
- var owner = curveOwners[i];
27696
- owner == null ? void 0 : owner.evaluateAndApplyValue(curveBindings[i].curve, clipTime, weight, additive);
27773
+ var finished = playState === AnimatorStatePlayState.Finished;
27774
+ if (aniUpdate || finished) {
27775
+ for(var i = curveBindings.length - 1; i >= 0; i--){
27776
+ var layerOwner = curveLayerOwner[i];
27777
+ var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
27778
+ if (!owner) continue;
27779
+ var curve = curveBindings[i].curve;
27780
+ if (curve.keys.length) {
27781
+ var value = owner.evaluateValue(curve, clipTime, additive);
27782
+ aniUpdate && owner.applyValue(value, weight, additive);
27783
+ finished && layerOwner.saveFinalValue();
27784
+ }
27785
+ }
27697
27786
  }
27698
27787
  playData.frameTime += state.speed * delta;
27699
27788
  if (playState === AnimatorStatePlayState.Finished) {
27700
- layerData.layerState = LayerState.Standby;
27789
+ layerData.layerState = LayerState.Finished;
27701
27790
  }
27791
+ eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
27702
27792
  if (lastPlayState === AnimatorStatePlayState.UnStarted) {
27703
27793
  this._callAnimatorScriptOnEnter(state, layerIndex);
27704
27794
  }
@@ -27709,7 +27799,7 @@
27709
27799
  }
27710
27800
  };
27711
27801
  _proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
27712
- var _this = this, crossCurveDataCollection = _this._crossOwnerCollection;
27802
+ var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
27713
27803
  var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
27714
27804
  var srcState = srcPlayData.state, srcStateData = srcPlayData.stateData, lastSrcPlayState = srcPlayData.playState;
27715
27805
  var srcEventHandlers = srcStateData.eventHandlers;
@@ -27718,18 +27808,27 @@
27718
27808
  var _destState_clip = destState.clip, destCurves = _destState_clip._curveBindings;
27719
27809
  var lastSrcClipTime = srcPlayData.clipTime;
27720
27810
  var lastDestClipTime = destPlayData.clipTime;
27721
- var crossWeight = Math.abs(destPlayData.frameTime) / (destState._getDuration() * layerData.crossFadeTransition.duration);
27722
- crossWeight >= 1.0 && (crossWeight = 1.0);
27811
+ var duration = destState._getDuration() * layerData.crossFadeTransition.duration;
27812
+ var crossWeight = Math.abs(destPlayData.frameTime) / duration;
27813
+ (crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
27723
27814
  srcPlayData.update(this.speed < 0);
27724
27815
  destPlayData.update(this.speed < 0);
27725
- var srcPlayState = srcPlayData.playState;
27726
- var destPlayState = destPlayData.playState;
27727
- this._updateCrossFadeData(layerData, crossWeight, delta, false);
27728
- if (!aniUpdate) {
27729
- return;
27816
+ var srcClipTime = srcPlayData.clipTime, srcPlayState = srcPlayData.playState;
27817
+ var destClipTime = destPlayData.clipTime, destPlayState = destPlayData.playState;
27818
+ var finished = destPlayData.playState === AnimatorStatePlayState.Finished;
27819
+ if (aniUpdate || finished) {
27820
+ for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
27821
+ var layerOwner = crossLayerOwnerCollection[i];
27822
+ var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
27823
+ if (!owner) continue;
27824
+ var srcCurveIndex = layerOwner.crossSrcCurveIndex;
27825
+ var destCurveIndex = layerOwner.crossDestCurveIndex;
27826
+ var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
27827
+ aniUpdate && owner.applyValue(value, weight, additive);
27828
+ finished && layerOwner.saveFinalValue();
27829
+ }
27730
27830
  }
27731
- var srcClipTime = srcPlayData.clipTime;
27732
- var destClipTime = destPlayData.clipTime;
27831
+ this._updateCrossFadeData(layerData, crossWeight, delta, false);
27733
27832
  srcEventHandlers.length && this._fireAnimationEvents(srcPlayData, srcEventHandlers, lastSrcClipTime, srcClipTime);
27734
27833
  destEventHandlers.length && this._fireAnimationEvents(destPlayData, destEventHandlers, lastDestClipTime, destClipTime);
27735
27834
  if (lastSrcPlayState === AnimatorStatePlayState.UnStarted) {
@@ -27748,28 +27847,34 @@
27748
27847
  } else {
27749
27848
  this._callAnimatorScriptOnUpdate(destState, layerIndex);
27750
27849
  }
27751
- for(var i = crossCurveDataCollection.length - 1; i >= 0; i--){
27752
- var crossCurveData = crossCurveDataCollection[i];
27753
- var crossSrcCurveIndex = crossCurveData.crossSrcCurveIndex, crossDestCurveIndex = crossCurveData.crossDestCurveIndex;
27754
- crossCurveData.crossFadeAndApplyValue(crossSrcCurveIndex >= 0 ? srcCurves[crossSrcCurveIndex].curve : null, crossDestCurveIndex >= 0 ? destCurves[crossDestCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
27755
- }
27756
27850
  };
27757
- _proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, layerWeight, delta, additive, aniUpdate) {
27758
- var crossCurveDataCollection = this._crossOwnerCollection;
27851
+ _proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
27852
+ var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
27759
27853
  var state = destPlayData.state, stateData = destPlayData.stateData, lastPlayState = destPlayData.playState;
27760
27854
  var eventHandlers = stateData.eventHandlers;
27761
27855
  var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
27762
27856
  var lastDestClipTime = destPlayData.clipTime;
27763
- var crossWeight = Math.abs(destPlayData.frameTime) / (state._getDuration() * layerData.crossFadeTransition.duration);
27764
- crossWeight >= 1.0 && (crossWeight = 1.0);
27857
+ var duration = state._getDuration() * layerData.crossFadeTransition.duration;
27858
+ var crossWeight = Math.abs(destPlayData.frameTime) / duration;
27859
+ (crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
27765
27860
  destPlayData.update(this.speed < 0);
27766
27861
  var playState = destPlayData.playState;
27767
27862
  this._updateCrossFadeData(layerData, crossWeight, delta, true);
27768
- if (!aniUpdate) {
27769
- return;
27770
- }
27771
27863
  var destClipTime = destPlayData.clipTime;
27772
- //TODO: srcState 少了最新一段时间的判断
27864
+ var finished = playState === AnimatorStatePlayState.Finished;
27865
+ // 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.
27866
+ if (aniUpdate || finished) {
27867
+ for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
27868
+ var layerOwner = crossLayerOwnerCollection[i];
27869
+ var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
27870
+ if (!owner) continue;
27871
+ var curveIndex = layerOwner.crossDestCurveIndex;
27872
+ var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
27873
+ aniUpdate && owner.applyValue(value, weight, additive);
27874
+ finished && layerOwner.saveFinalValue();
27875
+ }
27876
+ }
27877
+ //@todo: srcState is missing the judgment of the most recent period."
27773
27878
  eventHandlers.length && this._fireAnimationEvents(destPlayData, eventHandlers, lastDestClipTime, destClipTime);
27774
27879
  if (lastPlayState === AnimatorStatePlayState.UnStarted) {
27775
27880
  this._callAnimatorScriptOnEnter(state, layerIndex);
@@ -27779,10 +27884,18 @@
27779
27884
  } else {
27780
27885
  this._callAnimatorScriptOnUpdate(state, layerIndex);
27781
27886
  }
27782
- for(var i = crossCurveDataCollection.length - 1; i >= 0; i--){
27783
- var crossCurveData = crossCurveDataCollection[i];
27784
- var crossDestCurveIndex = crossCurveData.crossDestCurveIndex;
27785
- crossCurveData.crossFadeFromPoseAndApplyValue(crossDestCurveIndex >= 0 ? curveBindings[crossDestCurveIndex].curve : null, destClipTime, crossWeight, layerWeight, additive);
27887
+ };
27888
+ _proto._updateFinishedState = function _updateFinishedState(playData, weight, additive, aniUpdate) {
27889
+ if (!aniUpdate) {
27890
+ return;
27891
+ }
27892
+ var curveLayerOwner = playData.stateData.curveLayerOwner;
27893
+ var _playData_state_clip = playData.state.clip, curveBindings = _playData_state_clip._curveBindings;
27894
+ for(var i = curveBindings.length - 1; i >= 0; i--){
27895
+ var layerOwner = curveLayerOwner[i];
27896
+ var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
27897
+ if (!owner) continue;
27898
+ owner.applyValue(layerOwner.finalValue, weight, additive);
27786
27899
  }
27787
27900
  };
27788
27901
  _proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
@@ -27790,7 +27903,7 @@
27790
27903
  destPlayData.frameTime += destPlayData.state.speed * delta;
27791
27904
  if (crossWeight === 1.0) {
27792
27905
  if (destPlayData.playState === AnimatorStatePlayState.Finished) {
27793
- layerData.layerState = LayerState.Standby;
27906
+ layerData.layerState = LayerState.Finished;
27794
27907
  } else {
27795
27908
  layerData.layerState = LayerState.Playing;
27796
27909
  }
@@ -27800,25 +27913,24 @@
27800
27913
  fixed || (layerData.srcPlayData.frameTime += layerData.srcPlayData.state.speed * delta);
27801
27914
  }
27802
27915
  };
27803
- _proto._preparePlay = function _preparePlay(layerData, playState, playStateData) {
27916
+ _proto._preparePlay = function _preparePlay(layerData, playState) {
27804
27917
  if (layerData.layerState === LayerState.Playing) {
27805
27918
  var srcPlayData = layerData.srcPlayData;
27806
27919
  if (srcPlayData.state !== playState) {
27807
- var curveOwners = srcPlayData.stateData.curveOwners;
27808
- for(var i = curveOwners.length - 1; i >= 0; i--){
27809
- var owner = curveOwners[i];
27810
- (owner == null ? void 0 : owner.hasSavedDefaultValue) && owner.revertDefaultValue();
27920
+ var curveLayerOwner = srcPlayData.stateData.curveLayerOwner;
27921
+ for(var i = curveLayerOwner.length - 1; i >= 0; i--){
27922
+ var _curveLayerOwner_i;
27923
+ var owner = (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner;
27924
+ owner.revertDefaultValue();
27811
27925
  }
27812
- this._saveDefaultValues(playStateData);
27813
27926
  }
27814
27927
  } else {
27815
- // layerState is CrossFading, FixedCrossFading, Standby
27816
- var crossCurveDataCollection = this._crossOwnerCollection;
27817
- for(var i1 = crossCurveDataCollection.length - 1; i1 >= 0; i1--){
27818
- var owner1 = crossCurveDataCollection[i1];
27819
- owner1.hasSavedDefaultValue && owner1.revertDefaultValue();
27928
+ // layerState is CrossFading, FixedCrossFading, Standby, Finished
27929
+ var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
27930
+ for(var i1 = crossLayerOwnerCollection.length - 1; i1 >= 0; i1--){
27931
+ var owner1 = crossLayerOwnerCollection[i1].curveOwner;
27932
+ owner1.revertDefaultValue();
27820
27933
  }
27821
- this._saveDefaultValues(playStateData);
27822
27934
  }
27823
27935
  };
27824
27936
  _proto._checkTransition = function _checkTransition(stateData, crossFadeTransition, layerIndex) {
@@ -27835,7 +27947,7 @@
27835
27947
  _proto._crossFadeByTransition = function _crossFadeByTransition(transition, layerIndex) {
27836
27948
  var name = transition.destinationState.name;
27837
27949
  var stateInfo = this._getAnimatorStateInfo(name, layerIndex);
27838
- var crossState = stateInfo.state;
27950
+ var crossState = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
27839
27951
  if (!crossState) {
27840
27952
  return;
27841
27953
  }
@@ -27843,21 +27955,21 @@
27843
27955
  console.warn("The state named " + name + " has no AnimationClip data.");
27844
27956
  return;
27845
27957
  }
27846
- var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
27958
+ var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
27847
27959
  var layerState = animatorLayerData.layerState;
27848
27960
  var destPlayData = animatorLayerData.destPlayData;
27849
- var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData);
27961
+ var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData, playLayerIndex);
27850
27962
  var duration = crossState._getDuration();
27851
27963
  var offset = duration * transition.offset;
27852
27964
  destPlayData.reset(crossState, animatorStateData, offset);
27853
27965
  switch(layerState){
27854
- // Maybe not play, maybe end.
27855
27966
  case LayerState.Standby:
27856
27967
  animatorLayerData.layerState = LayerState.FixedCrossFading;
27857
27968
  this._clearCrossData(animatorLayerData);
27858
27969
  this._prepareStandbyCrossFading(animatorLayerData);
27859
27970
  break;
27860
27971
  case LayerState.Playing:
27972
+ case LayerState.Finished:
27861
27973
  animatorLayerData.layerState = LayerState.CrossFading;
27862
27974
  this._clearCrossData(animatorLayerData);
27863
27975
  this._prepareCrossFading(animatorLayerData);
@@ -27954,6 +28066,12 @@
27954
28066
  }
27955
28067
  }
27956
28068
  };
28069
+ _proto._revertCurveOwners = function _revertCurveOwners() {
28070
+ var curveOwners = this._needRevertCurveOwners;
28071
+ for(var i = 0, n = curveOwners.length; i < n; ++i){
28072
+ curveOwners[i].revertDefaultValue();
28073
+ }
28074
+ };
27957
28075
  _create_class$3(Animator, [
27958
28076
  {
27959
28077
  key: "animatorController",
@@ -27985,10 +28103,10 @@
27985
28103
  ], Animator.prototype, "_animatorLayersData", void 0);
27986
28104
  __decorate$1([
27987
28105
  ignoreClone
27988
- ], Animator.prototype, "_crossOwnerCollection", void 0);
28106
+ ], Animator.prototype, "_curveOwnerPool", void 0);
27989
28107
  __decorate$1([
27990
28108
  ignoreClone
27991
- ], Animator.prototype, "_animationCurveOwners", void 0);
28109
+ ], Animator.prototype, "_needRevertCurveOwners", void 0);
27992
28110
  __decorate$1([
27993
28111
  ignoreClone
27994
28112
  ], Animator.prototype, "_animationEventHandlerPool", void 0);
@@ -36275,7 +36393,7 @@
36275
36393
  }));
36276
36394
 
36277
36395
  //@ts-ignore
36278
- var version = "0.9.13";
36396
+ var version = "0.9.15";
36279
36397
  console.log("Galacean engine version: " + version);
36280
36398
  for(var key in CoreObjects){
36281
36399
  Loader.registerClass(key, CoreObjects[key]);