@galacean/engine-core 1.3.14 → 1.3.15

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
@@ -26268,16 +26268,17 @@ Shader.create(_PostProcessManager.UBER_SHADER_NAME, blitVs, UberPost);
26268
26268
  * @internal
26269
26269
  */ _proto._onDisableInScene = function _onDisableInScene() {
26270
26270
  var componentsManager = this.scene._componentsManager;
26271
+ var prototype = Script.prototype;
26271
26272
  if (!this._started) {
26272
26273
  componentsManager.removeOnStartScript(this);
26273
26274
  }
26274
- if (this._onUpdateIndex >= 0) {
26275
+ if (this.onUpdate !== prototype.onUpdate) {
26275
26276
  componentsManager.removeOnUpdateScript(this);
26276
26277
  }
26277
- if (this._onLateUpdateIndex >= 0) {
26278
+ if (this.onLateUpdate !== prototype.onLateUpdate) {
26278
26279
  componentsManager.removeOnLateUpdateScript(this);
26279
26280
  }
26280
- if (this._onPhysicsUpdateIndex >= 0) {
26281
+ if (this.onPhysicsUpdate !== prototype.onPhysicsUpdate) {
26281
26282
  componentsManager.removeOnPhysicsUpdateScript(this);
26282
26283
  }
26283
26284
  this._entity._removeScript(this);
@@ -28285,7 +28286,8 @@ exports.AnimatorLayerBlendingMode = void 0;
28285
28286
  var _proto = AnimatorStatePlayData.prototype;
28286
28287
  _proto.reset = function reset(state, stateData, offsetFrameTime) {
28287
28288
  this.state = state;
28288
- this.frameTime = offsetFrameTime;
28289
+ this.playedTime = 0;
28290
+ this.offsetFrameTime = offsetFrameTime;
28289
28291
  this.stateData = stateData;
28290
28292
  this.playState = AnimatorStatePlayState.UnStarted;
28291
28293
  this.clipTime = state.clipStartTime * state.clip.length;
@@ -28304,9 +28306,9 @@ exports.AnimatorLayerBlendingMode = void 0;
28304
28306
  }
28305
28307
  };
28306
28308
  _proto.update = function update(deltaTime) {
28307
- this.frameTime += deltaTime;
28309
+ this.playedTime += deltaTime;
28308
28310
  var state = this.state;
28309
- var time = this.frameTime;
28311
+ var time = this.playedTime + this.offsetFrameTime;
28310
28312
  var duration = state._getDuration();
28311
28313
  this.playState = AnimatorStatePlayState.Playing;
28312
28314
  if (state.wrapMode === exports.WrapMode.Loop) {
@@ -28753,9 +28755,8 @@ exports.AnimatorLayerBlendingMode = void 0;
28753
28755
  var transition = anyStateTransitions.length && this._applyTransitionsByCondition(layerIndex, layerData, layer, state, anyStateTransitions, aniUpdate) || transitions.length && this._applyStateTransitions(layerIndex, layerData, layer, isForwards, srcPlayData, transitions, lastClipTime, clipTime, playDeltaTime, aniUpdate);
28754
28756
  var playCostTime;
28755
28757
  if (transition) {
28756
- var clipDuration = state.clip.length;
28757
- var clipEndTime = state.clipEndTime * clipDuration;
28758
- var exitTime = transition.exitTime * state._getDuration();
28758
+ var clipEndTime = state._getClipActualEndTime();
28759
+ var exitTime = transition.exitTime * state._getDuration() + state._getClipActualStartTime();
28759
28760
  if (isForwards) {
28760
28761
  if (exitTime < lastClipTime) {
28761
28762
  playCostTime = exitTime + clipEndTime - lastClipTime;
@@ -28763,7 +28764,7 @@ exports.AnimatorLayerBlendingMode = void 0;
28763
28764
  playCostTime = exitTime - lastClipTime;
28764
28765
  }
28765
28766
  } else {
28766
- var startTime = state.clipStartTime * clipDuration;
28767
+ var startTime = state._getClipActualStartTime();
28767
28768
  if (lastClipTime < exitTime) {
28768
28769
  playCostTime = clipEndTime - exitTime + lastClipTime - startTime;
28769
28770
  } else {
@@ -28825,20 +28826,22 @@ exports.AnimatorLayerBlendingMode = void 0;
28825
28826
  var lastDestClipTime = destPlayData.clipTime, lastDstPlayState = destPlayData.playState;
28826
28827
  var dstPlayCostTime;
28827
28828
  if (destPlayData.isForwards) {
28828
- dstPlayCostTime = lastDestClipTime + dstPlayDeltaTime > transitionDuration ? transitionDuration - lastDestClipTime : dstPlayDeltaTime;
28829
+ // The time that has been played
28830
+ var playedTime = destPlayData.playedTime;
28831
+ dstPlayCostTime = playedTime + dstPlayDeltaTime > transitionDuration ? transitionDuration - playedTime : dstPlayDeltaTime;
28829
28832
  } else {
28830
28833
  // The time that has been played
28831
- var playedTime = destStateDuration - lastDestClipTime;
28832
- dstPlayCostTime = // -actualDestDeltaTime: The time that will be played, negative are meant to make ite be a periods
28834
+ var playedTime1 = destPlayData.playedTime;
28835
+ dstPlayCostTime = // -dstPlayDeltaTime: The time that will be played, negative are meant to make it be a periods
28833
28836
  // > transition: The time that will be played is enough to finish the transition
28834
- playedTime - dstPlayDeltaTime > transitionDuration ? // -(transitionDuration - playedTime)
28835
- playedTime - transitionDuration : dstPlayDeltaTime;
28837
+ playedTime1 - dstPlayDeltaTime > transitionDuration ? // -(transitionDuration - playedTime)
28838
+ playedTime1 - transitionDuration : dstPlayDeltaTime;
28836
28839
  }
28837
28840
  var actualCostTime = dstPlaySpeed === 0 ? deltaTime : dstPlayCostTime / dstPlaySpeed;
28838
28841
  var srcPlayCostTime = actualCostTime * srcPlaySpeed;
28839
28842
  srcPlayData.update(srcPlayCostTime);
28840
28843
  destPlayData.update(dstPlayCostTime);
28841
- var crossWeight = Math.abs(destPlayData.frameTime) / transitionDuration;
28844
+ var crossWeight = Math.abs(destPlayData.playedTime) / transitionDuration;
28842
28845
  (crossWeight >= 1.0 - engineMath.MathUtil.zeroTolerance || transitionDuration === 0) && (crossWeight = 1.0);
28843
28846
  var crossFadeFinished = crossWeight === 1.0;
28844
28847
  if (crossFadeFinished) {
@@ -28888,18 +28891,20 @@ exports.AnimatorLayerBlendingMode = void 0;
28888
28891
  var lastDestClipTime = destPlayData.clipTime, lastPlayState = destPlayData.playState;
28889
28892
  var dstPlayCostTime;
28890
28893
  if (destPlayData.isForwards) {
28891
- dstPlayCostTime = lastDestClipTime + playDeltaTime > transitionDuration ? transitionDuration - lastDestClipTime : playDeltaTime;
28894
+ // The time that has been played
28895
+ var playedTime = destPlayData.playedTime;
28896
+ dstPlayCostTime = playedTime + playDeltaTime > transitionDuration ? transitionDuration - playedTime : playDeltaTime;
28892
28897
  } else {
28893
28898
  // The time that has been played
28894
- var playedTime = stateDuration - lastDestClipTime;
28899
+ var playedTime1 = destPlayData.playedTime;
28895
28900
  dstPlayCostTime = // -actualDestDeltaTime: The time that will be played, negative are meant to make ite be a periods
28896
28901
  // > transition: The time that will be played is enough to finish the transition
28897
- playedTime - playDeltaTime > transitionDuration ? // -(transitionDuration - playedTime)
28898
- playedTime - transitionDuration : playDeltaTime;
28902
+ playedTime1 - playDeltaTime > transitionDuration ? // -(transitionDuration - playedTime)
28903
+ playedTime1 - transitionDuration : playDeltaTime;
28899
28904
  }
28900
28905
  var actualCostTime = playSpeed === 0 ? deltaTime : dstPlayCostTime / playSpeed;
28901
28906
  destPlayData.update(dstPlayCostTime);
28902
- var crossWeight = Math.abs(destPlayData.frameTime) / transitionDuration;
28907
+ var crossWeight = Math.abs(destPlayData.playedTime) / transitionDuration;
28903
28908
  (crossWeight >= 1.0 - engineMath.MathUtil.zeroTolerance || transitionDuration === 0) && (crossWeight = 1.0);
28904
28909
  var crossFadeFinished = crossWeight === 1.0;
28905
28910
  if (crossFadeFinished) {
@@ -29027,10 +29032,9 @@ exports.AnimatorLayerBlendingMode = void 0;
29027
29032
  _proto._checkSubTransition = function _checkSubTransition(layerIndex, layerData, layer, playState, transitions, lastClipTime, curClipTime, aniUpdate) {
29028
29033
  var state = playState.state;
29029
29034
  var transitionIndex = playState.currentTransitionIndex;
29030
- var duration = state._getDuration();
29031
29035
  for(var n = transitions.length; transitionIndex < n; transitionIndex++){
29032
29036
  var transition = transitions[transitionIndex];
29033
- var exitTime = transition.exitTime * duration;
29037
+ var exitTime = transition.exitTime * state._getDuration() + state._getClipActualStartTime();
29034
29038
  if (exitTime > curClipTime) {
29035
29039
  break;
29036
29040
  }
@@ -29050,10 +29054,9 @@ exports.AnimatorLayerBlendingMode = void 0;
29050
29054
  _proto._checkBackwardsSubTransition = function _checkBackwardsSubTransition(layerIndex, layerData, layer, playState, transitions, lastClipTime, curClipTime, aniUpdate) {
29051
29055
  var state = playState.state;
29052
29056
  var transitionIndex = playState.currentTransitionIndex;
29053
- var duration = playState.state._getDuration();
29054
29057
  for(; transitionIndex >= 0; transitionIndex--){
29055
29058
  var transition = transitions[transitionIndex];
29056
- var exitTime = transition.exitTime * duration;
29059
+ var exitTime = transition.exitTime * state._getDuration() + state._getClipActualStartTime();
29057
29060
  if (exitTime < curClipTime) {
29058
29061
  break;
29059
29062
  }
@@ -29684,6 +29687,16 @@ function _possible_constructor_return(self, call) {
29684
29687
  }
29685
29688
  }
29686
29689
  };
29690
+ /**
29691
+ * @internal
29692
+ */ _proto._getClipActualStartTime = function _getClipActualStartTime() {
29693
+ return this._clipStartTime * this.clip.length;
29694
+ };
29695
+ /**
29696
+ * @internal
29697
+ */ _proto._getClipActualEndTime = function _getClipActualEndTime() {
29698
+ return this._clipEndTime * this.clip.length;
29699
+ };
29687
29700
  _create_class(AnimatorState, [
29688
29701
  {
29689
29702
  key: "transitions",