@galacean/engine 0.9.12 → 0.9.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
@@ -7026,6 +7026,28 @@
7026
7026
  * @remarks The release principle is that it is not referenced by the components, including direct and indirect reference.
7027
7027
  */ _proto.gc = function gc() {
7028
7028
  this._gc(false);
7029
+ var engine = this.engine;
7030
+ engine._renderElementPool.garbageCollection();
7031
+ engine._spriteElementPool.garbageCollection();
7032
+ engine._spriteMaskElementPool.garbageCollection();
7033
+ engine._textElementPool.garbageCollection();
7034
+ var _componentsManager = engine._componentsManager, _lightManager = engine._lightManager;
7035
+ _componentsManager._renderers.garbageCollection();
7036
+ // @ts-ignore
7037
+ _componentsManager._onStartScripts.garbageCollection();
7038
+ // @ts-ignore
7039
+ _componentsManager._onUpdateScripts.garbageCollection();
7040
+ // @ts-ignore
7041
+ _componentsManager._onLateUpdateScripts.garbageCollection();
7042
+ // @ts-ignore
7043
+ _componentsManager._onPhysicsUpdateScripts.garbageCollection();
7044
+ // @ts-ignore
7045
+ _componentsManager._onUpdateAnimations.garbageCollection();
7046
+ // @ts-ignore
7047
+ _componentsManager._onUpdateRenderers.garbageCollection();
7048
+ _lightManager._spotLights.garbageCollection();
7049
+ _lightManager._pointLights.garbageCollection();
7050
+ _lightManager._directLights.garbageCollection();
7029
7051
  };
7030
7052
  /**
7031
7053
  * @internal
@@ -8856,6 +8878,11 @@
8856
8878
  * @returns Cloned entity
8857
8879
  */ _proto.clone = function clone() {
8858
8880
  var cloneEntity = new Entity(this._engine, this.name);
8881
+ var _this = this, hookResource = _this._hookResource;
8882
+ if (hookResource) {
8883
+ cloneEntity._hookResource = hookResource;
8884
+ hookResource._addRefCount(1);
8885
+ }
8859
8886
  cloneEntity._isActive = this._isActive;
8860
8887
  cloneEntity.transform.localMatrix = this.transform.localMatrix;
8861
8888
  var children = this._children;
@@ -8880,6 +8907,10 @@
8880
8907
  return;
8881
8908
  }
8882
8909
  EngineObject.prototype.destroy.call(this);
8910
+ if (this._hookResource) {
8911
+ this._hookResource._addRefCount(-1);
8912
+ this._hookResource = null;
8913
+ }
8883
8914
  var components = this._components;
8884
8915
  for(var i = components.length - 1; i >= 0; i--){
8885
8916
  components[i].destroy();
@@ -14426,9 +14457,9 @@
14426
14457
  var Material = function Material(engine, shader) {
14427
14458
  var _this;
14428
14459
  _this = RefObject.call(this, engine) || this;
14429
- /** Shader data. */ _this.shaderData = new ShaderData(ShaderDataGroup.Material);
14430
14460
  /** @internal */ _this._renderStates = [] // todo: later will as a part of shaderData when shader effect frame is OK, that is more powerful and flexible.
14431
14461
  ;
14462
+ _this._shaderData = new ShaderData(ShaderDataGroup.Material);
14432
14463
  _this.shader = shader;
14433
14464
  return _this;
14434
14465
  };
@@ -14461,8 +14492,21 @@
14461
14492
  */ _proto._preRender = function _preRender(renderElement) {};
14462
14493
  /**
14463
14494
  * @override
14464
- */ _proto._onDestroy = function _onDestroy() {};
14495
+ */ _proto._onDestroy = function _onDestroy() {
14496
+ this._shader = null;
14497
+ this._shaderData = null;
14498
+ this._renderStates.length = 0;
14499
+ this._renderStates = null;
14500
+ };
14465
14501
  _create_class$3(Material, [
14502
+ {
14503
+ key: "shaderData",
14504
+ get: /**
14505
+ * Shader data.
14506
+ */ function get() {
14507
+ return this._shaderData;
14508
+ }
14509
+ },
14466
14510
  {
14467
14511
  key: "shader",
14468
14512
  get: /**
@@ -14530,6 +14574,12 @@
14530
14574
  */ _proto.resetPool = function resetPool() {
14531
14575
  this._elementPoolIndex = 0;
14532
14576
  };
14577
+ _proto.garbageCollection = function garbageCollection() {
14578
+ var _this = this, pool = _this._elementPool;
14579
+ for(var i = pool.length - 1; i >= 0; i--){
14580
+ pool[i].dispose && pool[i].dispose();
14581
+ }
14582
+ };
14533
14583
  return ClassPool;
14534
14584
  }();
14535
14585
  var RenderElement = function RenderElement() {};
@@ -14549,6 +14599,9 @@
14549
14599
  this.renderState = renderState;
14550
14600
  this.shaderPass = shaderPass;
14551
14601
  };
14602
+ _proto.dispose = function dispose() {
14603
+ this.component = this.mesh = this.subMesh = this.material = this.renderState = this.shaderPass = null;
14604
+ };
14552
14605
  return MeshRenderElement;
14553
14606
  }(RenderElement);
14554
14607
  /**
@@ -14592,6 +14645,9 @@
14592
14645
  this.renderState = renderState;
14593
14646
  this.shaderPass = shaderPass;
14594
14647
  };
14648
+ _proto.dispose = function dispose() {
14649
+ this.component = this.renderData = this.material = this.texture = this.renderState = this.shaderPass = null;
14650
+ };
14595
14651
  return SpriteElement;
14596
14652
  }(RenderElement);
14597
14653
  var SpriteMaskElement = /*#__PURE__*/ function(RenderElement) {
@@ -14609,6 +14665,9 @@
14609
14665
  this.renderData = renderData;
14610
14666
  this.material = material;
14611
14667
  };
14668
+ _proto.dispose = function dispose() {
14669
+ this.component = this.renderData = this.material = null;
14670
+ };
14612
14671
  return SpriteMaskElement;
14613
14672
  }(RenderElement);
14614
14673
  /**
@@ -14624,7 +14683,6 @@
14624
14683
  var Renderer1 = function Renderer1(entity) {
14625
14684
  var _this;
14626
14685
  _this = Component.call(this, entity) || this;
14627
- /** ShaderData related to renderer. */ _this.shaderData = new ShaderData(ShaderDataGroup.Renderer);
14628
14686
  /** @internal */ _this._onUpdateIndex = -1;
14629
14687
  /** @internal */ _this._rendererIndex = -1;
