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