@galacean/engine-core 1.0.0-beta.12 → 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/main.js +288 -170
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +288 -170
- package/dist/module.js +288 -170
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Engine.d.ts +2 -0
- package/types/RenderPipeline/MeshRenderElement.d.ts +3 -1
- package/types/RenderPipeline/SpriteElement.d.ts +3 -1
- package/types/RenderPipeline/SpriteMaskElement.d.ts +3 -1
- package/types/RenderPipeline/TextRenderElement.d.ts +3 -1
- package/types/animation/Animator.d.ts +3 -1
- package/types/animation/enums/LayerState.d.ts +3 -1
- package/types/animation/internal/AnimationCurveOwnerLayerData.d.ts +0 -1
- package/types/utils/BoolUpdateFlag.d.ts +0 -12
- package/types/utils/DisorderedArray.d.ts +0 -18
- package/types/utils/UpdateFlag.d.ts +0 -20
- package/types/utils/UpdateFlagManager.d.ts +0 -1
- package/types/utils/Utils.d.ts +0 -31
package/dist/module.js
CHANGED
|
@@ -2302,29 +2302,7 @@ var /** @internal */ PromiseState;
|
|
|
2302
2302
|
* @remarks The release principle is that it is not referenced by the components, including direct and indirect reference.
|
|
2303
2303
|
*/ _proto.gc = function gc() {
|
|
2304
2304
|
this._gc(false);
|
|
2305
|
-
|
|
2306
|
-
engine._renderElementPool.garbageCollection();
|
|
2307
|
-
engine._meshRenderDataPool.garbageCollection();
|
|
2308
|
-
engine._spriteRenderDataPool.garbageCollection();
|
|
2309
|
-
engine._spriteMaskRenderDataPool.garbageCollection();
|
|
2310
|
-
engine._textRenderDataPool.garbageCollection();
|
|
2311
|
-
var _componentsManager = engine._componentsManager, _lightManager = engine._lightManager;
|
|
2312
|
-
_componentsManager._renderers.garbageCollection();
|
|
2313
|
-
// @ts-ignore
|
|
2314
|
-
_componentsManager._onStartScripts.garbageCollection();
|
|
2315
|
-
// @ts-ignore
|
|
2316
|
-
_componentsManager._onUpdateScripts.garbageCollection();
|
|
2317
|
-
// @ts-ignore
|
|
2318
|
-
_componentsManager._onLateUpdateScripts.garbageCollection();
|
|
2319
|
-
// @ts-ignore
|
|
2320
|
-
_componentsManager._onPhysicsUpdateScripts.garbageCollection();
|
|
2321
|
-
// @ts-ignore
|
|
2322
|
-
_componentsManager._onUpdateAnimations.garbageCollection();
|
|
2323
|
-
// @ts-ignore
|
|
2324
|
-
_componentsManager._onUpdateRenderers.garbageCollection();
|
|
2325
|
-
_lightManager._spotLights.garbageCollection();
|
|
2326
|
-
_lightManager._pointLights.garbageCollection();
|
|
2327
|
-
_lightManager._directLights.garbageCollection();
|
|
2305
|
+
this.engine._pendingGC();
|
|
2328
2306
|
};
|
|
2329
2307
|
/**
|
|
2330
2308
|
* Add content restorer.
|
|
@@ -3250,6 +3228,17 @@ var GLCapabilityType;
|
|
|
3250
3228
|
componentContainer.length = 0;
|
|
3251
3229
|
this._componentsContainerPool.push(componentContainer);
|
|
3252
3230
|
};
|
|
3231
|
+
/**
|
|
3232
|
+
* @internal
|
|
3233
|
+
*/ _proto._gc = function _gc() {
|
|
3234
|
+
this._renderers.garbageCollection();
|
|
3235
|
+
this._onStartScripts.garbageCollection();
|
|
3236
|
+
this._onUpdateScripts.garbageCollection();
|
|
3237
|
+
this._onLateUpdateScripts.garbageCollection();
|
|
3238
|
+
this._onPhysicsUpdateScripts.garbageCollection();
|
|
3239
|
+
this._onUpdateAnimations.garbageCollection();
|
|
3240
|
+
this._onUpdateRenderers.garbageCollection();
|
|
3241
|
+
};
|
|
3253
3242
|
return ComponentsManager;
|
|
3254
3243
|
}();
|
|
3255
3244
|
|
|
@@ -5881,6 +5870,11 @@ var Collision = function Collision() {
|
|
|
5881
5870
|
elements[i]._onLateUpdate();
|
|
5882
5871
|
}
|
|
5883
5872
|
};
|
|
5873
|
+
/**
|
|
5874
|
+
* @internal
|
|
5875
|
+
*/ _proto._gc = function _gc() {
|
|
5876
|
+
this._colliders.garbageCollection();
|
|
5877
|
+
};
|
|
5884
5878
|
_proto._setGravity = function _setGravity() {
|
|
5885
5879
|
this._nativePhysicsManager.setGravity(this._gravity);
|
|
5886
5880
|
};
|
|
@@ -8458,6 +8452,13 @@ __decorate([
|
|
|
8458
8452
|
shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
|
|
8459
8453
|
}
|
|
8460
8454
|
};
|
|
8455
|
+
/**
|
|
8456
|
+
* @internal
|
|
8457
|
+
*/ _proto._gc = function _gc() {
|
|
8458
|
+
this._spotLights.garbageCollection();
|
|
8459
|
+
this._pointLights.garbageCollection();
|
|
8460
|
+
this._directLights.garbageCollection();
|
|
8461
|
+
};
|
|
8461
8462
|
return LightManager;
|
|
8462
8463
|
}();
|
|
8463
8464
|
|
|
@@ -16907,6 +16908,7 @@ ShaderPool.init();
|
|
|
16907
16908
|
_this._frameInProcess = false;
|
|
16908
16909
|
_this._waitingDestroy = false;
|
|
16909
16910
|
_this._isDeviceLost = false;
|
|
16911
|
+
_this._waitingGC = false;
|
|
16910
16912
|
_this._animate = function() {
|
|
16911
16913
|
if (_this._vSyncCount) {
|
|
16912
16914
|
_this._requestId = requestAnimationFrame(_this._animate);
|
|
@@ -17010,6 +17012,10 @@ ShaderPool.init();
|
|
|
17010
17012
|
if (this._waitingDestroy) {
|
|
17011
17013
|
this._destroy();
|
|
17012
17014
|
}
|
|
17015
|
+
if (this._waitingGC) {
|
|
17016
|
+
this._gc();
|
|
17017
|
+
this._waitingGC = false;
|
|
17018
|
+
}
|
|
17013
17019
|
this._frameInProcess = false;
|
|
17014
17020
|
};
|
|
17015
17021
|
/**
|
|
@@ -17168,6 +17174,15 @@ ShaderPool.init();
|
|
|
17168
17174
|
};
|
|
17169
17175
|
/**
|
|
17170
17176
|
* @internal
|
|
17177
|
+
*/ _proto._pendingGC = function _pendingGC() {
|
|
17178
|
+
if (this._frameInProcess) {
|
|
17179
|
+
this._waitingGC = true;
|
|
17180
|
+
} else {
|
|
17181
|
+
this._gc();
|
|
17182
|
+
}
|
|
17183
|
+
};
|
|
17184
|
+
/**
|
|
17185
|
+
* @internal
|
|
17171
17186
|
*/ _proto._initialize = function _initialize(configuration) {
|
|
17172
17187
|
var _this = this;
|
|
17173
17188
|
var physics = configuration.physics;
|
|
@@ -17230,6 +17245,16 @@ ShaderPool.init();
|
|
|
17230
17245
|
console.error(error);
|
|
17231
17246
|
});
|
|
17232
17247
|
};
|
|
17248
|
+
_proto._gc = function _gc() {
|
|
17249
|
+
this._renderElementPool.garbageCollection();
|
|
17250
|
+
this._meshRenderDataPool.garbageCollection();
|
|
17251
|
+
this._spriteRenderDataPool.garbageCollection();
|
|
17252
|
+
this._spriteMaskRenderDataPool.garbageCollection();
|
|
17253
|
+
this._textRenderDataPool.garbageCollection();
|
|
17254
|
+
this._componentsManager._gc();
|
|
17255
|
+
this._lightManager._gc();
|
|
17256
|
+
this.physicsManager._gc();
|
|
17257
|
+
};
|
|
17233
17258
|
_create_class(Engine, [
|
|
17234
17259
|
{
|
|
17235
17260
|
key: "settings",
|
|
@@ -22645,7 +22670,6 @@ var DirtyFlag;
|
|
|
22645
22670
|
* @internal
|
|
22646
22671
|
*/ var AnimationCurveOwner = /*#__PURE__*/ function() {
|
|
22647
22672
|
function AnimationCurveOwner(target, type, property, cureType) {
|
|
22648
|
-
this.hasSavedDefaultValue = false;
|
|
22649
22673
|
this.baseEvaluateData = {
|
|
22650
22674
|
curKeyframeIndex: 0,
|
|
22651
22675
|
value: null
|
|
@@ -22654,11 +22678,12 @@ var DirtyFlag;
|
|
|
22654
22678
|
curKeyframeIndex: 0,
|
|
22655
22679
|
value: null
|
|
22656
22680
|
};
|
|
22681
|
+
this.updateMark = 0;
|
|
22657
22682
|
this.target = target;
|
|
22658
22683
|
this.type = type;
|
|
22659
22684
|
this.property = property;
|
|
22660
22685
|
this.component = target.getComponent(type);
|
|
22661
|
-
this.
|
|
22686
|
+
this.cureType = cureType;
|
|
22662
22687
|
var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
|
|
22663
22688
|
this._assembler = new assemblerType();
|
|
22664
22689
|
this._assembler.initialize(this);
|
|
@@ -22667,89 +22692,80 @@ var DirtyFlag;
|
|
|
22667
22692
|
}
|
|
22668
22693
|
}
|
|
22669
22694
|
var _proto = AnimationCurveOwner.prototype;
|
|
22670
|
-
_proto.
|
|
22671
|
-
|
|
22672
|
-
if (additive) {
|
|
22673
|
-
var value = curve._evaluateAdditive(time, this.baseEvaluateData);
|
|
22674
|
-
var cureType = this._cureType;
|
|
22675
|
-
if (cureType._isReferenceType) {
|
|
22676
|
-
cureType._additiveValue(value, layerWeight, this.referenceTargetValue);
|
|
22677
|
-
} else {
|
|
22678
|
-
var assembler = this._assembler;
|
|
22679
|
-
var originValue = assembler.getTargetValue();
|
|
22680
|
-
var additiveValue = cureType._additiveValue(value, layerWeight, originValue);
|
|
22681
|
-
assembler.setTargetValue(additiveValue);
|
|
22682
|
-
}
|
|
22683
|
-
} else {
|
|
22684
|
-
var value1 = curve._evaluate(time, this.baseEvaluateData);
|
|
22685
|
-
this._applyValue(value1, layerWeight);
|
|
22686
|
-
}
|
|
22687
|
-
}
|
|
22695
|
+
_proto.evaluateValue = function evaluateValue(curve, time, additive) {
|
|
22696
|
+
return additive ? curve._evaluateAdditive(time, this.baseEvaluateData) : curve._evaluate(time, this.baseEvaluateData);
|
|
22688
22697
|
};
|
|
22689
|
-
_proto.
|
|
22690
|
-
var srcValue = srcCurve && srcCurve.keys.length ? additive ? srcCurve._evaluateAdditive(srcTime, this.baseEvaluateData) : srcCurve._evaluate(srcTime, this.baseEvaluateData) : additive ? this.
|
|
22691
|
-
var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.
|
|
22692
|
-
this.
|
|
22698
|
+
_proto.evaluateCrossFadeValue = function evaluateCrossFadeValue(srcCurve, destCurve, srcTime, destTime, crossWeight, additive) {
|
|
22699
|
+
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;
|
|
22700
|
+
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;
|
|
22701
|
+
return this._lerpValue(srcValue, destValue, crossWeight);
|
|
22693
22702
|
};
|
|
22694
|
-
_proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight,
|
|
22695
|
-
var srcValue = additive ? this.
|
|
22696
|
-
var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.
|
|
22697
|
-
this.
|
|
22703
|
+
_proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight, additive) {
|
|
22704
|
+
var srcValue = additive ? this.cureType._subtractValue(this.fixedPoseValue, this.defaultValue, this.baseEvaluateData.value) : this.fixedPoseValue;
|
|
22705
|
+
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;
|
|
22706
|
+
return this._lerpValue(srcValue, destValue, crossWeight);
|
|
22698
22707
|
};
|
|
22699
22708
|
_proto.revertDefaultValue = function revertDefaultValue() {
|
|
22700
22709
|
this._assembler.setTargetValue(this.defaultValue);
|
|
22701
22710
|
};
|
|
22711
|
+
_proto.getEvaluateValue = function getEvaluateValue(out) {
|
|
22712
|
+
if (this.cureType._isReferenceType) {
|
|
22713
|
+
this.cureType._copyValue(this.baseEvaluateData.value, out);
|
|
22714
|
+
return out;
|
|
22715
|
+
} else {
|
|
22716
|
+
return this.baseEvaluateData.value;
|
|
22717
|
+
}
|
|
22718
|
+
};
|
|
22702
22719
|
_proto.saveDefaultValue = function saveDefaultValue() {
|
|
22703
|
-
if (this.
|
|
22704
|
-
this.
|
|
22720
|
+
if (this.cureType._isReferenceType) {
|
|
22721
|
+
this.cureType._copyValue(this.referenceTargetValue, this.defaultValue);
|
|
22705
22722
|
} else {
|
|
22706
22723
|
this.defaultValue = this._assembler.getTargetValue();
|
|
22707
22724
|
}
|
|
22708
|
-
this.hasSavedDefaultValue = true;
|
|
22709
22725
|
};
|
|
22710
22726
|
_proto.saveFixedPoseValue = function saveFixedPoseValue() {
|
|
22711
|
-
if (this.
|
|
22712
|
-
this.
|
|
22727
|
+
if (this.cureType._isReferenceType) {
|
|
22728
|
+
this.cureType._copyValue(this.referenceTargetValue, this.fixedPoseValue);
|
|
22713
22729
|
} else {
|
|
22714
22730
|
this.fixedPoseValue = this._assembler.getTargetValue();
|
|
22715
22731
|
}
|
|
22716
22732
|
};
|
|
22717
|
-
_proto.
|
|
22718
|
-
|
|
22719
|
-
|
|
22720
|
-
|
|
22733
|
+
_proto.applyValue = function applyValue(value, weight, additive) {
|
|
22734
|
+
var cureType = this.cureType;
|
|
22735
|
+
if (additive) {
|
|
22736
|
+
if (cureType._isReferenceType) {
|
|
22737
|
+
cureType._additiveValue(value, weight, this.referenceTargetValue);
|
|
22721
22738
|
} else {
|
|
22722
|
-
this._assembler
|
|
22739
|
+
var assembler = this._assembler;
|
|
22740
|
+
var originValue = assembler.getTargetValue();
|
|
22741
|
+
var additiveValue = cureType._additiveValue(value, weight, originValue);
|
|
22742
|
+
assembler.setTargetValue(additiveValue);
|
|
22723
22743
|
}
|
|
22724
22744
|
} else {
|
|
22725
|
-
if (
|
|
22726
|
-
|
|
22727
|
-
|
|
22745
|
+
if (weight === 1.0) {
|
|
22746
|
+
if (cureType._isReferenceType) {
|
|
22747
|
+
cureType._copyValue(value, this.referenceTargetValue);
|
|
22748
|
+
} else {
|
|
22749
|
+
this._assembler.setTargetValue(value);
|
|
22750
|
+
}
|
|
22728
22751
|
} else {
|
|
22729
|
-
|
|
22730
|
-
|
|
22731
|
-
|
|
22752
|
+
if (cureType._isReferenceType) {
|
|
22753
|
+
var targetValue = this.referenceTargetValue;
|
|
22754
|
+
cureType._lerpValue(targetValue, value, weight, targetValue);
|
|
22755
|
+
} else {
|
|
22756
|
+
var originValue1 = this._assembler.getTargetValue();
|
|
22757
|
+
var lerpValue = cureType._lerpValue(originValue1, value, weight);
|
|
22758
|
+
this._assembler.setTargetValue(lerpValue);
|
|
22759
|
+
}
|
|
22732
22760
|
}
|
|
22733
22761
|
}
|
|
22734
22762
|
};
|
|
22735
|
-
_proto.
|
|
22736
|
-
|
|
22737
|
-
|
|
22738
|
-
out = this.baseEvaluateData.value;
|
|
22739
|
-
this._cureType._lerpValue(srcValue, destValue, crossWeight, out);
|
|
22740
|
-
} else {
|
|
22741
|
-
out = this._cureType._lerpValue(srcValue, destValue, crossWeight);
|
|
22742
|
-
}
|
|
22743
|
-
if (additive) {
|
|
22744
|
-
if (this._cureType._isReferenceType) {
|
|
22745
|
-
this._cureType._additiveValue(out, layerWeight, this.referenceTargetValue);
|
|
22746
|
-
} else {
|
|
22747
|
-
var originValue = this._assembler.getTargetValue();
|
|
22748
|
-
var lerpValue = this._cureType._additiveValue(out, layerWeight, originValue);
|
|
22749
|
-
this._assembler.setTargetValue(lerpValue);
|
|
22750
|
-
}
|
|
22763
|
+
_proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
22764
|
+
if (this.cureType._isReferenceType) {
|
|
22765
|
+
return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
|
|
22751
22766
|
} else {
|
|
22752
|
-
this.
|
|
22767
|
+
this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
|
|
22768
|
+
return this.baseEvaluateData.value;
|
|
22753
22769
|
}
|
|
22754
22770
|
};
|
|
22755
22771
|
AnimationCurveOwner.registerAssembler = function registerAssembler(componentType, property, assemblerType) {
|
|
@@ -22845,9 +22861,24 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22845
22861
|
|
|
22846
22862
|
/**
|
|
22847
22863
|
* @internal
|
|
22848
|
-
*/ var AnimationCurveLayerOwner = function
|
|
22849
|
-
|
|
22850
|
-
|
|
22864
|
+
*/ var AnimationCurveLayerOwner = /*#__PURE__*/ function() {
|
|
22865
|
+
function AnimationCurveLayerOwner() {
|
|
22866
|
+
this.crossCurveMark = 0;
|
|
22867
|
+
}
|
|
22868
|
+
var _proto = AnimationCurveLayerOwner.prototype;
|
|
22869
|
+
_proto.initFinalValue = function initFinalValue() {
|
|
22870
|
+
var _this_curveOwner = this.curveOwner, cureType = _this_curveOwner.cureType, defaultValue = _this_curveOwner.defaultValue;
|
|
22871
|
+
if (cureType._isReferenceType) {
|
|
22872
|
+
cureType._copyValue(defaultValue, this.finalValue);
|
|
22873
|
+
} else {
|
|
22874
|
+
this.finalValue = defaultValue;
|
|
22875
|
+
}
|
|
22876
|
+
};
|
|
22877
|
+
_proto.saveFinalValue = function saveFinalValue() {
|
|
22878
|
+
this.finalValue = this.curveOwner.getEvaluateValue(this.finalValue);
|
|
22879
|
+
};
|
|
22880
|
+
return AnimationCurveLayerOwner;
|
|
22881
|
+
}();
|
|
22851
22882
|
|
|
22852
22883
|
/**
|
|
22853
22884
|
* Associate AnimationCurve and the Entity
|
|
@@ -22862,13 +22893,18 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22862
22893
|
var curveType = this.curve.constructor;
|
|
22863
22894
|
var owner = new AnimationCurveOwner(entity, this.type, this.property, curveType);
|
|
22864
22895
|
curveType._initializeOwner(owner);
|
|
22896
|
+
owner.saveDefaultValue();
|
|
22865
22897
|
return owner;
|
|
22866
22898
|
};
|
|
22867
22899
|
/**
|
|
22868
22900
|
* @internal
|
|
22869
22901
|
*/ _proto._createCurveLayerOwner = function _createCurveLayerOwner(owner) {
|
|
22902
|
+
var curveType = this.curve.constructor;
|
|
22870
22903
|
var layerOwner = new AnimationCurveLayerOwner();
|
|
22871
22904
|
layerOwner.curveOwner = owner;
|
|
22905
|
+
curveType._initializeLayerOwner(layerOwner);
|
|
22906
|
+
// If curve.keys.length is 0, updateFinishedState will assign 0 to the target, causing an error, so initialize by assigning defaultValue to finalValue.
|
|
22907
|
+
layerOwner.initFinalValue();
|
|
22872
22908
|
return layerOwner;
|
|
22873
22909
|
};
|
|
22874
22910
|
/**
|
|
@@ -22956,7 +22992,8 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22956
22992
|
var targetEntity = entity.findByPath(curveData.relativePath);
|
|
22957
22993
|
if (targetEntity) {
|
|
22958
22994
|
var curveOwner = curveData._getTempCurveOwner(targetEntity);
|
|
22959
|
-
curveOwner.
|
|
22995
|
+
var value = curveOwner.evaluateValue(curveData.curve, time, false);
|
|
22996
|
+
curveOwner.applyValue(value, 1, false);
|
|
22960
22997
|
}
|
|
22961
22998
|
}
|
|
22962
22999
|
};
|
|
@@ -23100,6 +23137,7 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
23100
23137
|
break;
|
|
23101
23138
|
}
|
|
23102
23139
|
}
|
|
23140
|
+
evaluateData.value = value;
|
|
23103
23141
|
return value;
|
|
23104
23142
|
};
|
|
23105
23143
|
/**
|
|
@@ -23156,6 +23194,11 @@ var AnimationArrayCurve = (_AnimationArrayCurve = /*#__PURE__*/ function(Animati
|
|
|
23156
23194
|
};
|
|
23157
23195
|
/**
|
|
23158
23196
|
* @internal
|
|
23197
|
+
*/ AnimationArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23198
|
+
owner.finalValue = [];
|
|
23199
|
+
};
|
|
23200
|
+
/**
|
|
23201
|
+
* @internal
|
|
23159
23202
|
*/ AnimationArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23160
23203
|
for(var i = 0, n = out.length; i < n; ++i){
|
|
23161
23204
|
var src = srcValue[i];
|
|
@@ -23246,6 +23289,11 @@ var AnimationBoolCurve = (_AnimationBoolCurve = /*#__PURE__*/ function(Animation
|
|
|
23246
23289
|
};
|
|
23247
23290
|
/**
|
|
23248
23291
|
* @internal
|
|
23292
|
+
*/ AnimationBoolCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23293
|
+
owner.finalValue = false;
|
|
23294
|
+
};
|
|
23295
|
+
/**
|
|
23296
|
+
* @internal
|
|
23249
23297
|
*/ AnimationBoolCurve._lerpValue = function _lerpValue(srcValue, destValue) {
|
|
23250
23298
|
return destValue;
|
|
23251
23299
|
};
|
|
@@ -23303,6 +23351,11 @@ var AnimationColorCurve = (_AnimationColorCurve = /*#__PURE__*/ function(Animati
|
|
|
23303
23351
|
};
|
|
23304
23352
|
/**
|
|
23305
23353
|
* @internal
|
|
23354
|
+
*/ AnimationColorCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23355
|
+
owner.finalValue = new Color$1();
|
|
23356
|
+
};
|
|
23357
|
+
/**
|
|
23358
|
+
* @internal
|
|
23306
23359
|
*/ AnimationColorCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23307
23360
|
Color$1.lerp(srcValue, destValue, weight, out);
|
|
23308
23361
|
return out;
|
|
@@ -23409,6 +23462,12 @@ var AnimationFloatArrayCurve = (_AnimationFloatArrayCurve = /*#__PURE__*/ functi
|
|
|
23409
23462
|
};
|
|
23410
23463
|
/**
|
|
23411
23464
|
* @internal
|
|
23465
|
+
*/ AnimationFloatArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23466
|
+
var size = owner.curveOwner.referenceTargetValue.length;
|
|
23467
|
+
owner.finalValue = new Float32Array(size);
|
|
23468
|
+
};
|
|
23469
|
+
/**
|
|
23470
|
+
* @internal
|
|
23412
23471
|
*/ AnimationFloatArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23413
23472
|
for(var i = 0, n = out.length; i < n; ++i){
|
|
23414
23473
|
var src = srcValue[i];
|
|
@@ -23499,6 +23558,11 @@ var AnimationFloatCurve = (_AnimationFloatCurve = /*#__PURE__*/ function(Animati
|
|
|
23499
23558
|
};
|
|
23500
23559
|
/**
|
|
23501
23560
|
* @internal
|
|
23561
|
+
*/ AnimationFloatCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23562
|
+
owner.finalValue = 0;
|
|
23563
|
+
};
|
|
23564
|
+
/**
|
|
23565
|
+
* @internal
|
|
23502
23566
|
*/ AnimationFloatCurve._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
23503
23567
|
return srcValue + (destValue - srcValue) * crossWeight;
|
|
23504
23568
|
};
|
|
@@ -23568,6 +23632,11 @@ var AnimationQuaternionCurve = (_AnimationQuaternionCurve = /*#__PURE__*/ functi
|
|
|
23568
23632
|
};
|
|
23569
23633
|
/**
|
|
23570
23634
|
* @internal
|
|
23635
|
+
*/ AnimationQuaternionCurve1._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23636
|
+
owner.finalValue = new Quaternion();
|
|
23637
|
+
};
|
|
23638
|
+
/**
|
|
23639
|
+
* @internal
|
|
23571
23640
|
*/ AnimationQuaternionCurve1._lerpValue = function _lerpValue(src, dest, weight, out) {
|
|
23572
23641
|
Quaternion.slerp(src, dest, weight, out);
|
|
23573
23642
|
return out;
|
|
@@ -23672,6 +23741,11 @@ var AnimationVector2Curve = (_AnimationVector2Curve = /*#__PURE__*/ function(Ani
|
|
|
23672
23741
|
};
|
|
23673
23742
|
/**
|
|
23674
23743
|
* @internal
|
|
23744
|
+
*/ AnimationVector2Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23745
|
+
owner.finalValue = new Vector2();
|
|
23746
|
+
};
|
|
23747
|
+
/**
|
|
23748
|
+
* @internal
|
|
23675
23749
|
*/ AnimationVector2Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23676
23750
|
Vector2.lerp(srcValue, destValue, weight, out);
|
|
23677
23751
|
return out;
|
|
@@ -23757,6 +23831,11 @@ var AnimationVector3Curve = (_AnimationVector3Curve = /*#__PURE__*/ function(Ani
|
|
|
23757
23831
|
};
|
|
23758
23832
|
/**
|
|
23759
23833
|
* @internal
|
|
23834
|
+
*/ AnimationVector3Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23835
|
+
owner.finalValue = new Vector3();
|
|
23836
|
+
};
|
|
23837
|
+
/**
|
|
23838
|
+
* @internal
|
|
23760
23839
|
*/ AnimationVector3Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23761
23840
|
Vector3.lerp(srcValue, destValue, weight, out);
|
|
23762
23841
|
return out;
|
|
@@ -23854,6 +23933,11 @@ var AnimationVector4Curve = (_AnimationVector4Curve = /*#__PURE__*/ function(Ani
|
|
|
23854
23933
|
};
|
|
23855
23934
|
/**
|
|
23856
23935
|
* @internal
|
|
23936
|
+
*/ AnimationVector4Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23937
|
+
owner.finalValue = new Vector4();
|
|
23938
|
+
};
|
|
23939
|
+
/**
|
|
23940
|
+
* @internal
|
|
23857
23941
|
*/ AnimationVector4Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23858
23942
|
Vector4.lerp(srcValue, destValue, weight, out);
|
|
23859
23943
|
return out;
|
|
@@ -23963,6 +24047,7 @@ var AnimatorLayerBlendingMode;
|
|
|
23963
24047
|
LayerState[LayerState[/** Playing state. */ "Playing"] = 1] = "Playing";
|
|
23964
24048
|
LayerState[LayerState[/** CrossFading state. */ "CrossFading"] = 2] = "CrossFading";
|
|
23965
24049
|
LayerState[LayerState[/** FixedCrossFading state. */ "FixedCrossFading"] = 3] = "FixedCrossFading";
|
|
24050
|
+
LayerState[LayerState[/** Finished state. */ "Finished"] = 4] = "Finished";
|
|
23966
24051
|
})(LayerState || (LayerState = {}));
|
|
23967
24052
|
|
|
23968
24053
|
/**
|
|
@@ -24039,7 +24124,7 @@ var AnimatorLayerBlendingMode;
|
|
|
24039
24124
|
this.layerState = LayerState.Standby;
|
|
24040
24125
|
this.crossCurveMark = 0;
|
|
24041
24126
|
this.manuallyTransition = new AnimatorStateTransition();
|
|
24042
|
-
this.
|
|
24127
|
+
this.crossLayerOwnerCollection = [];
|
|
24043
24128
|
}
|
|
24044
24129
|
var _proto = AnimatorLayerData.prototype;
|
|
24045
24130
|
_proto.switchPlayData = function switchPlayData() {
|
|
@@ -24067,6 +24152,7 @@ var AnimatorLayerBlendingMode;
|
|
|
24067
24152
|
_this = Component.call(this, entity) || this;
|
|
24068
24153
|
/** Culling mode of this Animator. */ _this.cullingMode = AnimatorCullingMode.None;
|
|
24069
24154
|
/** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
|
|
24155
|
+
_this._updateMark = 0;
|
|
24070
24156
|
_this._animatorLayersData = [];
|
|
24071
24157
|
_this._curveOwnerPool = Object.create(null);
|
|
24072
24158
|
_this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
|
|
@@ -24091,17 +24177,17 @@ var AnimatorLayerBlendingMode;
|
|
|
24091
24177
|
this._reset();
|
|
24092
24178
|
}
|
|
24093
24179
|
var stateInfo = this._getAnimatorStateInfo(stateName, layerIndex);
|
|
24094
|
-
var state = stateInfo.state;
|
|
24180
|
+
var state = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
|
|
24095
24181
|
if (!state) {
|
|
24096
24182
|
return;
|
|
24097
24183
|
}
|
|
24098
24184
|
if (!state.clip) {
|
|
24099
|
-
|
|
24185
|
+
Logger.warn("The state named " + stateName + " has no AnimationClip data.");
|
|
24100
24186
|
return;
|
|
24101
24187
|
}
|
|
24102
|
-
var animatorLayerData = this._getAnimatorLayerData(
|
|
24103
|
-
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData);
|
|
24104
|
-
this._preparePlay(animatorLayerData, state
|
|
24188
|
+
var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
|
|
24189
|
+
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData, playLayerIndex);
|
|
24190
|
+
this._preparePlay(animatorLayerData, state);
|
|
24105
24191
|
animatorLayerData.layerState = LayerState.Playing;
|
|
24106
24192
|
animatorLayerData.srcPlayData.reset(state, animatorStateData, state._getDuration() * normalizedTimeOffset);
|
|
24107
24193
|
};
|
|
@@ -24118,8 +24204,8 @@ var AnimatorLayerBlendingMode;
|
|
|
24118
24204
|
if ((_this__controllerUpdateFlag = this._controllerUpdateFlag) == null ? void 0 : _this__controllerUpdateFlag.flag) {
|
|
24119
24205
|
this._reset();
|
|
24120
24206
|
}
|
|
24121
|
-
var
|
|
24122
|
-
var manuallyTransition = this._getAnimatorLayerData(
|
|
24207
|
+
var _this__getAnimatorStateInfo = this._getAnimatorStateInfo(stateName, layerIndex), state = _this__getAnimatorStateInfo.state, playLayerIndex = _this__getAnimatorStateInfo.layerIndex;
|
|
24208
|
+
var manuallyTransition = this._getAnimatorLayerData(playLayerIndex).manuallyTransition;
|
|
24123
24209
|
manuallyTransition.duration = normalizedTransitionDuration;
|
|
24124
24210
|
manuallyTransition.offset = normalizedTimeOffset;
|
|
24125
24211
|
manuallyTransition.destinationState = state;
|
|
@@ -24152,6 +24238,7 @@ var AnimatorLayerBlendingMode;
|
|
|
24152
24238
|
return;
|
|
24153
24239
|
}
|
|
24154
24240
|
deltaTime *= this.speed;
|
|
24241
|
+
this._updateMark++;
|
|
24155
24242
|
for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
|
|
24156
24243
|
var animatorLayerData = this._getAnimatorLayerData(i1);
|
|
24157
24244
|
if (animatorLayerData.layerState === LayerState.Standby) {
|
|
@@ -24195,7 +24282,7 @@ var AnimatorLayerBlendingMode;
|
|
|
24195
24282
|
var propertyOwners = animationCurveOwners[instanceId];
|
|
24196
24283
|
for(var property in propertyOwners){
|
|
24197
24284
|
var owner = propertyOwners[property];
|
|
24198
|
-
owner.
|
|
24285
|
+
owner.revertDefaultValue();
|
|
24199
24286
|
}
|
|
24200
24287
|
}
|
|
24201
24288
|
this._animatorLayersData.length = 0;
|
|
@@ -24226,29 +24313,22 @@ var AnimatorLayerBlendingMode;
|
|
|
24226
24313
|
stateInfo.state = state;
|
|
24227
24314
|
return stateInfo;
|
|
24228
24315
|
};
|
|
24229
|
-
_proto.
|
|
24230
|
-
var curveLayerOwner = stateData.curveLayerOwner;
|
|
24231
|
-
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24232
|
-
var _curveLayerOwner_i;
|
|
24233
|
-
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.saveDefaultValue();
|
|
24234
|
-
}
|
|
24235
|
-
};
|
|
24236
|
-
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData) {
|
|
24316
|
+
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData, layerIndex) {
|
|
24237
24317
|
var animatorStateDataMap = animatorLayerData.animatorStateDataMap;
|
|
24238
24318
|
var animatorStateData = animatorStateDataMap[stateName];
|
|
24239
24319
|
if (!animatorStateData) {
|
|
24240
24320
|
animatorStateData = new AnimatorStateData();
|
|
24241
24321
|
animatorStateDataMap[stateName] = animatorStateData;
|
|
24242
|
-
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData);
|
|
24322
|
+
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex);
|
|
24243
24323
|
this._saveAnimatorEventHandlers(animatorState, animatorStateData);
|
|
24244
24324
|
}
|
|
24245
24325
|
return animatorStateData;
|
|
24246
24326
|
};
|
|
24247
|
-
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData) {
|
|
24327
|
+
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex) {
|
|
24248
24328
|
var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
|
|
24249
24329
|
var curveLayerOwner = animatorStateData.curveLayerOwner;
|
|
24250
|
-
var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
|
|
24251
24330
|
var _animatorState_clip = animatorState.clip, curves = _animatorState_clip._curveBindings;
|
|
24331
|
+
var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
|
|
24252
24332
|
for(var i = curves.length - 1; i >= 0; i--){
|
|
24253
24333
|
var curve = curves[i];
|
|
24254
24334
|
var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
|
|
@@ -24265,7 +24345,7 @@ var AnimatorLayerBlendingMode;
|
|
|
24265
24345
|
curveLayerOwner[i] = layerOwner;
|
|
24266
24346
|
} else {
|
|
24267
24347
|
curveLayerOwner[i] = null;
|
|
24268
|
-
|
|
24348
|
+
Logger.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
|
|
24269
24349
|
}
|
|
24270
24350
|
}
|
|
24271
24351
|
};
|
|
@@ -24292,12 +24372,12 @@ var AnimatorLayerBlendingMode;
|
|
|
24292
24372
|
};
|
|
24293
24373
|
_proto._clearCrossData = function _clearCrossData(animatorLayerData) {
|
|
24294
24374
|
animatorLayerData.crossCurveMark++;
|
|
24295
|
-
animatorLayerData.
|
|
24375
|
+
animatorLayerData.crossLayerOwnerCollection.length = 0;
|
|
24296
24376
|
};
|
|
24297
24377
|
_proto._addCrossOwner = function _addCrossOwner(animatorLayerData, layerOwner, curCurveIndex, nextCurveIndex) {
|
|
24298
24378
|
layerOwner.crossSrcCurveIndex = curCurveIndex;
|
|
24299
24379
|
layerOwner.crossDestCurveIndex = nextCurveIndex;
|
|
24300
|
-
animatorLayerData.
|
|
24380
|
+
animatorLayerData.crossLayerOwnerCollection.push(layerOwner);
|
|
24301
24381
|
};
|
|
24302
24382
|
_proto._prepareCrossFading = function _prepareCrossFading(animatorLayerData) {
|
|
24303
24383
|
// Add src cross curve data.
|
|
@@ -24312,10 +24392,10 @@ var AnimatorLayerBlendingMode;
|
|
|
24312
24392
|
this._prepareDestCrossData(animatorLayerData, true);
|
|
24313
24393
|
};
|
|
24314
24394
|
_proto._prepareFixedPoseCrossFading = function _prepareFixedPoseCrossFading(animatorLayerData) {
|
|
24315
|
-
var
|
|
24395
|
+
var crossLayerOwnerCollection = animatorLayerData.crossLayerOwnerCollection;
|
|
24316
24396
|
// Save current cross curve data owner fixed pose.
|
|
24317
|
-
for(var i =
|
|
24318
|
-
var layerOwner =
|
|
24397
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
24398
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
24319
24399
|
if (!layerOwner) continue;
|
|
24320
24400
|
layerOwner.curveOwner.saveFixedPoseValue();
|
|
24321
24401
|
// Reset destCurveIndex When fixed pose crossFading again.
|
|
@@ -24343,7 +24423,6 @@ var AnimatorLayerBlendingMode;
|
|
|
24343
24423
|
layerOwner.crossDestCurveIndex = i;
|
|
24344
24424
|
} else {
|
|
24345
24425
|
var owner = layerOwner.curveOwner;
|
|
24346
|
-
owner.saveDefaultValue();
|
|
24347
24426
|
saveFixed && owner.saveFixedPoseValue();
|
|
24348
24427
|
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
24349
24428
|
this._addCrossOwner(animatorLayerData, layerOwner, -1, i);
|
|
@@ -24361,7 +24440,7 @@ var AnimatorLayerBlendingMode;
|
|
|
24361
24440
|
var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData, crossFadeTransitionInfo = layerData.crossFadeTransition;
|
|
24362
24441
|
var additive = blendingMode === AnimatorLayerBlendingMode.Additive;
|
|
24363
24442
|
firstLayer && (weight = 1.0);
|
|
24364
|
-
|
|
24443
|
+
//@todo: All situations should be checked, optimizations will follow later.
|
|
24365
24444
|
layerData.layerState !== LayerState.FixedCrossFading && this._checkTransition(srcPlayData, crossFadeTransitionInfo, layerIndex);
|
|
24366
24445
|
switch(layerData.layerState){
|
|
24367
24446
|
case LayerState.Playing:
|
|
@@ -24373,6 +24452,9 @@ var AnimatorLayerBlendingMode;
|
|
|
24373
24452
|
case LayerState.CrossFading:
|
|
24374
24453
|
this._updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, deltaTime, additive, aniUpdate);
|
|
24375
24454
|
break;
|
|
24455
|
+
case LayerState.Finished:
|
|
24456
|
+
this._updateFinishedState(srcPlayData, weight, additive, aniUpdate);
|
|
24457
|
+
break;
|
|
24376
24458
|
}
|
|
24377
24459
|
};
|
|
24378
24460
|
_proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
@@ -24380,19 +24462,27 @@ var AnimatorLayerBlendingMode;
|
|
|
24380
24462
|
var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
|
|
24381
24463
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
24382
24464
|
playData.update(this.speed < 0);
|
|
24383
|
-
if (!aniUpdate) {
|
|
24384
|
-
return;
|
|
24385
|
-
}
|
|
24386
24465
|
var clipTime = playData.clipTime, playState = playData.playState;
|
|
24387
|
-
|
|
24388
|
-
|
|
24389
|
-
var
|
|
24390
|
-
|
|
24466
|
+
var finished = playState === AnimatorStatePlayState.Finished;
|
|
24467
|
+
if (aniUpdate || finished) {
|
|
24468
|
+
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
24469
|
+
var layerOwner = curveLayerOwner[i];
|
|
24470
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
24471
|
+
if (!owner) continue;
|
|
24472
|
+
var curve = curveBindings[i].curve;
|
|
24473
|
+
if (curve.keys.length) {
|
|
24474
|
+
this._checkRevertOwner(owner, additive);
|
|
24475
|
+
var value = owner.evaluateValue(curve, clipTime, additive);
|
|
24476
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
24477
|
+
finished && layerOwner.saveFinalValue();
|
|
24478
|
+
}
|
|
24479
|
+
}
|
|
24391
24480
|
}
|
|
24392
24481
|
playData.frameTime += state.speed * delta;
|
|
24393
24482
|
if (playState === AnimatorStatePlayState.Finished) {
|
|
24394
|
-
layerData.layerState = LayerState.
|
|
24483
|
+
layerData.layerState = LayerState.Finished;
|
|
24395
24484
|
}
|
|
24485
|
+
eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
24396
24486
|
if (lastPlayState === AnimatorStatePlayState.UnStarted) {
|
|
24397
24487
|
this._callAnimatorScriptOnEnter(state, layerIndex);
|
|
24398
24488
|
}
|
|
@@ -24403,7 +24493,7 @@ var AnimatorLayerBlendingMode;
|
|
|
24403
24493
|
}
|
|
24404
24494
|
};
|
|
24405
24495
|
_proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
24406
|
-
var
|
|
24496
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
24407
24497
|
var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
|
|
24408
24498
|
var srcState = srcPlayData.state, srcStateData = srcPlayData.stateData, lastSrcPlayState = srcPlayData.playState;
|
|
24409
24499
|
var srcEventHandlers = srcStateData.eventHandlers;
|
|
@@ -24412,18 +24502,28 @@ var AnimatorLayerBlendingMode;
|
|
|
24412
24502
|
var _destState_clip = destState.clip, destCurves = _destState_clip._curveBindings;
|
|
24413
24503
|
var lastSrcClipTime = srcPlayData.clipTime;
|
|
24414
24504
|
var lastDestClipTime = destPlayData.clipTime;
|
|
24415
|
-
var
|
|
24416
|
-
crossWeight
|
|
24505
|
+
var duration = destState._getDuration() * layerData.crossFadeTransition.duration;
|
|
24506
|
+
var crossWeight = Math.abs(destPlayData.frameTime) / duration;
|
|
24507
|
+
(crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
|
|
24417
24508
|
srcPlayData.update(this.speed < 0);
|
|
24418
24509
|
destPlayData.update(this.speed < 0);
|
|
24419
|
-
var srcPlayState = srcPlayData.playState;
|
|
24420
|
-
var destPlayState = destPlayData.playState;
|
|
24421
|
-
|
|
24422
|
-
if (
|
|
24423
|
-
|
|
24510
|
+
var srcClipTime = srcPlayData.clipTime, srcPlayState = srcPlayData.playState;
|
|
24511
|
+
var destClipTime = destPlayData.clipTime, destPlayState = destPlayData.playState;
|
|
24512
|
+
var finished = destPlayData.playState === AnimatorStatePlayState.Finished;
|
|
24513
|
+
if (aniUpdate || finished) {
|
|
24514
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
24515
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
24516
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
24517
|
+
if (!owner) continue;
|
|
24518
|
+
var srcCurveIndex = layerOwner.crossSrcCurveIndex;
|
|
24519
|
+
var destCurveIndex = layerOwner.crossDestCurveIndex;
|
|
24520
|
+
this._checkRevertOwner(owner, additive);
|
|
24521
|
+
var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
|
|
24522
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
24523
|
+
finished && layerOwner.saveFinalValue();
|
|
24524
|
+
}
|
|
24424
24525
|
}
|
|
24425
|
-
|
|
24426
|
-
var destClipTime = destPlayData.clipTime;
|
|
24526
|
+
this._updateCrossFadeData(layerData, crossWeight, delta, false);
|
|
24427
24527
|
srcEventHandlers.length && this._fireAnimationEvents(srcPlayData, srcEventHandlers, lastSrcClipTime, srcClipTime);
|
|
24428
24528
|
destEventHandlers.length && this._fireAnimationEvents(destPlayData, destEventHandlers, lastDestClipTime, destClipTime);
|
|
24429
24529
|
if (lastSrcPlayState === AnimatorStatePlayState.UnStarted) {
|
|
@@ -24442,30 +24542,35 @@ var AnimatorLayerBlendingMode;
|
|
|
24442
24542
|
} else {
|
|
24443
24543
|
this._callAnimatorScriptOnUpdate(destState, layerIndex);
|
|
24444
24544
|
}
|
|
24445
|
-
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
24446
|
-
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
24447
|
-
if (!layerOwner) continue;
|
|
24448
|
-
var srcCurveIndex = layerOwner.crossSrcCurveIndex;
|
|
24449
|
-
var destCurveIndex = layerOwner.crossDestCurveIndex;
|
|
24450
|
-
layerOwner.curveOwner.crossFadeAndApplyValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
|
|
24451
|
-
}
|
|
24452
24545
|
};
|
|
24453
|
-
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex,
|
|
24454
|
-
var
|
|
24546
|
+
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
24547
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
24455
24548
|
var state = destPlayData.state, stateData = destPlayData.stateData, lastPlayState = destPlayData.playState;
|
|
24456
24549
|
var eventHandlers = stateData.eventHandlers;
|
|
24457
24550
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
24458
24551
|
var lastDestClipTime = destPlayData.clipTime;
|
|
24459
|
-
var
|
|
24460
|
-
crossWeight
|
|
24552
|
+
var duration = state._getDuration() * layerData.crossFadeTransition.duration;
|
|
24553
|
+
var crossWeight = Math.abs(destPlayData.frameTime) / duration;
|
|
24554
|
+
(crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
|
|
24461
24555
|
destPlayData.update(this.speed < 0);
|
|
24462
24556
|
var playState = destPlayData.playState;
|
|
24463
24557
|
this._updateCrossFadeData(layerData, crossWeight, delta, true);
|
|
24464
|
-
if (!aniUpdate) {
|
|
24465
|
-
return;
|
|
24466
|
-
}
|
|
24467
24558
|
var destClipTime = destPlayData.clipTime;
|
|
24468
|
-
|
|
24559
|
+
var finished = playState === AnimatorStatePlayState.Finished;
|
|
24560
|
+
// 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.
|
|
24561
|
+
if (aniUpdate || finished) {
|
|
24562
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
24563
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
24564
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
24565
|
+
if (!owner) continue;
|
|
24566
|
+
var curveIndex = layerOwner.crossDestCurveIndex;
|
|
24567
|
+
this._checkRevertOwner(owner, additive);
|
|
24568
|
+
var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
|
|
24569
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
24570
|
+
finished && layerOwner.saveFinalValue();
|
|
24571
|
+
}
|
|
24572
|
+
}
|
|
24573
|
+
//@todo: srcState is missing the judgment of the most recent period."
|
|
24469
24574
|
eventHandlers.length && this._fireAnimationEvents(destPlayData, eventHandlers, lastDestClipTime, destClipTime);
|
|
24470
24575
|
if (lastPlayState === AnimatorStatePlayState.UnStarted) {
|
|
24471
24576
|
this._callAnimatorScriptOnEnter(state, layerIndex);
|
|
@@ -24475,11 +24580,19 @@ var AnimatorLayerBlendingMode;
|
|
|
24475
24580
|
} else {
|
|
24476
24581
|
this._callAnimatorScriptOnUpdate(state, layerIndex);
|
|
24477
24582
|
}
|
|
24478
|
-
|
|
24479
|
-
|
|
24480
|
-
|
|
24481
|
-
|
|
24482
|
-
|
|
24583
|
+
};
|
|
24584
|
+
_proto._updateFinishedState = function _updateFinishedState(playData, weight, additive, aniUpdate) {
|
|
24585
|
+
if (!aniUpdate) {
|
|
24586
|
+
return;
|
|
24587
|
+
}
|
|
24588
|
+
var curveLayerOwner = playData.stateData.curveLayerOwner;
|
|
24589
|
+
var _playData_state_clip = playData.state.clip, curveBindings = _playData_state_clip._curveBindings;
|
|
24590
|
+
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
24591
|
+
var layerOwner = curveLayerOwner[i];
|
|
24592
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
24593
|
+
if (!owner) continue;
|
|
24594
|
+
this._checkRevertOwner(owner, additive);
|
|
24595
|
+
owner.applyValue(layerOwner.finalValue, weight, additive);
|
|
24483
24596
|
}
|
|
24484
24597
|
};
|
|
24485
24598
|
_proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
|
|
@@ -24487,7 +24600,7 @@ var AnimatorLayerBlendingMode;
|
|
|
24487
24600
|
destPlayData.frameTime += destPlayData.state.speed * delta;
|
|
24488
24601
|
if (crossWeight === 1.0) {
|
|
24489
24602
|
if (destPlayData.playState === AnimatorStatePlayState.Finished) {
|
|
24490
|
-
layerData.layerState = LayerState.
|
|
24603
|
+
layerData.layerState = LayerState.Finished;
|
|
24491
24604
|
} else {
|
|
24492
24605
|
layerData.layerState = LayerState.Playing;
|
|
24493
24606
|
}
|
|
@@ -24497,26 +24610,22 @@ var AnimatorLayerBlendingMode;
|
|
|
24497
24610
|
fixed || (layerData.srcPlayData.frameTime += layerData.srcPlayData.state.speed * delta);
|
|
24498
24611
|
}
|
|
24499
24612
|
};
|
|
24500
|
-
_proto._preparePlay = function _preparePlay(layerData, playState
|
|
24613
|
+
_proto._preparePlay = function _preparePlay(layerData, playState) {
|
|
24501
24614
|
if (layerData.layerState === LayerState.Playing) {
|
|
24502
24615
|
var srcPlayData = layerData.srcPlayData;
|
|
24503
24616
|
if (srcPlayData.state !== playState) {
|
|
24504
24617
|
var curveLayerOwner = srcPlayData.stateData.curveLayerOwner;
|
|
24505
24618
|
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24506
24619
|
var _curveLayerOwner_i;
|
|
24507
|
-
|
|
24508
|
-
(owner == null ? void 0 : owner.hasSavedDefaultValue) && owner.revertDefaultValue();
|
|
24620
|
+
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.revertDefaultValue();
|
|
24509
24621
|
}
|
|
24510
|
-
this._saveDefaultValues(playStateData);
|
|
24511
24622
|
}
|
|
24512
24623
|
} else {
|
|
24513
|
-
// layerState is CrossFading, FixedCrossFading, Standby
|
|
24514
|
-
var
|
|
24515
|
-
for(var i1 =
|
|
24516
|
-
|
|
24517
|
-
owner1.hasSavedDefaultValue && owner1.revertDefaultValue();
|
|
24624
|
+
// layerState is CrossFading, FixedCrossFading, Standby, Finished
|
|
24625
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
24626
|
+
for(var i1 = crossLayerOwnerCollection.length - 1; i1 >= 0; i1--){
|
|
24627
|
+
crossLayerOwnerCollection[i1].curveOwner.revertDefaultValue();
|
|
24518
24628
|
}
|
|
24519
|
-
this._saveDefaultValues(playStateData);
|
|
24520
24629
|
}
|
|
24521
24630
|
};
|
|
24522
24631
|
_proto._checkTransition = function _checkTransition(stateData, crossFadeTransition, layerIndex) {
|
|
@@ -24533,24 +24642,24 @@ var AnimatorLayerBlendingMode;
|
|
|
24533
24642
|
_proto._crossFadeByTransition = function _crossFadeByTransition(transition, layerIndex) {
|
|
24534
24643
|
var name = transition.destinationState.name;
|
|
24535
24644
|
var stateInfo = this._getAnimatorStateInfo(name, layerIndex);
|
|
24536
|
-
var crossState = stateInfo.state;
|
|
24645
|
+
var crossState = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
|
|
24537
24646
|
if (!crossState) {
|
|
24538
24647
|
return;
|
|
24539
24648
|
}
|
|
24540
24649
|
if (!crossState.clip) {
|
|
24541
|
-
|
|
24650
|
+
Logger.warn("The state named " + name + " has no AnimationClip data.");
|
|
24542
24651
|
return;
|
|
24543
24652
|
}
|
|
24544
|
-
var animatorLayerData = this._getAnimatorLayerData(
|
|
24653
|
+
var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
|
|
24545
24654
|
var layerState = animatorLayerData.layerState;
|
|
24546
24655
|
var destPlayData = animatorLayerData.destPlayData;
|
|
24547
|
-
var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData);
|
|
24656
|
+
var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData, playLayerIndex);
|
|
24548
24657
|
var duration = crossState._getDuration();
|
|
24549
24658
|
var offset = duration * transition.offset;
|
|
24550
24659
|
destPlayData.reset(crossState, animatorStateData, offset);
|
|
24551
24660
|
switch(layerState){
|
|
24552
|
-
// Maybe not play, maybe end.
|
|
24553
24661
|
case LayerState.Standby:
|
|
24662
|
+
case LayerState.Finished:
|
|
24554
24663
|
animatorLayerData.layerState = LayerState.FixedCrossFading;
|
|
24555
24664
|
this._clearCrossData(animatorLayerData);
|
|
24556
24665
|
this._prepareStandbyCrossFading(animatorLayerData);
|
|
@@ -24652,6 +24761,12 @@ var AnimatorLayerBlendingMode;
|
|
|
24652
24761
|
}
|
|
24653
24762
|
}
|
|
24654
24763
|
};
|
|
24764
|
+
_proto._checkRevertOwner = function _checkRevertOwner(owner, additive) {
|
|
24765
|
+
if (additive && owner.updateMark !== this._updateMark) {
|
|
24766
|
+
owner.revertDefaultValue();
|
|
24767
|
+
}
|
|
24768
|
+
owner.updateMark = this._updateMark;
|
|
24769
|
+
};
|
|
24655
24770
|
_create_class(Animator, [
|
|
24656
24771
|
{
|
|
24657
24772
|
key: "animatorController",
|
|
@@ -24678,6 +24793,9 @@ __decorate([
|
|
|
24678
24793
|
__decorate([
|
|
24679
24794
|
ignoreClone
|
|
24680
24795
|
], Animator.prototype, "_controllerUpdateFlag", void 0);
|
|
24796
|
+
__decorate([
|
|
24797
|
+
ignoreClone
|
|
24798
|
+
], Animator.prototype, "_updateMark", void 0);
|
|
24681
24799
|
__decorate([
|
|
24682
24800
|
ignoreClone
|
|
24683
24801
|
], Animator.prototype, "_animatorLayersData", void 0);
|