14630
14688
  /** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
@@ -14632,6 +14690,7 @@
14632
14690
  _this._overrideUpdate = false;
14633
14691
  _this._materials = [];
14634
14692
  _this._dirtyUpdateFlag = 0;
14693
+ _this._shaderData = new ShaderData(ShaderDataGroup.Renderer);
14635
14694
  _this._mvMatrix = new Matrix();
14636
14695
  _this._mvpMatrix = new Matrix();
14637
14696
  _this._mvInvMatrix = new Matrix();
@@ -14779,6 +14838,17 @@
14779
14838
  var _materials_i;
14780
14839
  (_materials_i = materials[i]) == null ? void 0 : _materials_i._addRefCount(-1);
14781
14840
  }
14841
+ this._entity = null;
14842
+ this._globalShaderMacro = null;
14843
+ this._bounds = null;
14844
+ this._materials = null;
14845
+ this._shaderData = null;
14846
+ this._mvMatrix = null;
14847
+ this._mvpMatrix = null;
14848
+ this._mvInvMatrix = null;
14849
+ this._normalMatrix = null;
14850
+ this._materialsInstanced = null;
14851
+ this._rendererLayer = null;
14782
14852
  };
14783
14853
  _proto._updateShaderData = function _updateShaderData(context) {
14784
14854
  var entity = this.entity;
@@ -14840,6 +14910,14 @@
14840
14910
  this._dirtyUpdateFlag |= 0x1;
14841
14911
  };
14842
14912
  _create_class$3(Renderer1, [
14913
+ {
14914
+ key: "shaderData",
14915
+ get: /**
14916
+ * ShaderData related to renderer.
14917
+ */ function get() {
14918
+ return this._shaderData;
14919
+ }
14920
+ },
14843
14921
  {
14844
14922
  key: "isCulled",
14845
14923
  get: /**
@@ -14924,9 +15002,6 @@
14924
15002
  }(), function() {
14925
15003
  _Renderer._rendererLayerProperty = Shader.getPropertyByName("oasis_RendererLayer");
14926
15004
  }(), _Renderer);
14927
- __decorate$1([
14928
- deepClone
14929
- ], exports.Renderer.prototype, "shaderData", void 0);
14930
15005
  __decorate$1([
14931
15006
  ignoreClone
14932
15007
  ], exports.Renderer.prototype, "_distanceForSort", void 0);
@@ -14954,6 +15029,9 @@
14954
15029
  __decorate$1([
14955
15030
  ignoreClone
14956
15031
  ], exports.Renderer.prototype, "_dirtyUpdateFlag", void 0);
15032
+ __decorate$1([
15033
+ deepClone
15034
+ ], exports.Renderer.prototype, "_shaderData", void 0);
14957
15035
  __decorate$1([
14958
15036
  ignoreClone
14959
15037
  ], exports.Renderer.prototype, "_mvMatrix", void 0);
@@ -15201,6 +15279,7 @@
15201
15279
  sprite._addRefCount(-1);
15202
15280
  sprite._updateFlagManager.removeListener(this._onSpriteChange);
15203
15281
  }
15282
+ this._entity = null;
15204
15283
  this._sprite = null;
15205
15284
  this._renderData = null;
15206
15285
  };
@@ -15795,14 +15874,19 @@
15795
15874
  }();
15796
15875
  /**
15797
15876
  * Sub-mesh, mainly contains drawing information.
15798
- */ var SubMesh = function SubMesh(start, count, topology) {
15799
- if (start === void 0) start = 0;
15800
- if (count === void 0) count = 0;
15801
- if (topology === void 0) topology = exports.MeshTopology.Triangles;
15802
- this.start = start;
15803
- this.count = count;
15804
- this.topology = topology;
15805
- };
15877
+ */ var SubMesh = /*#__PURE__*/ function() {
15878
+ var SubMesh = function SubMesh(start, count, topology) {
15879
+ if (start === void 0) start = 0;
15880
+ if (count === void 0) count = 0;
15881
+ if (topology === void 0) topology = exports.MeshTopology.Triangles;
15882
+ this.start = start;
15883
+ this.count = count;
15884
+ this.topology = topology;
15885
+ };
15886
+ var _proto = SubMesh.prototype;
15887
+ _proto.dispose = function dispose() {};
15888
+ return SubMesh;
15889
+ }();
15806
15890
  /**
15807
15891
  * Mesh.
15808
15892
  */ var Mesh = /*#__PURE__*/ function(RefObject) {
@@ -15917,6 +16001,7 @@
15917
16001
  this._indexBufferBinding = null;
15918
16002
  this._vertexElements = null;
15919
16003
  this._vertexElementMap = null;
16004
+ this._updateFlagManager = null;
15920
16005
  this._platformPrimitive.destroy();
15921
16006
  };
15922
16007
  _proto._setVertexElements = function _setVertexElements(elements) {
@@ -17596,8 +17681,8 @@
17596
17681
  */ _proto._onDestroy = function _onDestroy() {
17597
17682
  Renderer.prototype._onDestroy.call(this);
17598
17683
  var mesh = this._mesh;
17599
- if (mesh && !mesh.destroyed) {
17600
- mesh._addRefCount(-1);
17684
+ if (mesh) {
17685
+ mesh.destroyed || mesh._addRefCount(-1);
17601
17686
  mesh._updateFlagManager.removeListener(this._onMeshChanged);
17602
17687
  this._mesh = null;
17603
17688
  }
@@ -17931,10 +18016,21 @@
17931
18016
  * @internal
17932
18017
  * @override
17933
18018
  */ _proto._onDestroy = function _onDestroy() {
17934
- var _this_rootBone, _this__jointTexture;
18019
+ var _this__rootBone, _this__jointTexture;
17935
18020
  MeshRenderer.prototype._onDestroy.call(this);
17936
- (_this_rootBone = this.rootBone) == null ? void 0 : _this_rootBone.transform._updateFlagManager.removeListener(this._onTransformChanged);
18021
+ (_this__rootBone = this._rootBone) == null ? void 0 : _this__rootBone.transform._updateFlagManager.removeListener(this._onTransformChanged);
18022
+ this._rootBone = null;
18023
+ this._jointDataCreateCache = null;
18024
+ this._skin = null;
18025
+ this._blendShapeWeights = null;
18026
+ this._localBounds = null;
18027
+ this._jointMatrices = null;
17937
18028
  (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
18029
+ this._jointTexture = null;
18030
+ if (this._jointEntities) {
18031
+ this._jointEntities.length = 0;
18032
+ this._jointEntities = null;
18033
+ }
17938
18034
  };
17939
18035
  /**
17940
18036
  * @internal
@@ -19309,6 +19405,11 @@
19309
19405
  return _this;
19310
19406
  };
19311
19407
  _inherits$2(TextRenderElement, RenderElement);
19408
+ var _proto = TextRenderElement.prototype;
19409
+ _proto.dispose = function dispose() {
19410
+ this.component = this.material = this.renderState = this.shaderPass = null;
19411
+ this.charElements.length = 0;
19412
+ };
19312
19413
  return TextRenderElement;
19313
19414
  }(RenderElement);
19314
19415
  /**
@@ -19452,7 +19553,6 @@
19452
19553
  this.texture = null;
19453
19554
  this.solidColor = null;
19454
19555
  this.sky.destroy();
19455
- this._engine = null;
19456
19556
  };
19457
19557
  /**
19458
19558
  * @internal
@@ -19833,8 +19933,6 @@
19833
19933
  function Scene(engine, name) {
19834
19934
  var _this;
19835
19935
  _this = EngineObject.call(this, engine) || this;
19836
- /** The background of the scene. */ _this.background = new Background(_this._engine);
19837
- /** Scene-related shader data. */ _this.shaderData = new ShaderData(ShaderDataGroup.Scene);
19838
19936
  /** If cast shadows. */ _this.castShadows = true;
19839
19937
  /** The resolution of the shadow maps. */ _this.shadowResolution = exports.ShadowResolution.Medium;
19840
19938
  /** The splits of two cascade distribution. */ _this.shadowTwoCascadeSplits = 1.0 / 3.0;
@@ -19844,6 +19942,8 @@
19844
19942
  /** @internal */ _this._isActiveInEngine = false;
19845
19943
  /** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
19846
19944
  /** @internal */ _this._rootEntities = [];
19945
+ _this._background = new Background(_this._engine);
19946
+ _this._shaderData = new ShaderData(ShaderDataGroup.Scene);
19847
19947
  _this._shadowCascades = exports.ShadowCascadesMode.NoCascades;
19848
19948
  _this._fogMode = exports.FogMode.None;
19849
19949
  _this._fogColor = new Color$1(0.5, 0.5, 0.5, 1.0);
@@ -20005,6 +20105,8 @@
20005
20105
  var sunLightIndex = lightManager._getSunLightIndex();
20006
20106
  if (sunLightIndex !== -1) {
20007
20107
  this._sunLight = lightManager._directLights.get(sunLightIndex);
20108
+ } else {
20109
+ this._sunLight = null;
20008
20110
  }
20009
20111
  if (this.castShadows && this._sunLight && this._sunLight.shadowType !== exports.ShadowType.None) {
20010
20112
  shaderData.enableMacro("SHADOW_TYPE", this._sunLight.shadowType.toString());
@@ -20064,6 +20166,22 @@
20064
20166
  this._fogParams.w = density / Math.sqrt(Math.LN2);
20065
20167
  };
20066
20168
  _create_class$3(Scene, [
20169
+ {
20170
+ key: "shaderData",
20171
+ get: /**
20172
+ * Scene-related shader data.
20173
+ */ function get() {
20174
+ return this._shaderData;
20175
+ }
20176
+ },
20177
+ {
20178
+ key: "background",
20179
+ get: /**
20180
+ * The background of the scene.
20181
+ */ function get() {
20182
+ return this._background;
20183
+ }
20184
+ },
20067
20185
  {
20068
20186
  key: "shadowCascades",
20069
20187
  get: /**
@@ -22320,7 +22438,6 @@
22320
22438
  var Camera1 = function Camera1(entity) {
22321
22439
  var _this;
22322
22440
  _this = Component.call(this, entity) || this;
22323
- /** Shader data. */ _this.shaderData = new ShaderData(ShaderDataGroup.Camera);
22324
22441
  /** Rendering priority - A Camera with higher priority will be rendered on top of a camera with lower priority. */ _this.priority = 0;
22325
22442
  /** Whether to enable frustum culling, it is enabled by default. */ _this.enableFrustumCulling = true;
22326
22443
  /**
@@ -22334,6 +22451,7 @@
22334
22451
  /** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
22335
22452
  /** @internal */ _this._frustum = new BoundingFrustum();
22336
22453
  /** @internal */ _this._virtualCamera = new VirtualCamera();
22454
+ _this._shaderData = new ShaderData(ShaderDataGroup.Camera);
22337
22455
  _this._isProjMatSetting = false;
22338
22456
  _this._nearClipPlane = 0.1;
22339
22457
  _this._farClipPlane = 100;
@@ -22533,6 +22651,20 @@
22533
22651
  this._isInvViewProjDirty.destroy();
22534
22652
  this._isViewMatrixDirty.destroy();
22535
22653
  this.shaderData._addRefCount(-1);
22654
+ this._entity = null;
22655
+ this._globalShaderMacro = null;
22656
+ this._frustum = null;
22657
+ this._renderPipeline = null;
22658
+ this._virtualCamera = null;
22659
+ this._shaderData = null;
22660
+ this._frustumViewChangeFlag = null;
22661
+ this._transform = null;
22662
+ this._isViewMatrixDirty = null;
22663
+ this._isInvViewProjDirty = null;
22664
+ this._viewport = null;
22665
+ this._inverseProjectionMatrix = null;
22666
+ this._lastAspectSize = null;
22667
+ this._invViewProjMat = null;
22536
22668
  };
22537
22669
  _proto._projMatChange = function _projMatChange() {
22538
22670
  this._isFrustumProjectDirty = true;
@@ -22572,6 +22704,14 @@
22572
22704
  return this._inverseProjectionMatrix;
22573
22705
  };
22574
22706
  _create_class$3(Camera1, [
22707
+ {
22708
+ key: "shaderData",
22709
+ get: /**
22710
+ * Shader data.
22711
+ */ function get() {
22712
+ return this._shaderData;
22713
+ }
22714
+ },
22575
22715
  {
22576
22716
  key: "nearClipPlane",
22577
22717
  get: /**
@@ -24620,6 +24760,7 @@
24620
24760
  sprite._addRefCount(-1);
24621
24761
  sprite._updateFlagManager.removeListener(this._onSpriteChange);
24622
24762
  }
24763
+ this._entity = null;
24623
24764
  this._color = null;
24624
24765
  this._sprite = null;
24625
24766
  this._assembler = null;
@@ -25853,8 +25994,6 @@
25853
25994
  * @internal
25854
25995
  */ var AnimationCurveOwner = /*#__PURE__*/ function() {
25855
25996
  function AnimationCurveOwner(target, type, property, cureType) {
25856
- this.crossCurveMark = 0;
25857
- this.hasSavedDefaultValue = false;
25858
25997
  this.baseEvaluateData = {
25859
25998
  curKeyframeIndex: 0,
25860
25999
  value: null
@@ -25867,7 +26006,7 @@
25867
26006
  this.type = type;
25868
26007
  this.property = property;
25869
26008
  this.component = target.getComponent(type);
25870
- this._cureType = cureType;
26009
+ this.cureType = cureType;
25871
26010
  var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
25872
26011
  this._assembler = new assemblerType();
25873
26012
  this._assembler.initialize(this);
@@ -25876,89 +26015,80 @@
25876
26015
  }
25877
26016
  }
25878
26017
  var _proto = AnimationCurveOwner.prototype;
25879
- _proto.evaluateAndApplyValue = function evaluateAndApplyValue(curve, time, layerWeight, additive) {
25880
- if (curve.keys.length) {
25881
- if (additive) {
25882
- var value = curve._evaluateAdditive(time, this.baseEvaluateData);
25883
- var cureType = this._cureType;
25884
- if (cureType._isReferenceType) {
25885
- cureType._additiveValue(value, layerWeight, this.referenceTargetValue);
25886
- } else {
25887
- var assembler = this._assembler;
25888
- var originValue = assembler.getTargetValue();
25889
- var additiveValue = cureType._additiveValue(value, layerWeight, originValue);
25890
- assembler.setTargetValue(additiveValue);
25891
- }
25892
- } else {
25893
- var value1 = curve._evaluate(time, this.baseEvaluateData);
25894
- this._applyValue(value1, layerWeight);
25895
- }
25896
- }
26018
+ _proto.evaluateValue = function evaluateValue(curve, time, additive) {
26019
+ return additive ? curve._evaluateAdditive(time, this.baseEvaluateData) : curve._evaluate(time, this.baseEvaluateData);
25897
26020
  };
25898
- _proto.crossFadeAndApplyValue = function crossFadeAndApplyValue(srcCurve, destCurve, srcTime, destTime, crossWeight, layerWeight, additive) {
25899
- var srcValue = srcCurve && srcCurve.keys.length ? additive ? srcCurve._evaluateAdditive(srcTime, this.baseEvaluateData) : srcCurve._evaluate(srcTime, this.baseEvaluateData) : additive ? this._cureType._getZeroValue(this.baseEvaluateData.value) : this.defaultValue;
25900
- var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this._cureType._getZeroValue(this.crossEvaluateData.value) : this.defaultValue;
25901
- this._applyCrossValue(srcValue, destValue, crossWeight, layerWeight, additive);
26021
+ _proto.evaluateCrossFadeValue = function evaluateCrossFadeValue(srcCurve, destCurve, srcTime, destTime, crossWeight, additive) {
26022
+ var srcValue = srcCurve && srcCurve.keys.length ? additive ? srcCurve._evaluateAdditive(srcTime, this.baseEvaluateData) : srcCurve._evaluate(srcTime, this.baseEvaluateData) : additive ? this.cureType._getZeroValue(this.baseEvaluateData.value) : this.defaultValue;
26023
+ var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.cureType._getZeroValue(this.crossEvaluateData.value) : this.defaultValue;
26024
+ return this._lerpValue(srcValue, destValue, crossWeight);
25902
26025
  };
25903
- _proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight, layerWeight, additive) {
25904
- var srcValue = additive ? this._cureType._subtractValue(this.fixedPoseValue, this.defaultValue, this.baseEvaluateData.value) : this.fixedPoseValue;
25905
- var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this._cureType._getZeroValue(this.crossEvaluateData.value) : this.defaultValue;
25906
- this._applyCrossValue(srcValue, destValue, crossWeight, layerWeight, additive);
26026
+ _proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight, additive) {
26027
+ var srcValue = additive ? this.cureType._subtractValue(this.fixedPoseValue, this.defaultValue, this.baseEvaluateData.value) : this.fixedPoseValue;
26028
+ var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.cureType._getZeroValue(this.crossEvaluateData.value) : this.defaultValue;
26029
+ return this._lerpValue(srcValue, destValue, crossWeight);
25907
26030
  };
25908
26031
  _proto.revertDefaultValue = function revertDefaultValue() {
25909
26032
  this._assembler.setTargetValue(this.defaultValue);
25910
26033
  };
26034
+ _proto.getEvaluateValue = function getEvaluateValue(out) {
26035
+ if (this.cureType._isReferenceType) {
26036
+ this.cureType._copyValue(this.baseEvaluateData.value, out);
26037
+ return out;
26038
+ } else {
26039
+ return this.baseEvaluateData.value;
26040
+ }
26041
+ };
25911
26042
  _proto.saveDefaultValue = function saveDefaultValue() {
25912
- if (this._cureType._isReferenceType) {
25913
- this._cureType._copyValue(this.referenceTargetValue, this.defaultValue);
26043
+ if (this.cureType._isReferenceType) {
26044
+ this.cureType._copyValue(this.referenceTargetValue, this.defaultValue);
25914
26045
  } else {
25915
26046
  this.defaultValue = this._assembler.getTargetValue();
25916
26047
  }
25917
- this.hasSavedDefaultValue = true;
25918
26048
  };
25919
26049
  _proto.saveFixedPoseValue = function saveFixedPoseValue() {
25920
- if (this._cureType._isReferenceType) {
25921
- this._cureType._copyValue(this.referenceTargetValue, this.fixedPoseValue);
26050
+ if (this.cureType._isReferenceType) {
26051
+ this.cureType._copyValue(this.referenceTargetValue, this.fixedPoseValue);
25922
26052
  } else {
25923
26053
  this.fixedPoseValue = this._assembler.getTargetValue();
25924
26054
  }
25925
26055
  };
25926
- _proto._applyValue = function _applyValue(value, weight) {
25927
- if (weight === 1.0) {
25928
- if (this._cureType._isReferenceType) {
25929
- this._cureType._copyValue(value, this.referenceTargetValue);
26056
+ _proto.applyValue = function applyValue(value, weight, additive) {
26057
+ var cureType = this.cureType;
26058
+ if (additive) {
26059
+ if (cureType._isReferenceType) {
26060
+ cureType._additiveValue(value, weight, this.referenceTargetValue);
25930
26061
  } else {
25931
- this._assembler.setTargetValue(value);
26062
+ var assembler = this._assembler;
26063
+ var originValue = assembler.getTargetValue();
26064
+ var additiveValue = cureType._additiveValue(value, weight, originValue);
26065
+ assembler.setTargetValue(additiveValue);
25932
26066
  }
25933
26067
  } else {
25934
- if (this._cureType._isReferenceType) {
25935
- var targetValue = this.referenceTargetValue;
25936
- this._cureType._lerpValue(targetValue, value, weight, targetValue);
26068
+ if (weight === 1.0) {
26069
+ if (cureType._isReferenceType) {
26070
+ cureType._copyValue(value, this.referenceTargetValue);
26071
+ } else {
26072
+ this._assembler.setTargetValue(value);
26073
+ }
25937
26074
  } else {
25938
- var originValue = this._assembler.getTargetValue();
25939
- var lerpValue = this._cureType._lerpValue(originValue, value, weight);
25940
- this._assembler.setTargetValue(lerpValue);
26075
+ if (cureType._isReferenceType) {
26076
+ var targetValue = this.referenceTargetValue;
26077
+ cureType._lerpValue(targetValue, value, weight, targetValue);
26078
+ } else {
26079
+ var originValue1 = this._assembler.getTargetValue();
26080
+ var lerpValue = cureType._lerpValue(originValue1, value, weight);
26081
+ this._assembler.setTargetValue(lerpValue);
26082
+ }
25941
26083
  }
25942
26084
  }
25943
26085
  };
25944
- _proto._applyCrossValue = function _applyCrossValue(srcValue, destValue, crossWeight, layerWeight, additive) {
25945
- var out;
25946
- if (this._cureType._isReferenceType) {
25947
- out = this.baseEvaluateData.value;
25948
- this._cureType._lerpValue(srcValue, destValue, crossWeight, out);
25949
- } else {
25950
- out = this._cureType._lerpValue(srcValue, destValue, crossWeight);
25951
- }
25952
- if (additive) {
25953
- if (this._cureType._isReferenceType) {
25954
- this._cureType._additiveValue(out, layerWeight, this.referenceTargetValue);
25955
- } else {
25956
- var originValue = this._assembler.getTargetValue();
25957
- var lerpValue = this._cureType._additiveValue(out, layerWeight, originValue);
25958
- this._assembler.setTargetValue(lerpValue);
25959
- }
26086
+ _proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
26087
+ if (this.cureType._isReferenceType) {
26088
+ return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
25960
26089
  } else {
25961
- this._applyValue(out, layerWeight);
26090
+ this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
26091
+ return this.baseEvaluateData.value;
25962
26092
  }
25963
26093
  };
25964
26094
  AnimationCurveOwner.registerAssembler = function registerAssembler(componentType, property, assemblerType) {
@@ -26047,6 +26177,26 @@
26047
26177
  return BlendShapeWeightsAnimationCurveOwnerAssembler;
26048
26178
  }();
26049
26179
  AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights", BlendShapeWeightsAnimationCurveOwnerAssembler);
26180
+ /**
26181
+ * @internal
26182
+ */ var AnimationCurveLayerOwner = /*#__PURE__*/ function() {
26183
+ var AnimationCurveLayerOwner = function AnimationCurveLayerOwner() {
26184
+ this.crossCurveMark = 0;
26185
+ };
26186
+ var _proto = AnimationCurveLayerOwner.prototype;
26187
+ _proto.initFinalValue = function initFinalValue() {
26188
+ var _this_curveOwner = this.curveOwner, cureType = _this_curveOwner.cureType, defaultValue = _this_curveOwner.defaultValue;
26189
+ if (cureType._isReferenceType) {
26190
+ cureType._copyValue(defaultValue, this.finalValue);
26191
+ } else {
26192
+ this.finalValue = defaultValue;
26193
+ }
26194
+ };
26195
+ _proto.saveFinalValue = function saveFinalValue() {
26196
+ this.finalValue = this.curveOwner.getEvaluateValue(this.finalValue);
26197
+ };
26198
+ return AnimationCurveLayerOwner;
26199
+ }();
26050
26200
  /**
26051
26201
  * Associate AnimationCurve and the Entity
26052
26202
  */ var AnimationClipCurveBinding = /*#__PURE__*/ function() {
@@ -26060,10 +26210,22 @@
26060
26210
  var curveType = this.curve.constructor;
26061
26211
  var owner = new AnimationCurveOwner(entity, this.type, this.property, curveType);
26062
26212
  curveType._initializeOwner(owner);
26213
+ owner.saveDefaultValue();
26063
26214
  return owner;
26064
26215
  };
26065
26216
  /**
26066
26217
  * @internal
26218
+ */ _proto._createCurveLayerOwner = function _createCurveLayerOwner(owner) {
26219
+ var curveType = this.curve.constructor;
26220
+ var layerOwner = new AnimationCurveLayerOwner();
26221
+ curveType._initializeLayerOwner(layerOwner);
26222
+ layerOwner.curveOwner = owner;
26223
+ // If curve.keys.length is 0, updateFinishedState will assign 0 to the target, causing an error, so initialize by assigning defaultValue to finalValue.
26224
+ layerOwner.initFinalValue();
26225
+ return layerOwner;
26226
+ };
26227
+ /**
26228
+ * @internal
26067
26229
  */ _proto._getTempCurveOwner = function _getTempCurveOwner(entity) {
26068
26230
  var instanceId = entity.instanceId;
26069
26231
  if (!this._tempCurveOwner[instanceId]) {
@@ -26140,7 +26302,8 @@
26140
26302
  var targetEntity = entity.findByPath(curveData.relativePath);
26141
26303
  if (targetEntity) {
26142
26304
  var curveOwner = curveData._getTempCurveOwner(targetEntity);
26143
- curveOwner.evaluateAndApplyValue(curveData.curve, time, 1, false);
26305
+ var value = curveOwner.evaluateValue(curveData.curve, time, false);
26306
+ curveOwner.applyValue(value, 1, false);
26144
26307
  }
26145
26308
  }
26146
26309
  };
@@ -26282,6 +26445,7 @@
26282
26445
  break;
26283
26446
  }
26284
26447
  }
26448
+ evaluateData.value = value;
26285
26449
  return value;
26286
26450
  };
26287
26451
  /**
@@ -26337,6 +26501,11 @@
26337
26501
  };
26338
26502
  /**
26339
26503
  * @internal
26504
+ */ AnimationArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
26505
+ owner.finalValue = [];
26506
+ };
26507
+ /**
26508
+ * @internal
26340
26509
  */ AnimationArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
26341
26510
  for(var i = 0, n = out.length; i < n; ++i){
26342
26511
  var src = srcValue[i];
@@ -26426,6 +26595,11 @@
26426
26595
  };
26427
26596
  /**
26428
26597
  * @internal
26598
+ */ AnimationBoolCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
26599
+ owner.finalValue = false;
26600
+ };
26601
+ /**
26602
+ * @internal
26429
26603
  */ AnimationBoolCurve._lerpValue = function _lerpValue(srcValue, destValue) {
26430
26604
  return destValue;
26431
26605
  };
@@ -26482,6 +26656,11 @@
26482
26656
  };
26483
26657
  /**
26484
26658
  * @internal
26659
+ */ AnimationColorCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
26660
+ owner.finalValue = new Color$1();
26661
+ };
26662
+ /**
26663
+ * @internal
26485
26664
  */ AnimationColorCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
26486
26665
  Color$1.lerp(srcValue, destValue, weight, out);
26487
26666
  return out;
@@ -26588,6 +26767,12 @@
26588
26767
  };
26589
26768
  /**
26590
26769
  * @internal
26770
+ */ AnimationFloatArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
26771
+ var size = owner.curveOwner.referenceTargetValue.length;
26772
+ owner.finalValue = new Float32Array(size);
26773
+ };
26774
+ /**
26775
+ * @internal
26591
26776
  */ AnimationFloatArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
26592
26777
  for(var i = 0, n = out.length; i < n; ++i){
26593
26778
  var src = srcValue[i];
@@ -26677,6 +26862,11 @@
26677
26862
  };
26678
26863
  /**
26679
26864
  * @internal
26865
+ */ AnimationFloatCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
26866
+ owner.finalValue = 0;
26867
+ };
26868
+ /**
26869
+ * @internal
26680
26870
  */ AnimationFloatCurve._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
26681
26871
  return srcValue + (destValue - srcValue) * crossWeight;
26682
26872
  };
@@ -26745,6 +26935,11 @@
26745
26935
  };
26746
26936
  /**
26747
26937
  * @internal
26938
+ */ AnimationQuaternionCurve1._initializeLayerOwner = function _initializeLayerOwner(owner) {
26939
+ owner.finalValue = new Quaternion();
26940
+ };
26941
+ /**
26942
+ * @internal
26748
26943
  */ AnimationQuaternionCurve1._lerpValue = function _lerpValue(src, dest, weight, out) {
26749
26944
  Quaternion.slerp(src, dest, weight, out);
26750
26945
  return out;
@@ -26848,6 +27043,11 @@
26848
27043
  };
26849
27044
  /**
26850
27045
  * @internal
27046
+ */ AnimationVector2Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
27047
+ owner.finalValue = new Vector2();
27048
+ };
27049
+ /**
27050
+ * @internal
26851
27051
  */ AnimationVector2Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
26852
27052
  Vector2.lerp(srcValue, destValue, weight, out);
26853
27053
  return out;
@@ -26932,6 +27132,11 @@
26932
27132
  };
26933
27133
  /**
26934
27134
  * @internal
27135
+ */ AnimationVector3Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
27136
+ owner.finalValue = new Vector3();
27137
+ };
27138
+ /**
27139
+ * @internal
26935
27140
  */ AnimationVector3Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
26936
27141
  Vector3.lerp(srcValue, destValue, weight, out);
26937
27142
  return out;
@@ -27028,6 +27233,11 @@
27028
27233
  };
27029
27234
  /**
27030
27235
  * @internal
27236
+ */ AnimationVector4Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
27237
+ owner.finalValue = new Vector4();
27238
+ };
27239
+ /**
27240
+ * @internal
27031
27241
  */ AnimationVector4Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
27032
27242
  Vector4.lerp(srcValue, destValue, weight, out);
27033
27243
  return out;
@@ -27133,12 +27343,20 @@
27133
27343
  LayerState[LayerState[/** Playing state. */ "Playing"] = 1] = "Playing";
27134
27344
  LayerState[LayerState[/** CrossFading state. */ "CrossFading"] = 2] = "CrossFading";
27135
27345
  LayerState[LayerState[/** FixedCrossFading state. */ "FixedCrossFading"] = 3] = "FixedCrossFading";
27346
+ LayerState[LayerState[/** Finished state. */ "Finished"] = 4] = "Finished";
27136
27347
  })(LayerState || (LayerState = {}));
