@galacean/engine-core 1.0.0-beta.13 → 1.0.0-beta.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
@@ -9481,6 +9481,7 @@ __decorate([
9481
9481
  /**
9482
9482
  * @override
9483
9483
  */ _proto._onDestroy = function _onDestroy() {
9484
+ ReferResource.prototype._onDestroy.call(this);
9484
9485
  this._shader = null;
9485
9486
  this._shaderData = null;
9486
9487
  this._renderStates.length = 0;
@@ -15446,10 +15447,10 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
15446
15447
  var vertexElements = [];
15447
15448
  var vertexStride = this.createVertexElements(vertexElements);
15448
15449
  // vertices
15449
- var vertexBuffer = this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
15450
+ var vertexBuffer = this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * vertexStride, exports.BufferUsage.Dynamic);
15450
15451
  vertexBuffer.isGCIgnored = true;
15451
15452
  // indices
15452
- var indiceBuffer = this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
15453
+ var indiceBuffer = this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 6, exports.BufferUsage.Dynamic);
15453
15454
  indiceBuffer.isGCIgnored = true;
15454
15455
  mesh.setVertexBufferBinding(vertexBuffer, vertexStride);
15455
15456
  mesh.setIndexBufferBinding(indiceBuffer, exports.IndexFormat.UInt16);
@@ -22682,6 +22683,7 @@ var DirtyFlag;
22682
22683
  curKeyframeIndex: 0,
22683
22684
  value: null
22684
22685
  };
22686
+ this.updateMark = 0;
22685
22687
  this.target = target;
22686
22688
  this.type = type;
22687
22689
  this.property = property;
@@ -24155,9 +24157,9 @@ exports.AnimatorLayerBlendingMode = void 0;
24155
24157
  _this = Component.call(this, entity) || this;
