@galacean/engine-core 0.9.17 → 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,
@@ -22979,7 +22980,7 @@ exports.AnimatorLayerBlendingMode = void 0;
22979
22980
  return;
22980
22981
  }
22981
22982
  if (!state.clip) {
22982
- console.warn("The state named " + stateName + " has no AnimationClip data.");
22983
+ Logger.warn("The state named " + stateName + " has no AnimationClip data.");
22983
22984
  return;
22984
22985
  }
22985
22986
  var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
@@ -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,27 +23136,16 @@ 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
- } else {
23150
- var index = this._needRevertCurveOwners.indexOf(owner);
23151
- index > -1 && this._needRevertCurveOwners.splice(index, 1);
23152
- }
23153
23142
  // Get layer owner
23154
23143
  var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
23155
23144
  var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
23156
23145
  curveLayerOwner[i] = layerOwner;
23157
23146
  } else {
23158
23147
  curveLayerOwner[i] = null;
23159
- console.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
23148
+ Logger.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
23160
23149
  }
23161
23150
  }
23162
23151
  };
@@ -23282,6 +23271,7 @@ exports.AnimatorLayerBlendingMode = void 0;
23282
23271
  if (!owner) continue;
23283
23272
  var curve = curveBindings[i].curve;
23284
23273
  if (curve.keys.length) {
23274
+ this._checkRevertOwner(owner, additive);
23285
23275
  var value = owner.evaluateValue(curve, clipTime, additive);
23286
23276
  aniUpdate && owner.applyValue(value, weight, additive);
23287
23277
  finished && layerOwner.saveFinalValue();
@@ -23327,6 +23317,7 @@ exports.AnimatorLayerBlendingMode = void 0;
23327
23317
  if (!owner) continue;
23328
23318
  var srcCurveIndex = layerOwner.crossSrcCurveIndex;
23329
23319
  var destCurveIndex = layerOwner.crossDestCurveIndex;
23320
+ this._checkRevertOwner(owner, additive);
23330
23321
  var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
23331
23322
  aniUpdate && owner.applyValue(value, weight, additive);
23332
23323
  finished && layerOwner.saveFinalValue();
@@ -23373,6 +23364,7 @@ exports.AnimatorLayerBlendingMode = void 0;
23373
23364
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
23374
23365
  if (!owner) continue;
23375
23366
  var curveIndex = layerOwner.crossDestCurveIndex;
23367
+ this._checkRevertOwner(owner, additive);
23376
23368
  var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
23377
23369
  aniUpdate && owner.applyValue(value, weight, additive);
23378
23370
  finished && layerOwner.saveFinalValue();
@@ -23399,6 +23391,7 @@ exports.AnimatorLayerBlendingMode = void 0;
23399
23391
  var layerOwner = curveLayerOwner[i];
23400
23392
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
23401
23393
  if (!owner) continue;
23394
+ this._checkRevertOwner(owner, additive);
23402
23395
  owner.applyValue(layerOwner.finalValue, weight, additive);
23403
23396
  }
23404
23397
  };
@@ -23454,7 +23447,7 @@ exports.AnimatorLayerBlendingMode = void 0;
23454
23447
  return;
23455
23448
  }
23456
23449
  if (!crossState.clip) {
23457
- console.warn("The state named " + name + " has no AnimationClip data.");
23450
+ Logger.warn("The state named " + name + " has no AnimationClip data.");
23458
23451
  return;
23459
23452
  }
23460
23453
  var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
@@ -23466,12 +23459,12 @@ exports.AnimatorLayerBlendingMode = void 0;
23466
23459
  destPlayData.reset(crossState, animatorStateData, offset);
23467
23460
  switch(layerState){
23468
23461
  case LayerState.Standby:
23462
+ case LayerState.Finished:
23469
23463
  animatorLayerData.layerState = LayerState.FixedCrossFading;
23470
23464
  this._clearCrossData(animatorLayerData);
23471
23465
  this._prepareStandbyCrossFading(animatorLayerData);
23472
23466
  break;
23473
23467
  case LayerState.Playing:
23474
- case LayerState.Finished:
23475
23468
  animatorLayerData.layerState = LayerState.CrossFading;
23476
23469
  this._clearCrossData(animatorLayerData);
23477
23470
  this._prepareCrossFading(animatorLayerData);
@@ -23568,11 +23561,11 @@ exports.AnimatorLayerBlendingMode = void 0;
23568
23561
  }
23569
23562
  }
23570
23563
  };
23571
- _proto._revertCurveOwners = function _revertCurveOwners() {
23572
- var curveOwners = this._needRevertCurveOwners;
23573
- for(var i = 0, n = curveOwners.length; i < n; ++i){
23574
- curveOwners[i].revertDefaultValue();
23564
+ _proto._checkRevertOwner = function _checkRevertOwner(owner, additive) {
23565
+ if (additive && owner.updateMark !== this._updateMark) {
23566
+ owner.revertDefaultValue();
23575
23567
  }
23568
+ owner.updateMark = this._updateMark;
23576
23569
  };
23577
23570
  _create_class(Animator, [
23578
23571
  {
@@ -23602,13 +23595,13 @@ __decorate([
23602
23595
  ], Animator.prototype, "_controllerUpdateFlag", void 0);
23603
23596
  __decorate([
23604
23597
  ignoreClone
23605
- ], Animator.prototype, "_animatorLayersData", void 0);
23598
+ ], Animator.prototype, "_updateMark", void 0);
23606
23599
  __decorate([
23607
23600
  ignoreClone
23608
- ], Animator.prototype, "_curveOwnerPool", void 0);
23601
+ ], Animator.prototype, "_animatorLayersData", void 0);
23609
23602
  __decorate([
23610
23603
  ignoreClone
23611
- ], Animator.prototype, "_needRevertCurveOwners", void 0);
23604
+ ], Animator.prototype, "_curveOwnerPool", void 0);
23612
23605
  __decorate([
23613
23606
  ignoreClone
23614
23607
  ], Animator.prototype, "_animationEventHandlerPool", void 0);