27137
27348
  /**
27138
27349
  * @internal
27139
- */ var AnimationEventHandler = function AnimationEventHandler() {
27140
- this.handlers = [];
27141
- };
27350
+ */ var AnimationEventHandler = /*#__PURE__*/ function() {
27351
+ var AnimationEventHandler = function AnimationEventHandler() {
27352
+ this.handlers = [];
27353
+ };
27354
+ var _proto = AnimationEventHandler.prototype;
27355
+ _proto.dispose = function dispose() {
27356
+ this.handlers.length = 0;
27357
+ };
27358
+ return AnimationEventHandler;
27359
+ }();
27142
27360
  /**
27143
27361
  * Transitions define when and how the state machine switch from on state to another. AnimatorTransition always originate from a StateMachine or a StateMachine entry.
27144
27362
  */ var AnimatorStateTransition = function AnimatorStateTransition() {
@@ -27192,12 +27410,14 @@
27192
27410
  * @internal
27193
27411
  */ var AnimatorLayerData = /*#__PURE__*/ function() {
27194
27412
  var AnimatorLayerData = function AnimatorLayerData() {
27413
+ this.curveOwnerPool = Object.create(null);
27195
27414
  this.animatorStateDataMap = {};
27196
27415
  this.srcPlayData = new AnimatorStatePlayData();
27197
27416
  this.destPlayData = new AnimatorStatePlayData();
27198
27417
  this.layerState = LayerState.Standby;
27199
27418
  this.crossCurveMark = 0;
27200
27419
  this.manuallyTransition = new AnimatorStateTransition();
27420
+ this.crossLayerOwnerCollection = [];
27201
27421
  };
27202
27422
  var _proto = AnimatorLayerData.prototype;
27203
27423
  _proto.switchPlayData = function switchPlayData() {
@@ -27211,7 +27431,7 @@
27211
27431
  /**
27212
27432
  * @internal
27213
27433
  */ var AnimatorStateData = function AnimatorStateData() {
27214
- this.curveOwners = [];
27434
+ this.curveLayerOwner = [];
27215
27435
  this.eventHandlers = [];
27216
27436
  };
27217
27437
  /**
@@ -27223,8 +27443,8 @@
27223
27443
  /** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
27224
27444
  /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
27225
27445
  _this._animatorLayersData = [];
27226
- _this._crossOwnerCollection = [];
27227
- _this._animationCurveOwners = [];
27446
+ _this._curveOwnerPool = Object.create(null);
27447
+ _this._needRevertCurveOwners = [];
27228
27448
  _this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
27229
27449
  _this._tempAnimatorStateInfo = {
27230
27450
  layerIndex: -1,
@@ -27248,7 +27468,7 @@
27248
27468
  this._reset();
27249
27469
  }
27250
27470
  var stateInfo = this._getAnimatorStateInfo(stateName, layerIndex);
27251
- var state = stateInfo.state;
27471
+ var state = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
27252
27472
  if (!state) {
27253
27473
  return;
27254
27474
  }
@@ -27257,9 +27477,8 @@
27257
27477
  return;
27258
27478
  }
27259
27479
  var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
27260
- //TODO CM: Not consider same stateName, but different animation
27261
- var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData);
27262
- this._preparePlay(animatorLayerData, state, animatorStateData);
27480
+ var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData, playLayerIndex);
27481
+ this._preparePlay(animatorLayerData, state);
27263
27482
  animatorLayerData.layerState = LayerState.Playing;
27264
27483
  animatorLayerData.srcPlayData.reset(state, animatorStateData, state._getDuration() * normalizedTimeOffset);
27265
27484
  };
@@ -27310,6 +27529,7 @@
27310
27529
  return;
27311
27530
  }
27312
27531
  deltaTime *= this.speed;
27532
+ this._revertCurveOwners();
27313
27533
  for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
27314
27534
  var animatorLayerData = this._getAnimatorLayerData(i1);
27315
27535
  if (animatorLayerData.layerState === LayerState.Standby) {
@@ -27350,17 +27570,17 @@
27350
27570
  /**
27351
27571
  * @internal
27352
27572
  */ _proto._reset = function _reset() {
27353
- var _this = this, animationCurveOwners = _this._animationCurveOwners;
27573
+ var _this = this, animationCurveOwners = _this._curveOwnerPool;
27354
27574
  for(var instanceId in animationCurveOwners){
27355
27575
  var propertyOwners = animationCurveOwners[instanceId];
27356
27576
  for(var property in propertyOwners){
27357
27577
  var owner = propertyOwners[property];
27358
- owner.hasSavedDefaultValue && owner.revertDefaultValue();
27578
+ owner.revertDefaultValue();
27359
27579
  }
27360
27580
  }
27361
27581
  this._animatorLayersData.length = 0;
27362
- this._crossOwnerCollection.length = 0;
27363
- this._animationCurveOwners.length = 0;
27582
+ this._needRevertCurveOwners.length = 0;
27583
+ this._curveOwnerPool = {};
27364
27584
  this._animationEventHandlerPool.resetPool();
27365
27585
  if (this._controllerUpdateFlag) {
27366
27586
  this._controllerUpdateFlag.flag = false;
@@ -27387,38 +27607,51 @@
27387
27607
  stateInfo.state = state;
27388
27608
  return stateInfo;
27389
27609
  };
27390
- _proto._saveDefaultValues = function _saveDefaultValues(stateData) {
27391
- var curveOwners = stateData.curveOwners;
27392
- for(var i = curveOwners.length - 1; i >= 0; i--){
27393
- var _curveOwners_i;
27394
- (_curveOwners_i = curveOwners[i]) == null ? void 0 : _curveOwners_i.saveDefaultValue();
27395
- }
27396
- };
27397
- _proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData) {
27610
+ _proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData, layerIndex) {
27398
27611
  var animatorStateDataMap = animatorLayerData.animatorStateDataMap;
27399
27612
  var animatorStateData = animatorStateDataMap[stateName];
27400
27613
  if (!animatorStateData) {
27401
27614
  animatorStateData = new AnimatorStateData();
27402
27615
  animatorStateDataMap[stateName] = animatorStateData;
27403
- this._saveAnimatorStateData(animatorState, animatorStateData);
27616
+ this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex);
27404
27617
  this._saveAnimatorEventHandlers(animatorState, animatorStateData);
27405
27618
  }
27406
27619
  return animatorStateData;
27407
27620
  };
27408
- _proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData) {
27409
- var _this = this, entity = _this.entity, animationCureOwners = _this._animationCurveOwners;
27410
- var curveOwners = animatorStateData.curveOwners;
27621
+ _proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex) {
27622
+ var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
27623
+ var curveLayerOwner = animatorStateData.curveLayerOwner;
27624
+ var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
27411
27625
  var _animatorState_clip = animatorState.clip, curves = _animatorState_clip._curveBindings;
27412
27626
  for(var i = curves.length - 1; i >= 0; i--){
27413
27627
  var curve = curves[i];
27414
27628
  var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
27415
27629
  if (targetEntity) {
27630
+ var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
27416
27631
  var property = curve.property;
27417
27632
  var instanceId = targetEntity.instanceId;
27418
- var propertyOwners = animationCureOwners[instanceId] || (animationCureOwners[instanceId] = {});
27419
- curveOwners[i] = propertyOwners[property] || (propertyOwners[property] = curve._createCurveOwner(targetEntity));
27633
+ var needRevert = false;
27634
+ var baseAnimatorLayerData = this._animatorLayersData[0];
27635
+ var baseLayerCurveOwnerPool = baseAnimatorLayerData.curveOwnerPool;
27636
+ if (this.animatorController.layers[layerIndex].blendingMode === exports.AnimatorLayerBlendingMode.Additive && layerIndex > 0 && !(baseLayerCurveOwnerPool[instanceId] && baseLayerCurveOwnerPool[instanceId][property])) {
27637
+ needRevert = true;
27638
+ }
27639
+ // Get owner
27640
+ var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
27641
+ var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity));
27642
+ //@todo: There is performance waste here, which will be handled together with organizing AnimatorStateData later. The logic is changing from runtime to initialization.
27643
+ if (needRevert) {
27644
+ this._needRevertCurveOwners.push(owner);
27645
+ } else {
27646
+ var index = this._needRevertCurveOwners.indexOf(owner);
27647
+ index > -1 && this._needRevertCurveOwners.splice(index, 1);
27648
+ }
27649
+ // Get layer owner
27650
+ var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
27651
+ var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
27652
+ curveLayerOwner[i] = layerOwner;
27420
27653
  } else {
27421
- curveOwners[i] = null;
27654
+ curveLayerOwner[i] = null;
27422
27655
  console.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
27423
27656
  }
27424
27657
  }