24156
24158
  /** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
24157
24159
  /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
24160
+ _this._updateMark = 0;
24158
24161
  _this._animatorLayersData = [];
24159
24162
  _this._curveOwnerPool = Object.create(null);
24160
- _this._needRevertCurveOwners = [];
24161
24163
  _this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
24162
24164
  _this._tempAnimatorStateInfo = {
24163
24165
  layerIndex: -1,
@@ -24185,10 +24187,10 @@ exports.AnimatorLayerBlendingMode = void 0;
24185
24187
  return;
24186
24188
  }
24187
24189
  if (!state.clip) {
24188
- console.warn("The state named " + stateName + " has no AnimationClip data.");
24190
+ Logger.warn("The state named " + stateName + " has no AnimationClip data.");
24189
24191
  return;
24190
24192
  }
24191
- var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
24193
+ var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
24192
24194
  var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData, playLayerIndex);
24193
24195
  this._preparePlay(animatorLayerData, state);
24194
24196
  animatorLayerData.layerState = LayerState.Playing;
@@ -24207,8 +24209,8 @@ exports.AnimatorLayerBlendingMode = void 0;
24207
24209
  if ((_this__controllerUpdateFlag = this._controllerUpdateFlag) == null ? void 0 : _this__controllerUpdateFlag.flag) {
24208
24210
  this._reset();
24209
24211
  }
24210
- var state = this._getAnimatorStateInfo(stateName, layerIndex).state;
24211
- var manuallyTransition = this._getAnimatorLayerData(layerIndex).manuallyTransition;
24212
+ var _this__getAnimatorStateInfo = this._getAnimatorStateInfo(stateName, layerIndex), state = _this__getAnimatorStateInfo.state, playLayerIndex = _this__getAnimatorStateInfo.layerIndex;
24213
+ var manuallyTransition = this._getAnimatorLayerData(playLayerIndex).manuallyTransition;
24212
24214
  manuallyTransition.duration = normalizedTransitionDuration;
24213
24215
  manuallyTransition.offset = normalizedTimeOffset;
24214
24216
  manuallyTransition.destinationState = state;
@@ -24241,7 +24243,7 @@ exports.AnimatorLayerBlendingMode = void 0;
24241
24243
  return;
24242
24244
  }
24243
24245
  deltaTime *= this.speed;
24244
- this._revertCurveOwners();
24246
+ this._updateMark++;
24245
24247
  for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
24246
24248
  var animatorLayerData = this._getAnimatorLayerData(i1);
24247
24249
  if (animatorLayerData.layerState === LayerState.Standby) {
@@ -24289,7 +24291,6 @@ exports.AnimatorLayerBlendingMode = void 0;
24289
24291
  }
24290
24292
  }
24291
24293
  this._animatorLayersData.length = 0;
24292
- this._needRevertCurveOwners.length = 0;
24293
24294
  this._curveOwnerPool = {};
24294
24295
  this._animationEventHandlerPool.resetPool();
24295
24296
  if (this._controllerUpdateFlag) {
@@ -24331,8 +24332,8 @@ exports.AnimatorLayerBlendingMode = void 0;
24331
24332
  _proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex) {
24332
24333
  var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
24333
24334
  var curveLayerOwner = animatorStateData.curveLayerOwner;
24334
- var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
24335
24335
  var _animatorState_clip = animatorState.clip, curves = _animatorState_clip._curveBindings;
24336
+ var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
24336
24337
  for(var i = curves.length - 1; i >= 0; i--){
24337
24338
  var curve = curves[i];
24338
24339
  var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
@@ -24340,29 +24341,16 @@ exports.AnimatorLayerBlendingMode = void 0;
24340
24341
  var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
24341
24342
  var property = curve.property;
24342
24343
  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
24344
  // Get owner
24350
24345
  var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
24351
24346
  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
24347
  // Get layer owner
24360
24348
  var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
24361
24349
  var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
24362
24350
  curveLayerOwner[i] = layerOwner;
24363
24351
  } else {
24364
24352
  curveLayerOwner[i] = null;
24365
- console.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
24353
+ Logger.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
24366
24354
  }
24367
24355
  }
24368
24356
  };
@@ -24488,6 +24476,7 @@ exports.AnimatorLayerBlendingMode = void 0;
24488
24476
  if (!owner) continue;
24489
24477
  var curve = curveBindings[i].curve;
24490
24478
  if (curve.keys.length) {
24479
+ this._checkRevertOwner(owner, additive);
24491
24480
  var value = owner.evaluateValue(curve, clipTime, additive);
24492
24481
  aniUpdate && owner.applyValue(value, weight, additive);
24493
24482
  finished && layerOwner.saveFinalValue();
@@ -24533,6 +24522,7 @@ exports.AnimatorLayerBlendingMode = void 0;
24533
24522
  if (!owner) continue;
24534
24523
  var srcCurveIndex = layerOwner.crossSrcCurveIndex;
24535
24524
  var destCurveIndex = layerOwner.crossDestCurveIndex;
24525
+ this._checkRevertOwner(owner, additive);
24536
24526
  var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
24537
24527
  aniUpdate && owner.applyValue(value, weight, additive);
24538
24528
  finished && layerOwner.saveFinalValue();
@@ -24579,6 +24569,7 @@ exports.AnimatorLayerBlendingMode = void 0;
24579
24569
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
24580
24570
  if (!owner) continue;
24581
24571
  var curveIndex = layerOwner.crossDestCurveIndex;
24572
+ this._checkRevertOwner(owner, additive);
24582
24573
  var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
24583
24574
  aniUpdate && owner.applyValue(value, weight, additive);
24584
24575
  finished && layerOwner.saveFinalValue();
@@ -24605,6 +24596,7 @@ exports.AnimatorLayerBlendingMode = void 0;
24605
24596
  var layerOwner = curveLayerOwner[i];
24606
24597
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
24607
24598
  if (!owner) continue;
24599
+ this._checkRevertOwner(owner, additive);
24608
24600
  owner.applyValue(layerOwner.finalValue, weight, additive);
24609
24601
  }
24610
24602
  };
@@ -24630,16 +24622,14 @@ exports.AnimatorLayerBlendingMode = void 0;
24630
24622
  var curveLayerOwner = srcPlayData.stateData.curveLayerOwner;
24631
24623
  for(var i = curveLayerOwner.length - 1; i >= 0; i--){
24632
24624
  var _curveLayerOwner_i;
24633
- var owner = (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner;
24634
- owner.revertDefaultValue();
24625
+ (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.revertDefaultValue();
24635
24626
  }
24636
24627
  }
24637
24628
  } else {
24638
24629
  // layerState is CrossFading, FixedCrossFading, Standby, Finished
24639
24630
  var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
24640
24631
  for(var i1 = crossLayerOwnerCollection.length - 1; i1 >= 0; i1--){
24641
- var owner1 = crossLayerOwnerCollection[i1].curveOwner;
24642
- owner1.revertDefaultValue();
24632
+ crossLayerOwnerCollection[i1].curveOwner.revertDefaultValue();
24643
24633
  }
24644
24634
  }
24645
24635
  };
@@ -24662,7 +24652,7 @@ exports.AnimatorLayerBlendingMode = void 0;
24662
24652
  return;
24663
24653
  }
24664
24654
  if (!crossState.clip) {
24665
- console.warn("The state named " + name + " has no AnimationClip data.");
24655
+ Logger.warn("The state named " + name + " has no AnimationClip data.");
24666
24656
  return;
24667
24657
  }
24668
24658
  var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
@@ -24674,12 +24664,12 @@ exports.AnimatorLayerBlendingMode = void 0;
24674
24664
  destPlayData.reset(crossState, animatorStateData, offset);
24675
24665
  switch(layerState){
24676
24666
  case LayerState.Standby:
24667
+ case LayerState.Finished:
24677
24668
  animatorLayerData.layerState = LayerState.FixedCrossFading;
24678
24669
  this._clearCrossData(animatorLayerData);
24679
24670
  this._prepareStandbyCrossFading(animatorLayerData);
24680
24671
  break;
24681
24672
  case LayerState.Playing:
24682
- case LayerState.Finished:
24683
24673
  animatorLayerData.layerState = LayerState.CrossFading;
24684
24674
  this._clearCrossData(animatorLayerData);
24685
24675
  this._prepareCrossFading(animatorLayerData);
@@ -24776,11 +24766,11 @@ exports.AnimatorLayerBlendingMode = void 0;
24776
24766
  }
24777
24767
  }
24778
24768
  };
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();
24769
+ _proto._checkRevertOwner = function _checkRevertOwner(owner, additive) {
24770
+ if (additive && owner.updateMark !== this._updateMark) {
24771
+ owner.revertDefaultValue();
24783
24772
  }
24773
+ owner.updateMark = this._updateMark;
24784
24774
  };
24785
24775
  _create_class(Animator, [
24786
24776
  {
@@ -24810,13 +24800,13 @@ __decorate([
24810
24800
  ], Animator.prototype, "_controllerUpdateFlag", void 0);
24811
24801
  __decorate([
24812
24802
  ignoreClone
24813
- ], Animator.prototype, "_animatorLayersData", void 0);
24803
+ ], Animator.prototype, "_updateMark", void 0);
24814
24804
  __decorate([
24815
24805
  ignoreClone
24816
- ], Animator.prototype, "_curveOwnerPool", void 0);
24806
+ ], Animator.prototype, "_animatorLayersData", void 0);
24817
24807
  __decorate([
24818
24808
  ignoreClone
24819
- ], Animator.prototype, "_needRevertCurveOwners", void 0);
24809
+ ], Animator.prototype, "_curveOwnerPool", void 0);
24820
24810
  __decorate([
24821
24811
  ignoreClone
24822
24812
  ], Animator.prototype, "_animationEventHandlerPool", void 0);