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