@@ -27446,65 +27679,60 @@
27446
27679
  };
27447
27680
  _proto._clearCrossData = function _clearCrossData(animatorLayerData) {
27448
27681
  animatorLayerData.crossCurveMark++;
27449
- this._crossOwnerCollection.length = 0;
27682
+ animatorLayerData.crossLayerOwnerCollection.length = 0;
27450
27683
  };
27451
- _proto._addCrossCurveData = function _addCrossCurveData(crossCurveData, owner, curCurveIndex, nextCurveIndex) {
27452
- owner.crossSrcCurveIndex = curCurveIndex;
27453
- owner.crossDestCurveIndex = nextCurveIndex;
27454
- crossCurveData.push(owner);
27684
+ _proto._addCrossOwner = function _addCrossOwner(animatorLayerData, layerOwner, curCurveIndex, nextCurveIndex) {
27685
+ layerOwner.crossSrcCurveIndex = curCurveIndex;
27686
+ layerOwner.crossDestCurveIndex = nextCurveIndex;
27687
+ animatorLayerData.crossLayerOwnerCollection.push(layerOwner);
27455
27688
  };
27456
27689
  _proto._prepareCrossFading = function _prepareCrossFading(animatorLayerData) {
27457
- var crossCurveData = this._crossOwnerCollection;
27458
- var crossCurveMark = animatorLayerData.crossCurveMark;
27459
27690
  // Add src cross curve data.
27460
- this._prepareSrcCrossData(crossCurveData, animatorLayerData.srcPlayData, crossCurveMark, false);
27691
+ this._prepareSrcCrossData(animatorLayerData, false);
27461
27692
  // Add dest cross curve data.
27462
- this._prepareDestCrossData(crossCurveData, animatorLayerData.destPlayData, crossCurveMark, false);
27693
+ this._prepareDestCrossData(animatorLayerData, false);
27463
27694
  };
27464
27695
  _proto._prepareStandbyCrossFading = function _prepareStandbyCrossFading(animatorLayerData) {
27465
- var crossOwnerCollection = this._crossOwnerCollection;
27466
- var srcPlayData = animatorLayerData.srcPlayData, crossCurveMark = animatorLayerData.crossCurveMark;
27467
27696
  // Standby have two sub state, one is never play, one is finished, never play srcPlayData.state is null.
27468
- srcPlayData.state && this._prepareSrcCrossData(crossOwnerCollection, srcPlayData, crossCurveMark, true);
27697
+ animatorLayerData.srcPlayData.state && this._prepareSrcCrossData(animatorLayerData, true);
27469
27698
  // Add dest cross curve data.
27470
- this._prepareDestCrossData(crossOwnerCollection, animatorLayerData.destPlayData, crossCurveMark, true);
27699
+ this._prepareDestCrossData(animatorLayerData, true);
27471
27700
  };
27472
27701
  _proto._prepareFixedPoseCrossFading = function _prepareFixedPoseCrossFading(animatorLayerData) {
27473
- var crossOwnerCollection = this._crossOwnerCollection;
27702
+ var crossLayerOwnerCollection = animatorLayerData.crossLayerOwnerCollection;
27474
27703
  // Save current cross curve data owner fixed pose.
27475
- for(var i = crossOwnerCollection.length - 1; i >= 0; i--){
27476
- var item = crossOwnerCollection[i];
27477
- item.saveFixedPoseValue();
27704
+ for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
27705
+ var layerOwner = crossLayerOwnerCollection[i];
27706
+ if (!layerOwner) continue;
27707
+ layerOwner.curveOwner.saveFixedPoseValue();
27478
27708
  // Reset destCurveIndex When fixed pose crossFading again.
27479
- item.crossDestCurveIndex = -1;
27709
+ layerOwner.crossDestCurveIndex = -1;
27480
27710
  }
27481
27711
  // prepare dest AnimatorState cross data.
27482
- this._prepareDestCrossData(crossOwnerCollection, animatorLayerData.destPlayData, animatorLayerData.crossCurveMark, true);
27483
- };
27484
- _proto._prepareSrcCrossData = function _prepareSrcCrossData(crossCurveData, srcPlayData, crossCurveMark, saveFixed) {
27485
- var curveOwners = srcPlayData.stateData.curveOwners;
27486
- for(var i = curveOwners.length - 1; i >= 0; i--){
27487
- var owner = curveOwners[i];
27488
- if (!owner) continue;
27489
- owner.crossCurveMark = crossCurveMark;
27490
- owner.crossCurveDataIndex = crossCurveData.length;
27491
- saveFixed && owner.saveFixedPoseValue();
27492
- this._addCrossCurveData(crossCurveData, owner, i, -1);
27493
- }
27494
- };
27495
- _proto._prepareDestCrossData = function _prepareDestCrossData(crossCurveData, destPlayData, crossCurveMark, saveFixed) {
27496
- var curveOwners = destPlayData.stateData.curveOwners;
27497
- for(var i = curveOwners.length - 1; i >= 0; i--){
27498
- var owner = curveOwners[i];
27499
- if (!owner) continue;
27500
- if (owner.crossCurveMark === crossCurveMark) {
27501
- crossCurveData[owner.crossCurveDataIndex].crossDestCurveIndex = i;
27712
+ this._prepareDestCrossData(animatorLayerData, true);
27713
+ };
27714
+ _proto._prepareSrcCrossData = function _prepareSrcCrossData(animatorLayerData, saveFixed) {
27715
+ var curveLayerOwner = animatorLayerData.srcPlayData.stateData.curveLayerOwner;
27716
+ for(var i = curveLayerOwner.length - 1; i >= 0; i--){
27717
+ var layerOwner = curveLayerOwner[i];
27718
+ if (!layerOwner) continue;
27719
+ layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
27720
+ saveFixed && layerOwner.curveOwner.saveFixedPoseValue();
27721
+ this._addCrossOwner(animatorLayerData, layerOwner, i, -1);
27722
+ }
27723
+ };
27724
+ _proto._prepareDestCrossData = function _prepareDestCrossData(animatorLayerData, saveFixed) {
27725
+ var curveLayerOwner = animatorLayerData.destPlayData.stateData.curveLayerOwner;
27726
+ for(var i = curveLayerOwner.length - 1; i >= 0; i--){
27727
+ var layerOwner = curveLayerOwner[i];
27728
+ if (!layerOwner) continue;
27729
+ if (layerOwner.crossCurveMark === animatorLayerData.crossCurveMark) {
27730
+ layerOwner.crossDestCurveIndex = i;
27502
27731
  } else {
27503
- owner.saveDefaultValue();
27732
+ var owner = layerOwner.curveOwner;
27504
27733
  saveFixed && owner.saveFixedPoseValue();
27505
- owner.crossCurveMark = crossCurveMark;
27506
- owner.crossCurveDataIndex = crossCurveData.length;
27507
- this._addCrossCurveData(crossCurveData, owner, -1, i);
27734
+ layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
27735
+ this._addCrossOwner(animatorLayerData, layerOwner, -1, i);
27508
27736
  }
27509
27737
  }
27510
27738
  };
@@ -27519,7 +27747,7 @@
27519
27747
  var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData, crossFadeTransitionInfo = layerData.crossFadeTransition;
27520
27748
  var additive = blendingMode === exports.AnimatorLayerBlendingMode.Additive;
27521
27749
  firstLayer && (weight = 1.0);
27522
- //TODO: 任意情况都应该检查,后面要优化
27750
+ //@todo: All situations should be checked, optimizations will follow later.
27523
27751
  layerData.layerState !== LayerState.FixedCrossFading && this._checkTransition(srcPlayData, crossFadeTransitionInfo, layerIndex);
27524
27752
  switch(layerData.layerState){
27525
27753
  case LayerState.Playing:
@@ -27531,26 +27759,36 @@
27531
27759
  case LayerState.CrossFading:
27532
27760
  this._updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, deltaTime, additive, aniUpdate);
27533
27761
  break;
27762
+ case LayerState.Finished:
27763
+ this._updateFinishedState(srcPlayData, weight, additive, aniUpdate);
27764
+ break;
27534
27765
  }
27535
27766
  };
27536
27767
  _proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
27537
- var _playData_stateData = playData.stateData, curveOwners = _playData_stateData.curveOwners, eventHandlers = _playData_stateData.eventHandlers;
27768
+ var _playData_stateData = playData.stateData, curveLayerOwner = _playData_stateData.curveLayerOwner, eventHandlers = _playData_stateData.eventHandlers;
27538
27769
  var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
27539
27770
  var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
27540
27771
  playData.update(this.speed < 0);
27541
- if (!aniUpdate) {
27542
- return;
27543
- }
27544
27772
  var clipTime = playData.clipTime, playState = playData.playState;
27545
- eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
27546
- for(var i = curveBindings.length - 1; i >= 0; i--){
27547
- var owner = curveOwners[i];
27548
- owner == null ? void 0 : owner.evaluateAndApplyValue(curveBindings[i].curve, clipTime, weight, additive);
27773
+ var finished = playState === AnimatorStatePlayState.Finished;
27774
+ if (aniUpdate || finished) {
27775
+ for(var i = curveBindings.length - 1; i >= 0; i--){
27776
+ var layerOwner = curveLayerOwner[i];
27777
+ var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
27778
+ if (!owner) continue;
27779
+ var curve = curveBindings[i].curve;
27780
+ if (curve.keys.length) {
27781
+ var value = owner.evaluateValue(curve, clipTime, additive);
27782
+ aniUpdate && owner.applyValue(value, weight, additive);
27783
+ finished && layerOwner.saveFinalValue();
27784
+ }
27785
+ }
27549
27786
  }
27550
27787
  playData.frameTime += state.speed * delta;
27551
27788
  if (playState === AnimatorStatePlayState.Finished) {
27552
- layerData.layerState = LayerState.Standby;
27789
+ layerData.layerState = LayerState.Finished;
27553
27790
  }
27791
+ eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
27554
27792
  if (lastPlayState === AnimatorStatePlayState.UnStarted) {
27555
27793
  this._callAnimatorScriptOnEnter(state, layerIndex);
27556
27794
  }
@@ -27561,7 +27799,7 @@
27561
27799
  }
27562
27800
  };
