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