@galacean/engine-core 1.0.0-beta.13 → 1.0.0-beta.14

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
@@ -22682,6 +22682,7 @@ var DirtyFlag;
22682
22682
  curKeyframeIndex: 0,
22683
22683
  value: null
22684
22684
  };
22685
+ this.updateMark = 0;
22685
22686
  this.target = target;
22686
22687
  this.type = type;
22687
22688
  this.property = property;
@@ -24155,9 +24156,9 @@ exports.AnimatorLayerBlendingMode = void 0;
24155
24156
  _this = Component.call(this, entity) || this;
24156
24157
  /** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
24157
24158
  /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
24159
+ _this._updateMark = 0;
24158
24160
  _this._animatorLayersData = [];
24159
24161
  _this._curveOwnerPool = Object.create(null);
24160
- _this._needRevertCurveOwners = [];
24161
24162
  _this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
24162
24163
  _this._tempAnimatorStateInfo = {
24163
24164
  layerIndex: -1,
@@ -24185,10 +24186,10 @@ exports.AnimatorLayerBlendingMode = void 0;
24185
24186
  return;
24186
24187
  }
24187
24188
  if (!state.clip) {
24188
- console.warn("The state named " + stateName + " has no AnimationClip data.");
24189
+ Logger.warn("The state named " + stateName + " has no AnimationClip data.");
24189
24190
  return;
24190
24191
  }
24191
- var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
24192
+ var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
24192
24193
  var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData, playLayerIndex);
24193
24194
  this._preparePlay(animatorLayerData, state);
24194
24195
  animatorLayerData.layerState = LayerState.Playing;
@@ -24207,8 +24208,8 @@ exports.AnimatorLayerBlendingMode = void 0;
24207
24208
  if ((_this__controllerUpdateFlag = this._controllerUpdateFlag) == null ? void 0 : _this__controllerUpdateFlag.flag) {
24208
24209
  this._reset();
24209
24210
  }
24210
- var state = this._getAnimatorStateInfo(stateName, layerIndex).state;
24211
- var manuallyTransition = this._getAnimatorLayerData(layerIndex).manuallyTransition;
24211
+ var _this__getAnimatorStateInfo = this._getAnimatorStateInfo(stateName, layerIndex), state = _this__getAnimatorStateInfo.state, playLayerIndex = _this__getAnimatorStateInfo.layerIndex;
24212
+ var manuallyTransition = this._getAnimatorLayerData(playLayerIndex).manuallyTransition;
24212
24213
  manuallyTransition.duration = normalizedTransitionDuration;
24213
24214
  manuallyTransition.offset = normalizedTimeOffset;
24214
24215
  manuallyTransition.destinationState = state;
@@ -24241,7 +24242,7 @@ exports.AnimatorLayerBlendingMode = void 0;
24241
24242
  return;
24242
24243
  }
24243
24244
  deltaTime *= this.speed;
24244
- this._revertCurveOwners();
24245
+ this._updateMark++;
24245
24246
  for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
24246
24247
  var animatorLayerData = this._getAnimatorLayerData(i1);
24247
24248
  if (animatorLayerData.layerState === LayerState.Standby) {
@@ -24289,7 +24290,6 @@ exports.AnimatorLayerBlendingMode = void 0;
24289
24290
  }
24290
24291
  }
24291
24292
  this._animatorLayersData.length = 0;
24292
- this._needRevertCurveOwners.length = 0;
24293
24293
  this._curveOwnerPool = {};
24294
24294
  this._animationEventHandlerPool.resetPool();
24295
24295
  if (this._controllerUpdateFlag) {
@@ -24331,8 +24331,8 @@ exports.AnimatorLayerBlendingMode = void 0;
24331
24331
  _proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex) {
24332
24332
  var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
24333
24333
  var curveLayerOwner = animatorStateData.curveLayerOwner;
24334
- var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
24335
24334
  var _animatorState_clip = animatorState.clip, curves = _animatorState_clip._curveBindings;
24335
+ var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
24336
24336
  for(var i = curves.length - 1; i >= 0; i--){
24337
24337
  var curve = curves[i];
24338
24338
  var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
@@ -24340,29 +24340,16 @@ exports.AnimatorLayerBlendingMode = void 0;
24340
24340
  var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
24341
24341
  var property = curve.property;
24342
24342
  var instanceId = targetEntity.instanceId;
24343
- var needRevert = false;
24344
- var baseAnimatorLayerData = this._animatorLayersData[0];
24345
- var baseLayerCurveOwnerPool = baseAnimatorLayerData.curveOwnerPool;
24346
- if (this.animatorController.layers[layerIndex].blendingMode === exports.AnimatorLayerBlendingMode.Additive && layerIndex > 0 && !(baseLayerCurveOwnerPool[instanceId] && baseLayerCurveOwnerPool[instanceId][property])) {
24347
- needRevert = true;
24348
- }
24349
24343
  // Get owner
24350
24344
  var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
24351
24345
  var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity));
24352
- //@todo: There is performance waste here, which will be handled together with organizing AnimatorStateData later. The logic is changing from runtime to initialization.
24353
- if (needRevert) {
24354
- this._needRevertCurveOwners.push(owner);
24355
- } else {
24356
- var index = this._needRevertCurveOwners.indexOf(owner);
24357
- index > -1 && this._needRevertCurveOwners.splice(index, 1);
24358
- }
24359
24346
  // Get layer owner
24360
24347
  var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
24361
24348
  var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
24362
24349
  curveLayerOwner[i] = layerOwner;
24363
24350
  } else {
24364
24351
  curveLayerOwner[i] = null;
24365
- console.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
24352
+ Logger.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
24366
24353
  }
24367
24354
  }
24368
24355
  };
@@ -24488,6 +24475,7 @@ exports.AnimatorLayerBlendingMode = void 0;
24488
24475
  if (!owner) continue;
24489
24476
  var curve = curveBindings[i].curve;
24490
24477
  if (curve.keys.length) {
24478
+ this._checkRevertOwner(owner, additive);
24491
24479
  var value = owner.evaluateValue(curve, clipTime, additive);
24492
24480
  aniUpdate && owner.applyValue(value, weight, additive);
24493
24481
  finished && layerOwner.saveFinalValue();
@@ -24533,6 +24521,7 @@ exports.AnimatorLayerBlendingMode = void 0;
24533
24521
  if (!owner) continue;
24534
24522
  var srcCurveIndex = layerOwner.crossSrcCurveIndex;
24535
24523
  var destCurveIndex = layerOwner.crossDestCurveIndex;
24524
+ this._checkRevertOwner(owner, additive);
24536
24525
  var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
24537
24526
  aniUpdate && owner.applyValue(value, weight, additive);
24538
24527
  finished && layerOwner.saveFinalValue();
@@ -24579,6 +24568,7 @@ exports.AnimatorLayerBlendingMode = void 0;
24579
24568
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
24580
24569
  if (!owner) continue;
24581
24570
  var curveIndex = layerOwner.crossDestCurveIndex;
24571
+ this._checkRevertOwner(owner, additive);
24582
24572
  var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
24583
24573
  aniUpdate && owner.applyValue(value, weight, additive);
24584
24574
  finished && layerOwner.saveFinalValue();
@@ -24605,6 +24595,7 @@ exports.AnimatorLayerBlendingMode = void 0;
24605
24595
  var layerOwner = curveLayerOwner[i];
24606
24596
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
24607
24597
  if (!owner) continue;
24598
+ this._checkRevertOwner(owner, additive);
24608
24599
  owner.applyValue(layerOwner.finalValue, weight, additive);
24609
24600
  }
24610
24601
  };
@@ -24630,16 +24621,14 @@ exports.AnimatorLayerBlendingMode = void 0;
24630
24621
  var curveLayerOwner = srcPlayData.stateData.curveLayerOwner;
24631
24622
  for(var i = curveLayerOwner.length - 1; i >= 0; i--){
24632
24623
  var _curveLayerOwner_i;
24633
- var owner = (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner;
24634
- owner.revertDefaultValue();
24624
+ (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.revertDefaultValue();
24635
24625
  }
24636
24626
  }
24637
24627
  } else {
24638
24628
  // layerState is CrossFading, FixedCrossFading, Standby, Finished
24639
24629
  var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
24640
24630
  for(var i1 = crossLayerOwnerCollection.length - 1; i1 >= 0; i1--){
24641
- var owner1 = crossLayerOwnerCollection[i1].curveOwner;
24642
- owner1.revertDefaultValue();
24631
+ crossLayerOwnerCollection[i1].curveOwner.revertDefaultValue();
24643
24632
  }
24644
24633
  }
24645
24634
  };
@@ -24662,7 +24651,7 @@ exports.AnimatorLayerBlendingMode = void 0;
24662
24651
  return;
24663
24652
  }
24664
24653
  if (!crossState.clip) {
24665
- console.warn("The state named " + name + " has no AnimationClip data.");
24654
+ Logger.warn("The state named " + name + " has no AnimationClip data.");
24666
24655
  return;
24667
24656
  }
24668
24657
  var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
@@ -24674,12 +24663,12 @@ exports.AnimatorLayerBlendingMode = void 0;
24674
24663
  destPlayData.reset(crossState, animatorStateData, offset);
24675
24664
  switch(layerState){
24676
24665
  case LayerState.Standby:
24666
+ case LayerState.Finished:
24677
24667
  animatorLayerData.layerState = LayerState.FixedCrossFading;
24678
24668
  this._clearCrossData(animatorLayerData);
24679
24669
  this._prepareStandbyCrossFading(animatorLayerData);
24680
24670
  break;
24681
24671
  case LayerState.Playing:
24682
- case LayerState.Finished:
24683
24672
  animatorLayerData.layerState = LayerState.CrossFading;
24684
24673
  this._clearCrossData(animatorLayerData);
24685
24674
  this._prepareCrossFading(animatorLayerData);
@@ -24776,11 +24765,11 @@ exports.AnimatorLayerBlendingMode = void 0;
24776
24765
  }
24777
24766
  }
24778
24767
  };
24779
- _proto._revertCurveOwners = function _revertCurveOwners() {
24780
- var curveOwners = this._needRevertCurveOwners;
24781
- for(var i = 0, n = curveOwners.length; i < n; ++i){
24782
- curveOwners[i].revertDefaultValue();
24768
+ _proto._checkRevertOwner = function _checkRevertOwner(owner, additive) {
24769
+ if (additive && owner.updateMark !== this._updateMark) {
24770
+ owner.revertDefaultValue();
24783
24771
  }
24772
+ owner.updateMark = this._updateMark;
24784
24773
  };
24785
24774
  _create_class(Animator, [
24786
24775
  {
@@ -24810,13 +24799,13 @@ __decorate([
24810
24799
  ], Animator.prototype, "_controllerUpdateFlag", void 0);
24811
24800
  __decorate([
24812
24801
  ignoreClone
24813
- ], Animator.prototype, "_animatorLayersData", void 0);
24802
+ ], Animator.prototype, "_updateMark", void 0);
24814
24803
  __decorate([
24815
24804
  ignoreClone
24816
- ], Animator.prototype, "_curveOwnerPool", void 0);
24805
+ ], Animator.prototype, "_animatorLayersData", void 0);
24817
24806
  __decorate([
24818
24807
  ignoreClone
24819
- ], Animator.prototype, "_needRevertCurveOwners", void 0);
24808
+ ], Animator.prototype, "_curveOwnerPool", void 0);
24820
24809
  __decorate([
24821
24810
  ignoreClone
24822
24811
  ], Animator.prototype, "_animationEventHandlerPool", void 0);