27563
27801
  _proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
27564
- var _this = this, crossCurveDataCollection = _this._crossOwnerCollection;
27802
+ var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
27565
27803
  var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
27566
27804
  var srcState = srcPlayData.state, srcStateData = srcPlayData.stateData, lastSrcPlayState = srcPlayData.playState;
27567
27805
  var srcEventHandlers = srcStateData.eventHandlers;
@@ -27570,18 +27808,27 @@
27570
27808
  var _destState_clip = destState.clip, destCurves = _destState_clip._curveBindings;
27571
27809
  var lastSrcClipTime = srcPlayData.clipTime;
27572
27810
  var lastDestClipTime = destPlayData.clipTime;
27573
- var crossWeight = Math.abs(destPlayData.frameTime) / (destState._getDuration() * layerData.crossFadeTransition.duration);
27574
- crossWeight >= 1.0 && (crossWeight = 1.0);
27811
+ var duration = destState._getDuration() * layerData.crossFadeTransition.duration;
27812
+ var crossWeight = Math.abs(destPlayData.frameTime) / duration;
27813
+ (crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
27575
27814
  srcPlayData.update(this.speed < 0);
27576
27815
  destPlayData.update(this.speed < 0);
27577
- var srcPlayState = srcPlayData.playState;
27578
- var destPlayState = destPlayData.playState;
27579
- this._updateCrossFadeData(layerData, crossWeight, delta, false);
27580
- if (!aniUpdate) {
27581
- return;
27816
+ var srcClipTime = srcPlayData.clipTime, srcPlayState = srcPlayData.playState;
27817
+ var destClipTime = destPlayData.clipTime, destPlayState = destPlayData.playState;
27818
+ var finished = destPlayData.playState === AnimatorStatePlayState.Finished;
27819
+ if (aniUpdate || finished) {
27820
+ for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
27821
+ var layerOwner = crossLayerOwnerCollection[i];
27822
+ var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
27823
+ if (!owner) continue;
27824
+ var srcCurveIndex = layerOwner.crossSrcCurveIndex;
27825
+ var destCurveIndex = layerOwner.crossDestCurveIndex;
27826
+ var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
27827
+ aniUpdate && owner.applyValue(value, weight, additive);
27828
+ finished && layerOwner.saveFinalValue();
27829
+ }
27582
27830
  }
27583
- var srcClipTime = srcPlayData.clipTime;
27584
- var destClipTime = destPlayData.clipTime;
27831
+ this._updateCrossFadeData(layerData, crossWeight, delta, false);
27585
27832
  srcEventHandlers.length && this._fireAnimationEvents(srcPlayData, srcEventHandlers, lastSrcClipTime, srcClipTime);
27586
27833
  destEventHandlers.length && this._fireAnimationEvents(destPlayData, destEventHandlers, lastDestClipTime, destClipTime);
27587
27834
  if (lastSrcPlayState === AnimatorStatePlayState.UnStarted) {
@@ -27600,28 +27847,34 @@
27600
27847
  } else {
27601
27848
  this._callAnimatorScriptOnUpdate(destState, layerIndex);
27602
27849
  }
27603
- for(var i = crossCurveDataCollection.length - 1; i >= 0; i--){
27604
- var crossCurveData = crossCurveDataCollection[i];
27605
- var crossSrcCurveIndex = crossCurveData.crossSrcCurveIndex, crossDestCurveIndex = crossCurveData.crossDestCurveIndex;
27606
- crossCurveData.crossFadeAndApplyValue(crossSrcCurveIndex >= 0 ? srcCurves[crossSrcCurveIndex].curve : null, crossDestCurveIndex >= 0 ? destCurves[crossDestCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
27607
- }
27608
27850
  };
27609
- _proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, layerWeight, delta, additive, aniUpdate) {
27610
- var crossCurveDataCollection = this._crossOwnerCollection;
27851
+ _proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
27852
+ var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
27611
27853
  var state = destPlayData.state, stateData = destPlayData.stateData, lastPlayState = destPlayData.playState;
27612
27854
  var eventHandlers = stateData.eventHandlers;
27613
27855
  var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
27614
27856
  var lastDestClipTime = destPlayData.clipTime;
27615
- var crossWeight = Math.abs(destPlayData.frameTime) / (state._getDuration() * layerData.crossFadeTransition.duration);
27616
- crossWeight >= 1.0 && (crossWeight = 1.0);
27857
+ var duration = state._getDuration() * layerData.crossFadeTransition.duration;
27858
+ var crossWeight = Math.abs(destPlayData.frameTime) / duration;
27859
+ (crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
27617
27860
  destPlayData.update(this.speed < 0);
27618
27861
  var playState = destPlayData.playState;
27619
27862
  this._updateCrossFadeData(layerData, crossWeight, delta, true);
27620
- if (!aniUpdate) {
27621
- return;
27622
- }
27623
27863
  var destClipTime = destPlayData.clipTime;
27624
- //TODO: srcState 少了最新一段时间的判断
27864
+ var finished = playState === AnimatorStatePlayState.Finished;
27865
+ // When the animator is culled (aniUpdate=false), if the play state has finished, the final value needs to be calculated and saved to be applied directly.
27866
+ if (aniUpdate || finished) {
27867
+ for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
27868
+ var layerOwner = crossLayerOwnerCollection[i];
27869
+ var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
27870
+ if (!owner) continue;
27871
+ var curveIndex = layerOwner.crossDestCurveIndex;
27872
+ var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
27873
+ aniUpdate && owner.applyValue(value, weight, additive);
27874
+ finished && layerOwner.saveFinalValue();
27875
+ }
27876
+ }
27877
+ //@todo: srcState is missing the judgment of the most recent period."
27625
27878
  eventHandlers.length && this._fireAnimationEvents(destPlayData, eventHandlers, lastDestClipTime, destClipTime);
27626
27879
  if (lastPlayState === AnimatorStatePlayState.UnStarted) {
27627
27880
  this._callAnimatorScriptOnEnter(state, layerIndex);
@@ -27631,10 +27884,18 @@
27631
27884
  } else {
27632
27885
  this._callAnimatorScriptOnUpdate(state, layerIndex);
27633
27886
  }
27634
- for(var i = crossCurveDataCollection.length - 1; i >= 0; i--){
27635
- var crossCurveData = crossCurveDataCollection[i];
27636
- var crossDestCurveIndex = crossCurveData.crossDestCurveIndex;
27637
- crossCurveData.crossFadeFromPoseAndApplyValue(crossDestCurveIndex >= 0 ? curveBindings[crossDestCurveIndex].curve : null, destClipTime, crossWeight, layerWeight, additive);
27887
+ };
27888
+ _proto._updateFinishedState = function _updateFinishedState(playData, weight, additive, aniUpdate) {
27889
+ if (!aniUpdate) {
27890
+ return;
27891
+ }
27892
+ var curveLayerOwner = playData.stateData.curveLayerOwner;
27893
+ var _playData_state_clip = playData.state.clip, curveBindings = _playData_state_clip._curveBindings;
27894
+ for(var i = curveBindings.length - 1; i >= 0; i--){
27895
+ var layerOwner = curveLayerOwner[i];
27896
+ var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
27897
+ if (!owner) continue;
27898
+ owner.applyValue(layerOwner.finalValue, weight, additive);
27638
27899
  }
27639
27900
  };
27640
27901
  _proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
@@ -27642,7 +27903,7 @@
27642
27903
  destPlayData.frameTime += destPlayData.state.speed * delta;
27643
27904
  if (crossWeight === 1.0) {
27644
27905
  if (destPlayData.playState === AnimatorStatePlayState.Finished) {
27645
- layerData.layerState = LayerState.Standby;
27906
+ layerData.layerState = LayerState.Finished;
27646
27907
  } else {
27647
27908
  layerData.layerState = LayerState.Playing;
27648
27909
  }
@@ -27652,25 +27913,24 @@
27652
27913
  fixed || (layerData.srcPlayData.frameTime += layerData.srcPlayData.state.speed * delta);
27653
27914
  }
27654
27915
  };
27655
- _proto._preparePlay = function _preparePlay(layerData, playState, playStateData) {
27916
+ _proto._preparePlay = function _preparePlay(layerData, playState) {
27656
27917
  if (layerData.layerState === LayerState.Playing) {
27657
27918
  var srcPlayData = layerData.srcPlayData;
27658
27919
  if (srcPlayData.state !== playState) {
27659
- var curveOwners = srcPlayData.stateData.curveOwners;
27660
- for(var i = curveOwners.length - 1; i >= 0; i--){
27661
- var owner = curveOwners[i];
27662
- (owner == null ? void 0 : owner.hasSavedDefaultValue) && owner.revertDefaultValue();
27920
+ var curveLayerOwner = srcPlayData.stateData.curveLayerOwner;
27921
+ for(var i = curveLayerOwner.length - 1; i >= 0; i--){
27922
+ var _curveLayerOwner_i;
27923
+ var owner = (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner;
27924
+ owner.revertDefaultValue();
27663
27925
  }
27664
- this._saveDefaultValues(playStateData);
27665
27926
  }
27666
27927
  } else {
27667
- // layerState is CrossFading, FixedCrossFading, Standby
27668
- var crossCurveDataCollection = this._crossOwnerCollection;
27669
- for(var i1 = crossCurveDataCollection.length - 1; i1 >= 0; i1--){
27670
- var owner1 = crossCurveDataCollection[i1];
27671
- owner1.hasSavedDefaultValue && owner1.revertDefaultValue();
27928
+ // layerState is CrossFading, FixedCrossFading, Standby, Finished
27929
+ var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
27930
+ for(var i1 = crossLayerOwnerCollection.length - 1; i1 >= 0; i1--){
27931
+ var owner1 = crossLayerOwnerCollection[i1].curveOwner;
27932
+ owner1.revertDefaultValue();
27672
27933
  }
27673
- this._saveDefaultValues(playStateData);
27674
27934
  }
27675
27935
  };
27676
27936
  _proto._checkTransition = function _checkTransition(stateData, crossFadeTransition, layerIndex) {
@@ -27687,7 +27947,7 @@
27687
27947
  _proto._crossFadeByTransition = function _crossFadeByTransition(transition, layerIndex) {
27688
27948
  var name = transition.destinationState.name;
27689
27949
  var stateInfo = this._getAnimatorStateInfo(name, layerIndex);
27690
- var crossState = stateInfo.state;
27950
+ var crossState = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
27691
27951
  if (!crossState) {
27692
27952
  return;
27693
27953
  }
@@ -27695,21 +27955,21 @@
27695
27955
  console.warn("The state named " + name + " has no AnimationClip data.");
27696
27956
  return;
27697
27957
  }
27698
- var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
27958
+ var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
27699
27959
  var layerState = animatorLayerData.layerState;
27700
27960
  var destPlayData = animatorLayerData.destPlayData;
27701
- var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData);
27961
+ var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData, playLayerIndex);
27702
27962
  var duration = crossState._getDuration();
27703
27963
  var offset = duration * transition.offset;
27704
27964
  destPlayData.reset(crossState, animatorStateData, offset);
27705
27965
  switch(layerState){
27706
- // Maybe not play, maybe end.
27707
27966
  case LayerState.Standby:
27708
27967
  animatorLayerData.layerState = LayerState.FixedCrossFading;
27709
27968
  this._clearCrossData(animatorLayerData);
27710
27969
  this._prepareStandbyCrossFading(animatorLayerData);
27711
27970
  break;
27712
27971
  case LayerState.Playing:
27972
+ case LayerState.Finished:
27713
27973
  animatorLayerData.layerState = LayerState.CrossFading;
27714
27974
  this._clearCrossData(animatorLayerData);
27715
27975
  this._prepareCrossFading(animatorLayerData);
@@ -27806,6 +28066,12 @@
27806
28066
  }
27807
28067
  }
27808
28068
  };
28069
+ _proto._revertCurveOwners = function _revertCurveOwners() {
28070
+ var curveOwners = this._needRevertCurveOwners;
28071
+ for(var i = 0, n = curveOwners.length; i < n; ++i){
28072
+ curveOwners[i].revertDefaultValue();
28073
+ }
28074
+ };
27809
28075
  _create_class$3(Animator, [
27810
28076
  {
27811
28077
  key: "animatorController",
@@ -27837,10 +28103,10 @@
27837
28103
  ], Animator.prototype, "_animatorLayersData", void 0);
27838
28104
  __decorate$1([
27839
28105
  ignoreClone
27840
- ], Animator.prototype, "_crossOwnerCollection", void 0);
28106
+ ], Animator.prototype, "_curveOwnerPool", void 0);
27841
28107
  __decorate$1([
27842
28108
  ignoreClone
27843
- ], Animator.prototype, "_animationCurveOwners", void 0);
28109
+ ], Animator.prototype, "_needRevertCurveOwners", void 0);
27844
28110
  __decorate$1([
27845
28111
  ignoreClone
27846
28112
  ], Animator.prototype, "_animationEventHandlerPool", void 0);
