@galacean/engine-core 0.9.18 → 0.9.19

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/main.js CHANGED
@@ -21477,6 +21477,7 @@ var DirtyFlag;
21477
21477
  curKeyframeIndex: 0,
21478
21478
  value: null
21479
21479
  };
21480
+ this.updateMark = 0;
21480
21481
  this.target = target;
21481
21482
  this.type = type;
21482
21483
  this.property = property;
@@ -22949,9 +22950,9 @@ exports.AnimatorLayerBlendingMode = void 0;
22949
22950
  _this = Component.call(this, entity) || this;
22950
22951
  /** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
22951
22952
  /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
22953
+ _this._updateMark = 0;
22952
22954
  _this._animatorLayersData = [];
22953
22955
  _this._curveOwnerPool = Object.create(null);
22954
- _this._needRevertCurveOwners = [];
22955
22956
  _this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
22956
22957
  _this._tempAnimatorStateInfo = {
22957
22958
  layerIndex: -1,
@@ -23035,7 +23036,7 @@ exports.AnimatorLayerBlendingMode = void 0;
23035
23036
  return;
23036
23037
  }
23037
23038
  deltaTime *= this.speed;
23038
- this._revertCurveOwners();
23039
+ this._updateMark++;
23039
23040
  for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
23040
23041
  var animatorLayerData = this._getAnimatorLayerData(i1);
23041
23042
  if (animatorLayerData.layerState === LayerState.Standby) {
@@ -23085,7 +23086,6 @@ exports.AnimatorLayerBlendingMode = void 0;
23085
23086
  }
23086
23087
  }
23087
23088
  this._animatorLayersData.length = 0;
23088
- this._needRevertCurveOwners.length = 0;
23089
23089
  this._curveOwnerPool = {};
23090
23090
  this._animationEventHandlerPool.resetPool();
23091
23091
  if (this._controllerUpdateFlag) {
@@ -23136,17 +23136,9 @@ exports.AnimatorLayerBlendingMode = void 0;
23136
23136
  var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
23137
23137
  var property = curve.property;
23138
23138
  var instanceId = targetEntity.instanceId;
23139
- var needRevert = false;
23140
- if (this.animatorController.layers[layerIndex].blendingMode === exports.AnimatorLayerBlendingMode.Additive && layerIndex > 0) {
23141
- needRevert = true;
23142
- }
23143
23139
  // Get owner
23144
23140
  var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
23145
23141
  var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity));
23146
- //@todo: There is performance waste here, which will be handled together with organizing AnimatorStateData later. The logic is changing from runtime to initialization.
23147
- if (needRevert) {
23148
- this._needRevertCurveOwners.push(owner);
23149
- }
23150
23142
  // Get layer owner
23151
23143
  var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
23152
23144
  var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
@@ -23279,6 +23271,7 @@ exports.AnimatorLayerBlendingMode = void 0;
23279
23271
  if (!owner) continue;
23280
23272
  var curve = curveBindings[i].curve;
23281
23273
  if (curve.keys.length) {
23274
+ this._checkRevertOwner(owner, additive);
23282
23275
  var value = owner.evaluateValue(curve, clipTime, additive);
23283
23276
  aniUpdate && owner.applyValue(value, weight, additive);
23284
23277
  finished && layerOwner.saveFinalValue();
@@ -23324,6 +23317,7 @@ exports.AnimatorLayerBlendingMode = void 0;
23324
23317
  if (!owner) continue;
23325
23318
  var srcCurveIndex = layerOwner.crossSrcCurveIndex;
23326
23319
  var destCurveIndex = layerOwner.crossDestCurveIndex;
23320
+ this._checkRevertOwner(owner, additive);
23327
23321
  var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
23328
23322
  aniUpdate && owner.applyValue(value, weight, additive);
23329
23323
  finished && layerOwner.saveFinalValue();
@@ -23370,6 +23364,7 @@ exports.AnimatorLayerBlendingMode = void 0;
23370
23364
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
23371
23365
  if (!owner) continue;
23372
23366
  var curveIndex = layerOwner.crossDestCurveIndex;
23367
+ this._checkRevertOwner(owner, additive);
23373
23368
  var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
23374
23369
  aniUpdate && owner.applyValue(value, weight, additive);
23375
23370
  finished && layerOwner.saveFinalValue();
@@ -23396,6 +23391,7 @@ exports.AnimatorLayerBlendingMode = void 0;
23396
23391
  var layerOwner = curveLayerOwner[i];
23397
23392
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
23398
23393
  if (!owner) continue;
23394
+ this._checkRevertOwner(owner, additive);
23399
23395
  owner.applyValue(layerOwner.finalValue, weight, additive);
23400
23396
  }
23401
23397
  };
@@ -23565,11 +23561,11 @@ exports.AnimatorLayerBlendingMode = void 0;
23565
23561
  }
23566
23562
  }
23567
23563
  };
23568
- _proto._revertCurveOwners = function _revertCurveOwners() {
23569
- var curveOwners = this._needRevertCurveOwners;
23570
- for(var i = 0, n = curveOwners.length; i < n; ++i){
23571
- curveOwners[i].revertDefaultValue();
23564
+ _proto._checkRevertOwner = function _checkRevertOwner(owner, additive) {
23565
+ if (additive && owner.updateMark !== this._updateMark) {
23566
+ owner.revertDefaultValue();
23572
23567
  }
23568
+ owner.updateMark = this._updateMark;
23573
23569
  };
23574
23570
  _create_class(Animator, [
23575
23571
  {
@@ -23599,13 +23595,13 @@ __decorate([
23599
23595
  ], Animator.prototype, "_controllerUpdateFlag", void 0);
23600
23596
  __decorate([
23601
23597
  ignoreClone
23602
- ], Animator.prototype, "_animatorLayersData", void 0);
23598
+ ], Animator.prototype, "_updateMark", void 0);
23603
23599
  __decorate([
23604
23600
  ignoreClone
23605
- ], Animator.prototype, "_curveOwnerPool", void 0);
23601
+ ], Animator.prototype, "_animatorLayersData", void 0);
23606
23602
  __decorate([
23607
23603
  ignoreClone
23608
- ], Animator.prototype, "_needRevertCurveOwners", void 0);
23604
+ ], Animator.prototype, "_curveOwnerPool", void 0);
23609
23605
  __decorate([
23610
23606
  ignoreClone
23611
23607
  ], Animator.prototype, "_animationEventHandlerPool", void 0);