@galacean/engine 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/browser.js CHANGED
@@ -27237,6 +27237,7 @@
27237
27237
  curKeyframeIndex: 0,
27238
27238
  value: null
27239
27239
  };
27240
+ this.updateMark = 0;
27240
27241
  this.target = target;
27241
27242
  this.type = type;
27242
27243
  this.property = property;
@@ -28678,9 +28679,9 @@
28678
28679
  _this = Component.call(this, entity) || this;
28679
28680
  /** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
28680
28681
  /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
28682
+ _this._updateMark = 0;
28681
28683
  _this._animatorLayersData = [];
28682
28684
  _this._curveOwnerPool = Object.create(null);
28683
- _this._needRevertCurveOwners = [];
28684
28685
  _this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
28685
28686
  _this._tempAnimatorStateInfo = {
28686
28687
  layerIndex: -1,
@@ -28709,10 +28710,10 @@
28709
28710
  return;
28710
28711
  }
28711
28712
  if (!state.clip) {
28712
- console.warn("The state named " + stateName + " has no AnimationClip data.");
28713
+ Logger.warn("The state named " + stateName + " has no AnimationClip data.");
28713
28714
  return;
28714
28715
  }
28715
- var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
28716
+ var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
28716
28717
  var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData, playLayerIndex);
28717
28718
  this._preparePlay(animatorLayerData, state);
28718
28719
  animatorLayerData.layerState = LayerState.Playing;
@@ -28731,8 +28732,8 @@
28731
28732
  if ((_this__controllerUpdateFlag = this._controllerUpdateFlag) == null ? void 0 : _this__controllerUpdateFlag.flag) {
28732
28733
  this._reset();
28733
28734
  }
28734
- var state = this._getAnimatorStateInfo(stateName, layerIndex).state;
28735
- var manuallyTransition = this._getAnimatorLayerData(layerIndex).manuallyTransition;
28735
+ var _this__getAnimatorStateInfo = this._getAnimatorStateInfo(stateName, layerIndex), state = _this__getAnimatorStateInfo.state, playLayerIndex = _this__getAnimatorStateInfo.layerIndex;
28736
+ var manuallyTransition = this._getAnimatorLayerData(playLayerIndex).manuallyTransition;
28736
28737
  manuallyTransition.duration = normalizedTransitionDuration;
28737
28738
  manuallyTransition.offset = normalizedTimeOffset;
28738
28739
  manuallyTransition.destinationState = state;
@@ -28765,7 +28766,7 @@
28765
28766
  return;
28766
28767
  }
28767
28768
  deltaTime *= this.speed;
28768
- this._revertCurveOwners();
28769
+ this._updateMark++;
28769
28770
  for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
28770
28771
  var animatorLayerData = this._getAnimatorLayerData(i1);
28771
28772
  if (animatorLayerData.layerState === LayerState.Standby) {
@@ -28813,7 +28814,6 @@
28813
28814
  }
28814
28815
  }
28815
28816
  this._animatorLayersData.length = 0;
28816
- this._needRevertCurveOwners.length = 0;
28817
28817
  this._curveOwnerPool = {};
28818
28818
  this._animationEventHandlerPool.resetPool();
28819
28819
  if (this._controllerUpdateFlag) {
@@ -28855,8 +28855,8 @@
28855
28855
  _proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex) {
28856
28856
  var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
28857
28857
  var curveLayerOwner = animatorStateData.curveLayerOwner;
28858
- var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
28859
28858
  var _animatorState_clip = animatorState.clip, curves = _animatorState_clip._curveBindings;
28859
+ var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
28860
28860
  for(var i = curves.length - 1; i >= 0; i--){
28861
28861
  var curve = curves[i];
28862
28862
  var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
@@ -28864,29 +28864,16 @@
28864
28864
  var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
28865
28865
  var property = curve.property;
28866
28866
  var instanceId = targetEntity.instanceId;
28867
- var needRevert = false;
28868
- var baseAnimatorLayerData = this._animatorLayersData[0];
28869
- var baseLayerCurveOwnerPool = baseAnimatorLayerData.curveOwnerPool;
28870
- if (this.animatorController.layers[layerIndex].blendingMode === exports.AnimatorLayerBlendingMode.Additive && layerIndex > 0 && !(baseLayerCurveOwnerPool[instanceId] && baseLayerCurveOwnerPool[instanceId][property])) {
28871
- needRevert = true;
28872
- }
28873
28867
  // Get owner
28874
28868
  var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
28875
28869
  var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity));
28876
- //@todo: There is performance waste here, which will be handled together with organizing AnimatorStateData later. The logic is changing from runtime to initialization.
28877
- if (needRevert) {
28878
- this._needRevertCurveOwners.push(owner);
28879
- } else {
28880
- var index = this._needRevertCurveOwners.indexOf(owner);
28881
- index > -1 && this._needRevertCurveOwners.splice(index, 1);
28882
- }
28883
28870
  // Get layer owner
28884
28871
  var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
28885
28872
  var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
28886
28873
  curveLayerOwner[i] = layerOwner;
28887
28874
  } else {
28888
28875
  curveLayerOwner[i] = null;
28889
- console.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
28876
+ Logger.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
28890
28877
  }
28891
28878
  }
28892
28879
  };
@@ -29012,6 +28999,7 @@
29012
28999
  if (!owner) continue;
29013
29000
  var curve = curveBindings[i].curve;
29014
29001
  if (curve.keys.length) {
29002
+ this._checkRevertOwner(owner, additive);
29015
29003
  var value = owner.evaluateValue(curve, clipTime, additive);
29016
29004
  aniUpdate && owner.applyValue(value, weight, additive);
29017
29005
  finished && layerOwner.saveFinalValue();
@@ -29057,6 +29045,7 @@
29057
29045
  if (!owner) continue;
29058
29046
  var srcCurveIndex = layerOwner.crossSrcCurveIndex;
29059
29047
  var destCurveIndex = layerOwner.crossDestCurveIndex;
29048
+ this._checkRevertOwner(owner, additive);
29060
29049
  var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
29061
29050
  aniUpdate && owner.applyValue(value, weight, additive);
29062
29051
  finished && layerOwner.saveFinalValue();
@@ -29103,6 +29092,7 @@
29103
29092
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
29104
29093
  if (!owner) continue;
29105
29094
  var curveIndex = layerOwner.crossDestCurveIndex;
29095
+ this._checkRevertOwner(owner, additive);
29106
29096
  var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
29107
29097
  aniUpdate && owner.applyValue(value, weight, additive);
29108
29098
  finished && layerOwner.saveFinalValue();
@@ -29129,6 +29119,7 @@
29129
29119
  var layerOwner = curveLayerOwner[i];
29130
29120
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
29131
29121
  if (!owner) continue;
29122
+ this._checkRevertOwner(owner, additive);
29132
29123
  owner.applyValue(layerOwner.finalValue, weight, additive);
29133
29124
  }
29134
29125
  };
@@ -29154,16 +29145,14 @@
29154
29145
  var curveLayerOwner = srcPlayData.stateData.curveLayerOwner;
29155
29146
  for(var i = curveLayerOwner.length - 1; i >= 0; i--){
29156
29147
  var _curveLayerOwner_i;
29157
- var owner = (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner;
29158
- owner.revertDefaultValue();
29148
+ (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.revertDefaultValue();
29159
29149
  }
29160
29150
  }
29161
29151
  } else {
29162
29152
  // layerState is CrossFading, FixedCrossFading, Standby, Finished
29163
29153
  var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
29164
29154
  for(var i1 = crossLayerOwnerCollection.length - 1; i1 >= 0; i1--){
29165
- var owner1 = crossLayerOwnerCollection[i1].curveOwner;
29166
- owner1.revertDefaultValue();
29155
+ crossLayerOwnerCollection[i1].curveOwner.revertDefaultValue();
29167
29156
  }
29168
29157
  }
29169
29158
  };
@@ -29186,7 +29175,7 @@
29186
29175
  return;
29187
29176
  }
29188
29177
  if (!crossState.clip) {
29189
- console.warn("The state named " + name + " has no AnimationClip data.");
29178
+ Logger.warn("The state named " + name + " has no AnimationClip data.");
29190
29179
  return;
29191
29180
  }
29192
29181
  var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
@@ -29198,12 +29187,12 @@
29198
29187
  destPlayData.reset(crossState, animatorStateData, offset);
29199
29188
  switch(layerState){
29200
29189
  case LayerState.Standby:
29190
+ case LayerState.Finished:
29201
29191
  animatorLayerData.layerState = LayerState.FixedCrossFading;
29202
29192
  this._clearCrossData(animatorLayerData);
29203
29193
  this._prepareStandbyCrossFading(animatorLayerData);
29204
29194
  break;
29205
29195
  case LayerState.Playing:
29206
- case LayerState.Finished:
29207
29196
  animatorLayerData.layerState = LayerState.CrossFading;
29208
29197
  this._clearCrossData(animatorLayerData);
29209
29198
  this._prepareCrossFading(animatorLayerData);
@@ -29300,11 +29289,11 @@
29300
29289
  }
29301
29290
  }
29302
29291
  };
29303
- _proto._revertCurveOwners = function _revertCurveOwners() {
29304
- var curveOwners = this._needRevertCurveOwners;
29305
- for(var i = 0, n = curveOwners.length; i < n; ++i){
29306
- curveOwners[i].revertDefaultValue();
29292
+ _proto._checkRevertOwner = function _checkRevertOwner(owner, additive) {
29293
+ if (additive && owner.updateMark !== this._updateMark) {
29294
+ owner.revertDefaultValue();
29307
29295
  }
29296
+ owner.updateMark = this._updateMark;
29308
29297
  };
29309
29298
  _create_class$3(Animator, [
29310
29299
  {
@@ -29334,13 +29323,13 @@
29334
29323
  ], Animator.prototype, "_controllerUpdateFlag", void 0);
29335
29324
  __decorate$1([
29336
29325
  ignoreClone
29337
- ], Animator.prototype, "_animatorLayersData", void 0);
29326
+ ], Animator.prototype, "_updateMark", void 0);
29338
29327
  __decorate$1([
29339
29328
  ignoreClone
29340
- ], Animator.prototype, "_curveOwnerPool", void 0);
29329
+ ], Animator.prototype, "_animatorLayersData", void 0);
29341
29330
  __decorate$1([
29342
29331
  ignoreClone
29343
- ], Animator.prototype, "_needRevertCurveOwners", void 0);
29332
+ ], Animator.prototype, "_curveOwnerPool", void 0);
29344
29333
  __decorate$1([
29345
29334
  ignoreClone
29346
29335
  ], Animator.prototype, "_animationEventHandlerPool", void 0);
@@ -38307,7 +38296,7 @@
38307
38296
  ], GALACEAN_animation_event);
38308
38297
 
38309
38298
  //@ts-ignore
38310
- var version = "1.0.0-beta.13";
38299
+ var version = "1.0.0-beta.14";
38311
38300
  console.log("Galacean engine version: " + version);
38312
38301
  for(var key in CoreObjects){
38313
38302
  Loader.registerClass(key, CoreObjects[key]);