@@ -33370,6 +33636,10 @@
33370
33636
  }
33371
33637
  glTFResource.sceneRoots = sceneRoots;
33372
33638
  glTFResource.defaultSceneRoot = sceneRoots[sceneID];
33639
+ // @ts-ignore
33640
+ glTFResource.defaultSceneRoot._hookResource = glTFResource;
33641
+ // @ts-ignore
33642
+ glTFResource._addRefCount(1);
33373
33643
  };
33374
33644
  return EntityParser;
33375
33645
  }(Parser);
@@ -34101,36 +34371,20 @@
34101
34371
  })();
34102
34372
  /**
34103
34373
  * Product after GLTF parser, usually, `defaultSceneRoot` is only needed to use.
34104
- */ var GLTFResource = /*#__PURE__*/ function(EngineObject) {
34374
+ */ var GLTFResource = /*#__PURE__*/ function(RefObject) {
34105
34375
  var GLTFResource = function GLTFResource(engine, url) {
34106
34376
  var _this;
34107
- _this = EngineObject.call(this, engine) || this;
34377
+ _this = RefObject.call(this, engine) || this;
34108
34378
  _this.url = url;
34109
34379
  return _this;
34110
34380
  };
34111
- _inherits(GLTFResource, EngineObject);
34381
+ _inherits(GLTFResource, RefObject);
34112
34382
  var _proto = GLTFResource.prototype;
34113
34383
  /**
34114
- * @override
34115
- */ _proto.destroy = function destroy() {
34116
- if (this._destroyed) {
34117
- return;
34118
- }
34119
- EngineObject.prototype.destroy.call(this);
34120
- this.defaultSceneRoot.destroy();
34121
- this.textures = null;
34122
- this.materials = null;
34123
- this.meshes = null;
34124
- this.skins = null;
34125
- this.animations = null;
34126
- this.entities = null;
34127
- this.cameras = null;
34128
- this.lights = null;
34129
- this.sceneRoots = null;
34130
- this.variants = null;
34131
- };
34384
+ * @internal
34385
+ */ _proto._onDestroy = function _onDestroy() {};
34132
34386
  return GLTFResource;
34133
- }(EngineObject);
34387
+ }(RefObject);
34134
34388
  var GLTFLoader = /*#__PURE__*/ function(Loader) {
34135
34389
  var GLTFLoader = function GLTFLoader() {
34136
34390
  return Loader.apply(this, arguments);
@@ -36139,7 +36393,7 @@
36139
36393
  }));
36140
36394
 
36141
36395
  //@ts-ignore
36142
- var version = "0.9.12";
36396
+ var version = "0.9.14";
36143
36397
  console.log("Galacean engine version: " + version);
36144
36398
  for(var key in CoreObjects){
36145
36399
  Loader.registerClass(key, CoreObjects[key]);