@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/main.js
CHANGED
|
@@ -2306,29 +2306,7 @@ var /** @internal */ PromiseState;
|
|
|
2306
2306
|
* @remarks The release principle is that it is not referenced by the components, including direct and indirect reference.
|
|
2307
2307
|
*/ _proto.gc = function gc() {
|
|
2308
2308
|
this._gc(false);
|
|
2309
|
-
|
|
2310
|
-
engine._renderElementPool.garbageCollection();
|
|
2311
|
-
engine._meshRenderDataPool.garbageCollection();
|
|
2312
|
-
engine._spriteRenderDataPool.garbageCollection();
|
|
2313
|
-
engine._spriteMaskRenderDataPool.garbageCollection();
|
|
2314
|
-
engine._textRenderDataPool.garbageCollection();
|
|
2315
|
-
var _componentsManager = engine._componentsManager, _lightManager = engine._lightManager;
|
|
2316
|
-
_componentsManager._renderers.garbageCollection();
|
|
2317
|
-
// @ts-ignore
|
|
2318
|
-
_componentsManager._onStartScripts.garbageCollection();
|
|
2319
|
-
// @ts-ignore
|
|
2320
|
-
_componentsManager._onUpdateScripts.garbageCollection();
|
|
2321
|
-
// @ts-ignore
|
|
2322
|
-
_componentsManager._onLateUpdateScripts.garbageCollection();
|
|
2323
|
-
// @ts-ignore
|
|
2324
|
-
_componentsManager._onPhysicsUpdateScripts.garbageCollection();
|
|
2325
|
-
// @ts-ignore
|
|
2326
|
-
_componentsManager._onUpdateAnimations.garbageCollection();
|
|
2327
|
-
// @ts-ignore
|
|
2328
|
-
_componentsManager._onUpdateRenderers.garbageCollection();
|
|
2329
|
-
_lightManager._spotLights.garbageCollection();
|
|
2330
|
-
_lightManager._pointLights.garbageCollection();
|
|
2331
|
-
_lightManager._directLights.garbageCollection();
|
|
2309
|
+
this.engine._pendingGC();
|
|
2332
2310
|
};
|
|
2333
2311
|
/**
|
|
2334
2312
|
* Add content restorer.
|
|
@@ -3254,6 +3232,17 @@ exports.GLCapabilityType = void 0;
|
|
|
3254
3232
|
componentContainer.length = 0;
|
|
3255
3233
|
this._componentsContainerPool.push(componentContainer);
|
|
3256
3234
|
};
|
|
3235
|
+
/**
|
|
3236
|
+
* @internal
|
|
3237
|
+
*/ _proto._gc = function _gc() {
|
|
3238
|
+
this._renderers.garbageCollection();
|
|
3239
|
+
this._onStartScripts.garbageCollection();
|
|
3240
|
+
this._onUpdateScripts.garbageCollection();
|
|
3241
|
+
this._onLateUpdateScripts.garbageCollection();
|
|
3242
|
+
this._onPhysicsUpdateScripts.garbageCollection();
|
|
3243
|
+
this._onUpdateAnimations.garbageCollection();
|
|
3244
|
+
this._onUpdateRenderers.garbageCollection();
|
|
3245
|
+
};
|
|
3257
3246
|
return ComponentsManager;
|
|
3258
3247
|
}();
|
|
3259
3248
|
|
|
@@ -5885,6 +5874,11 @@ var Collision = function Collision() {
|
|
|
5885
5874
|
elements[i]._onLateUpdate();
|
|
5886
5875
|
}
|
|
5887
5876
|
};
|
|
5877
|
+
/**
|
|
5878
|
+
* @internal
|
|
5879
|
+
*/ _proto._gc = function _gc() {
|
|
5880
|
+
this._colliders.garbageCollection();
|
|
5881
|
+
};
|
|
5888
5882
|
_proto._setGravity = function _setGravity() {
|
|
5889
5883
|
this._nativePhysicsManager.setGravity(this._gravity);
|
|
5890
5884
|
};
|
|
@@ -8462,6 +8456,13 @@ __decorate([
|
|
|
8462
8456
|
shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
|
|
8463
8457
|
}
|
|
8464
8458
|
};
|
|
8459
|
+
/**
|
|
8460
|
+
* @internal
|
|
8461
|
+
*/ _proto._gc = function _gc() {
|
|
8462
|
+
this._spotLights.garbageCollection();
|
|
8463
|
+
this._pointLights.garbageCollection();
|
|
8464
|
+
this._directLights.garbageCollection();
|
|
8465
|
+
};
|
|
8465
8466
|
return LightManager;
|
|
8466
8467
|
}();
|
|
8467
8468
|
|
|
@@ -16911,6 +16912,7 @@ ShaderPool.init();
|
|
|
16911
16912
|
_this._frameInProcess = false;
|
|
16912
16913
|
_this._waitingDestroy = false;
|
|
16913
16914
|
_this._isDeviceLost = false;
|
|
16915
|
+
_this._waitingGC = false;
|
|
16914
16916
|
_this._animate = function() {
|
|
16915
16917
|
if (_this._vSyncCount) {
|
|
16916
16918
|
_this._requestId = requestAnimationFrame(_this._animate);
|
|
@@ -17014,6 +17016,10 @@ ShaderPool.init();
|
|
|
17014
17016
|
if (this._waitingDestroy) {
|
|
17015
17017
|
this._destroy();
|
|
17016
17018
|
}
|
|
17019
|
+
if (this._waitingGC) {
|
|
17020
|
+
this._gc();
|
|
17021
|
+
this._waitingGC = false;
|
|
17022
|
+
}
|
|
17017
17023
|
this._frameInProcess = false;
|
|
17018
17024
|
};
|
|
17019
17025
|
/**
|
|
@@ -17172,6 +17178,15 @@ ShaderPool.init();
|
|
|
17172
17178
|
};
|
|
17173
17179
|
/**
|
|
17174
17180
|
* @internal
|
|
17181
|
+
*/ _proto._pendingGC = function _pendingGC() {
|
|
17182
|
+
if (this._frameInProcess) {
|
|
17183
|
+
this._waitingGC = true;
|
|
17184
|
+
} else {
|
|
17185
|
+
this._gc();
|
|
17186
|
+
}
|
|
17187
|
+
};
|
|
17188
|
+
/**
|
|
17189
|
+
* @internal
|
|
17175
17190
|
*/ _proto._initialize = function _initialize(configuration) {
|
|
17176
17191
|
var _this = this;
|
|
17177
17192
|
var physics = configuration.physics;
|
|
@@ -17234,6 +17249,16 @@ ShaderPool.init();
|
|
|
17234
17249
|
console.error(error);
|
|
17235
17250
|
});
|
|
17236
17251
|
};
|
|
17252
|
+
_proto._gc = function _gc() {
|
|
17253
|
+
this._renderElementPool.garbageCollection();
|
|
17254
|
+
this._meshRenderDataPool.garbageCollection();
|
|
17255
|
+
this._spriteRenderDataPool.garbageCollection();
|
|
17256
|
+
this._spriteMaskRenderDataPool.garbageCollection();
|
|
17257
|
+
this._textRenderDataPool.garbageCollection();
|
|
17258
|
+
this._componentsManager._gc();
|
|
17259
|
+
this._lightManager._gc();
|
|
17260
|
+
this.physicsManager._gc();
|
|
17261
|
+
};
|
|
17237
17262
|
_create_class(Engine, [
|
|
17238
17263
|
{
|
|
17239
17264
|
key: "settings",
|
|
@@ -22649,7 +22674,6 @@ var DirtyFlag;
|
|
|
22649
22674
|
* @internal
|
|
22650
22675
|
*/ var AnimationCurveOwner = /*#__PURE__*/ function() {
|
|
22651
22676
|
function AnimationCurveOwner(target, type, property, cureType) {
|
|
22652
|
-
this.hasSavedDefaultValue = false;
|
|
22653
22677
|
this.baseEvaluateData = {
|
|
22654
22678
|
curKeyframeIndex: 0,
|
|
22655
22679
|
value: null
|
|
@@ -22658,11 +22682,12 @@ var DirtyFlag;
|
|
|
22658
22682
|
curKeyframeIndex: 0,
|
|
22659
22683
|
value: null
|
|
22660
22684
|
};
|
|
22685
|
+
this.updateMark = 0;
|
|
22661
22686
|
this.target = target;
|
|
22662
22687
|
this.type = type;
|
|
22663
22688
|
this.property = property;
|
|
22664
22689
|
this.component = target.getComponent(type);
|
|
22665
|
-
this.
|
|
22690
|
+
this.cureType = cureType;
|
|
22666
22691
|
var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
|
|
22667
22692
|
this._assembler = new assemblerType();
|
|
22668
22693
|
this._assembler.initialize(this);
|
|
@@ -22671,89 +22696,80 @@ var DirtyFlag;
|
|
|
22671
22696
|
}
|
|
22672
22697
|
}
|
|
22673
22698
|
var _proto = AnimationCurveOwner.prototype;
|
|
22674
|
-
_proto.
|
|
22675
|
-
|
|
22676
|
-
if (additive) {
|
|
22677
|
-
var value = curve._evaluateAdditive(time, this.baseEvaluateData);
|
|
22678
|
-
var cureType = this._cureType;
|
|
22679
|
-
if (cureType._isReferenceType) {
|
|
22680
|
-
cureType._additiveValue(value, layerWeight, this.referenceTargetValue);
|
|
22681
|
-
} else {
|
|
22682
|
-
var assembler = this._assembler;
|
|
22683
|
-
var originValue = assembler.getTargetValue();
|
|
22684
|
-
var additiveValue = cureType._additiveValue(value, layerWeight, originValue);
|
|
22685
|
-
assembler.setTargetValue(additiveValue);
|
|
22686
|
-
}
|
|
22687
|
-
} else {
|
|
22688
|
-
var value1 = curve._evaluate(time, this.baseEvaluateData);
|
|
22689
|
-
this._applyValue(value1, layerWeight);
|
|
22690
|
-
}
|
|
22691
|
-
}
|
|
22699
|
+
_proto.evaluateValue = function evaluateValue(curve, time, additive) {
|
|
22700
|
+
return additive ? curve._evaluateAdditive(time, this.baseEvaluateData) : curve._evaluate(time, this.baseEvaluateData);
|
|
22692
22701
|
};
|
|
22693
|
-
_proto.
|
|
22694
|
-
var srcValue = srcCurve && srcCurve.keys.length ? additive ? srcCurve._evaluateAdditive(srcTime, this.baseEvaluateData) : srcCurve._evaluate(srcTime, this.baseEvaluateData) : additive ? this.
|
|
22695
|
-
var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.
|
|
22696
|
-
this.
|
|
22702
|
+
_proto.evaluateCrossFadeValue = function evaluateCrossFadeValue(srcCurve, destCurve, srcTime, destTime, crossWeight, additive) {
|
|
22703
|
+
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;
|
|
22704
|
+
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;
|
|
22705
|
+
return this._lerpValue(srcValue, destValue, crossWeight);
|
|
22697
22706
|
};
|
|
22698
|
-
_proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight,
|
|
22699
|
-
var srcValue = additive ? this.
|
|
22700
|
-
var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.
|
|
22701
|
-
this.
|
|
22707
|
+
_proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight, additive) {
|
|
22708
|
+
var srcValue = additive ? this.cureType._subtractValue(this.fixedPoseValue, this.defaultValue, this.baseEvaluateData.value) : this.fixedPoseValue;
|
|
22709
|
+
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;
|
|
22710
|
+
return this._lerpValue(srcValue, destValue, crossWeight);
|
|
22702
22711
|
};
|
|
22703
22712
|
_proto.revertDefaultValue = function revertDefaultValue() {
|
|
22704
22713
|
this._assembler.setTargetValue(this.defaultValue);
|
|
22705
22714
|
};
|
|
22715
|
+
_proto.getEvaluateValue = function getEvaluateValue(out) {
|
|
22716
|
+
if (this.cureType._isReferenceType) {
|
|
22717
|
+
this.cureType._copyValue(this.baseEvaluateData.value, out);
|
|
22718
|
+
return out;
|
|
22719
|
+
} else {
|
|
22720
|
+
return this.baseEvaluateData.value;
|
|
22721
|
+
}
|
|
22722
|
+
};
|
|
22706
22723
|
_proto.saveDefaultValue = function saveDefaultValue() {
|
|
22707
|
-
if (this.
|
|
22708
|
-
this.
|
|
22724
|
+
if (this.cureType._isReferenceType) {
|
|
22725
|
+
this.cureType._copyValue(this.referenceTargetValue, this.defaultValue);
|
|
22709
22726
|
} else {
|
|
22710
22727
|
this.defaultValue = this._assembler.getTargetValue();
|
|
22711
22728
|
}
|
|
22712
|
-
this.hasSavedDefaultValue = true;
|
|
22713
22729
|
};
|
|
22714
22730
|
_proto.saveFixedPoseValue = function saveFixedPoseValue() {
|
|
22715
|
-
if (this.
|
|
22716
|
-
this.
|
|
22731
|
+
if (this.cureType._isReferenceType) {
|
|
22732
|
+
this.cureType._copyValue(this.referenceTargetValue, this.fixedPoseValue);
|
|
22717
22733
|
} else {
|
|
22718
22734
|
this.fixedPoseValue = this._assembler.getTargetValue();
|
|
22719
22735
|
}
|
|
22720
22736
|
};
|
|
22721
|
-
_proto.
|
|
22722
|
-
|
|
22723
|
-
|
|
22724
|
-
|
|
22737
|
+
_proto.applyValue = function applyValue(value, weight, additive) {
|
|
22738
|
+
var cureType = this.cureType;
|
|
22739
|
+
if (additive) {
|
|
22740
|
+
if (cureType._isReferenceType) {
|
|
22741
|
+
cureType._additiveValue(value, weight, this.referenceTargetValue);
|
|
22725
22742
|
} else {
|
|
22726
|
-
this._assembler
|
|
22743
|
+
var assembler = this._assembler;
|
|
22744
|
+
var originValue = assembler.getTargetValue();
|
|
22745
|
+
var additiveValue = cureType._additiveValue(value, weight, originValue);
|
|
22746
|
+
assembler.setTargetValue(additiveValue);
|
|
22727
22747
|
}
|
|
22728
22748
|
} else {
|
|
22729
|
-
if (
|
|
22730
|
-
|
|
22731
|
-
|
|
22749
|
+
if (weight === 1.0) {
|
|
22750
|
+
if (cureType._isReferenceType) {
|
|
22751
|
+
cureType._copyValue(value, this.referenceTargetValue);
|
|
22752
|
+
} else {
|
|
22753
|
+
this._assembler.setTargetValue(value);
|
|
22754
|
+
}
|
|
22732
22755
|
} else {
|
|
22733
|
-
|
|
22734
|
-
|
|
22735
|
-
|
|
22756
|
+
if (cureType._isReferenceType) {
|
|
22757
|
+
var targetValue = this.referenceTargetValue;
|
|
22758
|
+
cureType._lerpValue(targetValue, value, weight, targetValue);
|
|
22759
|
+
} else {
|
|
22760
|
+
var originValue1 = this._assembler.getTargetValue();
|
|
22761
|
+
var lerpValue = cureType._lerpValue(originValue1, value, weight);
|
|
22762
|
+
this._assembler.setTargetValue(lerpValue);
|
|
22763
|
+
}
|
|
22736
22764
|
}
|
|
22737
22765
|
}
|
|
22738
22766
|
};
|
|
22739
|
-
_proto.
|
|
22740
|
-
|
|
22741
|
-
|
|
22742
|
-
out = this.baseEvaluateData.value;
|
|
22743
|
-
this._cureType._lerpValue(srcValue, destValue, crossWeight, out);
|
|
22744
|
-
} else {
|
|
22745
|
-
out = this._cureType._lerpValue(srcValue, destValue, crossWeight);
|
|
22746
|
-
}
|
|
22747
|
-
if (additive) {
|
|
22748
|
-
if (this._cureType._isReferenceType) {
|
|
22749
|
-
this._cureType._additiveValue(out, layerWeight, this.referenceTargetValue);
|
|
22750
|
-
} else {
|
|
22751
|
-
var originValue = this._assembler.getTargetValue();
|
|
22752
|
-
var lerpValue = this._cureType._additiveValue(out, layerWeight, originValue);
|
|
22753
|
-
this._assembler.setTargetValue(lerpValue);
|
|
22754
|
-
}
|
|
22767
|
+
_proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
22768
|
+
if (this.cureType._isReferenceType) {
|
|
22769
|
+
return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
|
|
22755
22770
|
} else {
|
|
22756
|
-
this.
|
|
22771
|
+
this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
|
|
22772
|
+
return this.baseEvaluateData.value;
|
|
22757
22773
|
}
|
|
22758
22774
|
};
|
|
22759
22775
|
AnimationCurveOwner.registerAssembler = function registerAssembler(componentType, property, assemblerType) {
|
|
@@ -22849,9 +22865,24 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22849
22865
|
|
|
22850
22866
|
/**
|
|
22851
22867
|
* @internal
|
|
22852
|
-
*/ var AnimationCurveLayerOwner = function
|
|
22853
|
-
|
|
22854
|
-
|
|
22868
|
+
*/ var AnimationCurveLayerOwner = /*#__PURE__*/ function() {
|
|
22869
|
+
function AnimationCurveLayerOwner() {
|
|
22870
|
+
this.crossCurveMark = 0;
|
|
22871
|
+
}
|
|
22872
|
+
var _proto = AnimationCurveLayerOwner.prototype;
|
|
22873
|
+
_proto.initFinalValue = function initFinalValue() {
|
|
22874
|
+
var _this_curveOwner = this.curveOwner, cureType = _this_curveOwner.cureType, defaultValue = _this_curveOwner.defaultValue;
|
|
22875
|
+
if (cureType._isReferenceType) {
|
|
22876
|
+
cureType._copyValue(defaultValue, this.finalValue);
|
|
22877
|
+
} else {
|
|
22878
|
+
this.finalValue = defaultValue;
|
|
22879
|
+
}
|
|
22880
|
+
};
|
|
22881
|
+
_proto.saveFinalValue = function saveFinalValue() {
|
|
22882
|
+
this.finalValue = this.curveOwner.getEvaluateValue(this.finalValue);
|
|
22883
|
+
};
|
|
22884
|
+
return AnimationCurveLayerOwner;
|
|
22885
|
+
}();
|
|
22855
22886
|
|
|
22856
22887
|
/**
|
|
22857
22888
|
* Associate AnimationCurve and the Entity
|
|
@@ -22866,13 +22897,18 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22866
22897
|
var curveType = this.curve.constructor;
|
|
22867
22898
|
var owner = new AnimationCurveOwner(entity, this.type, this.property, curveType);
|
|
22868
22899
|
curveType._initializeOwner(owner);
|
|
22900
|
+
owner.saveDefaultValue();
|
|
22869
22901
|
return owner;
|
|
22870
22902
|
};
|
|
22871
22903
|
/**
|
|
22872
22904
|
* @internal
|
|
22873
22905
|
*/ _proto._createCurveLayerOwner = function _createCurveLayerOwner(owner) {
|
|
22906
|
+
var curveType = this.curve.constructor;
|
|
22874
22907
|
var layerOwner = new AnimationCurveLayerOwner();
|
|
22875
22908
|
layerOwner.curveOwner = owner;
|
|
22909
|
+
curveType._initializeLayerOwner(layerOwner);
|
|
22910
|
+
// If curve.keys.length is 0, updateFinishedState will assign 0 to the target, causing an error, so initialize by assigning defaultValue to finalValue.
|
|
22911
|
+
layerOwner.initFinalValue();
|
|
22876
22912
|
return layerOwner;
|
|
22877
22913
|
};
|
|
22878
22914
|
/**
|
|
@@ -22960,7 +22996,8 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22960
22996
|
var targetEntity = entity.findByPath(curveData.relativePath);
|
|
22961
22997
|
if (targetEntity) {
|
|
22962
22998
|
var curveOwner = curveData._getTempCurveOwner(targetEntity);
|
|
22963
|
-
curveOwner.
|
|
22999
|
+
var value = curveOwner.evaluateValue(curveData.curve, time, false);
|
|
23000
|
+
curveOwner.applyValue(value, 1, false);
|
|
22964
23001
|
}
|
|
22965
23002
|
}
|
|
22966
23003
|
};
|
|
@@ -23104,6 +23141,7 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
23104
23141
|
break;
|
|
23105
23142
|
}
|
|
23106
23143
|
}
|
|
23144
|
+
evaluateData.value = value;
|
|
23107
23145
|
return value;
|
|
23108
23146
|
};
|
|
23109
23147
|
/**
|
|
@@ -23160,6 +23198,11 @@ exports.AnimationArrayCurve = (_AnimationArrayCurve = /*#__PURE__*/ function(Ani
|
|
|
23160
23198
|
};
|
|
23161
23199
|
/**
|
|
23162
23200
|
* @internal
|
|
23201
|
+
*/ AnimationArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23202
|
+
owner.finalValue = [];
|
|
23203
|
+
};
|
|
23204
|
+
/**
|
|
23205
|
+
* @internal
|
|
23163
23206
|
*/ AnimationArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23164
23207
|
for(var i = 0, n = out.length; i < n; ++i){
|
|
23165
23208
|
var src = srcValue[i];
|
|
@@ -23250,6 +23293,11 @@ exports.AnimationBoolCurve = (_AnimationBoolCurve = /*#__PURE__*/ function(Anima
|
|
|
23250
23293
|
};
|
|
23251
23294
|
/**
|
|
23252
23295
|
* @internal
|
|
23296
|
+
*/ AnimationBoolCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23297
|
+
owner.finalValue = false;
|
|
23298
|
+
};
|
|
23299
|
+
/**
|
|
23300
|
+
* @internal
|
|
23253
23301
|
*/ AnimationBoolCurve._lerpValue = function _lerpValue(srcValue, destValue) {
|
|
23254
23302
|
return destValue;
|
|
23255
23303
|
};
|
|
@@ -23307,6 +23355,11 @@ exports.AnimationColorCurve = (_AnimationColorCurve = /*#__PURE__*/ function(Ani
|
|
|
23307
23355
|
};
|
|
23308
23356
|
/**
|
|
23309
23357
|
* @internal
|
|
23358
|
+
*/ AnimationColorCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23359
|
+
owner.finalValue = new engineMath.Color();
|
|
23360
|
+
};
|
|
23361
|
+
/**
|
|
23362
|
+
* @internal
|
|
23310
23363
|
*/ AnimationColorCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23311
23364
|
engineMath.Color.lerp(srcValue, destValue, weight, out);
|
|
23312
23365
|
return out;
|
|
@@ -23413,6 +23466,12 @@ exports.AnimationFloatArrayCurve = (_AnimationFloatArrayCurve = /*#__PURE__*/ fu
|
|
|
23413
23466
|
};
|
|
23414
23467
|
/**
|
|
23415
23468
|
* @internal
|
|
23469
|
+
*/ AnimationFloatArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23470
|
+
var size = owner.curveOwner.referenceTargetValue.length;
|
|
23471
|
+
owner.finalValue = new Float32Array(size);
|
|
23472
|
+
};
|
|
23473
|
+
/**
|
|
23474
|
+
* @internal
|
|
23416
23475
|
*/ AnimationFloatArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23417
23476
|
for(var i = 0, n = out.length; i < n; ++i){
|
|
23418
23477
|
var src = srcValue[i];
|
|
@@ -23503,6 +23562,11 @@ exports.AnimationFloatCurve = (_AnimationFloatCurve = /*#__PURE__*/ function(Ani
|
|
|
23503
23562
|
};
|
|
23504
23563
|
/**
|
|
23505
23564
|
* @internal
|
|
23565
|
+
*/ AnimationFloatCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23566
|
+
owner.finalValue = 0;
|
|
23567
|
+
};
|
|
23568
|
+
/**
|
|
23569
|
+
* @internal
|
|
23506
23570
|
*/ AnimationFloatCurve._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
23507
23571
|
return srcValue + (destValue - srcValue) * crossWeight;
|
|
23508
23572
|
};
|
|
@@ -23572,6 +23636,11 @@ exports.AnimationQuaternionCurve = (_AnimationQuaternionCurve = /*#__PURE__*/ fu
|
|
|
23572
23636
|
};
|
|
23573
23637
|
/**
|
|
23574
23638
|
* @internal
|
|
23639
|
+
*/ AnimationQuaternionCurve1._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23640
|
+
owner.finalValue = new engineMath.Quaternion();
|
|
23641
|
+
};
|
|
23642
|
+
/**
|
|
23643
|
+
* @internal
|
|
23575
23644
|
*/ AnimationQuaternionCurve1._lerpValue = function _lerpValue(src, dest, weight, out) {
|
|
23576
23645
|
engineMath.Quaternion.slerp(src, dest, weight, out);
|
|
23577
23646
|
return out;
|
|
@@ -23676,6 +23745,11 @@ exports.AnimationVector2Curve = (_AnimationVector2Curve = /*#__PURE__*/ function
|
|
|
23676
23745
|
};
|
|
23677
23746
|
/**
|
|
23678
23747
|
* @internal
|
|
23748
|
+
*/ AnimationVector2Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23749
|
+
owner.finalValue = new engineMath.Vector2();
|
|
23750
|
+
};
|
|
23751
|
+
/**
|
|
23752
|
+
* @internal
|
|
23679
23753
|
*/ AnimationVector2Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23680
23754
|
engineMath.Vector2.lerp(srcValue, destValue, weight, out);
|
|
23681
23755
|
return out;
|
|
@@ -23761,6 +23835,11 @@ exports.AnimationVector3Curve = (_AnimationVector3Curve = /*#__PURE__*/ function
|
|
|
23761
23835
|
};
|
|
23762
23836
|
/**
|
|
23763
23837
|
* @internal
|
|
23838
|
+
*/ AnimationVector3Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23839
|
+
owner.finalValue = new engineMath.Vector3();
|
|
23840
|
+
};
|
|
23841
|
+
/**
|
|
23842
|
+
* @internal
|
|
23764
23843
|
*/ AnimationVector3Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23765
23844
|
engineMath.Vector3.lerp(srcValue, destValue, weight, out);
|
|
23766
23845
|
return out;
|
|
@@ -23858,6 +23937,11 @@ exports.AnimationVector4Curve = (_AnimationVector4Curve = /*#__PURE__*/ function
|
|
|
23858
23937
|
};
|
|
23859
23938
|
/**
|
|
23860
23939
|
* @internal
|
|
23940
|
+
*/ AnimationVector4Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23941
|
+
owner.finalValue = new engineMath.Vector4();
|
|
23942
|
+
};
|
|
23943
|
+
/**
|
|
23944
|
+
* @internal
|
|
23861
23945
|
*/ AnimationVector4Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23862
23946
|
engineMath.Vector4.lerp(srcValue, destValue, weight, out);
|
|
23863
23947
|
return out;
|
|
@@ -23967,6 +24051,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23967
24051
|
LayerState[LayerState[/** Playing state. */ "Playing"] = 1] = "Playing";
|
|
23968
24052
|
LayerState[LayerState[/** CrossFading state. */ "CrossFading"] = 2] = "CrossFading";
|
|
23969
24053
|
LayerState[LayerState[/** FixedCrossFading state. */ "FixedCrossFading"] = 3] = "FixedCrossFading";
|
|
24054
|
+
LayerState[LayerState[/** Finished state. */ "Finished"] = 4] = "Finished";
|
|
23970
24055
|
})(LayerState || (LayerState = {}));
|
|
23971
24056
|
|
|
23972
24057
|
/**
|
|
@@ -24043,7 +24128,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24043
24128
|
this.layerState = LayerState.Standby;
|
|
24044
24129
|
this.crossCurveMark = 0;
|
|
24045
24130
|
this.manuallyTransition = new AnimatorStateTransition();
|
|
24046
|
-
this.
|
|
24131
|
+
this.crossLayerOwnerCollection = [];
|
|
24047
24132
|
}
|
|
24048
24133
|
var _proto = AnimatorLayerData.prototype;
|
|
24049
24134
|
_proto.switchPlayData = function switchPlayData() {
|
|
@@ -24071,6 +24156,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24071
24156
|
_this = Component.call(this, entity) || this;
|
|
24072
24157
|
/** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
|
|
24073
24158
|
/** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
|
|
24159
|
+
_this._updateMark = 0;
|
|
24074
24160
|
_this._animatorLayersData = [];
|
|
24075
24161
|
_this._curveOwnerPool = Object.create(null);
|
|
24076
24162
|
_this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
|
|
@@ -24095,17 +24181,17 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24095
24181
|
this._reset();
|
|
24096
24182
|
}
|
|
24097
24183
|
var stateInfo = this._getAnimatorStateInfo(stateName, layerIndex);
|
|
24098
|
-
var state = stateInfo.state;
|
|
24184
|
+
var state = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
|
|
24099
24185
|
if (!state) {
|
|
24100
24186
|
return;
|
|
24101
24187
|
}
|
|
24102
24188
|
if (!state.clip) {
|
|
24103
|
-
|
|
24189
|
+
Logger.warn("The state named " + stateName + " has no AnimationClip data.");
|
|
24104
24190
|
return;
|
|
24105
24191
|
}
|
|
24106
|
-
var animatorLayerData = this._getAnimatorLayerData(
|
|
24107
|
-
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData);
|
|
24108
|
-
this._preparePlay(animatorLayerData, state
|
|
24192
|
+
var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
|
|
24193
|
+
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData, playLayerIndex);
|
|
24194
|
+
this._preparePlay(animatorLayerData, state);
|
|
24109
24195
|
animatorLayerData.layerState = LayerState.Playing;
|
|
24110
24196
|
animatorLayerData.srcPlayData.reset(state, animatorStateData, state._getDuration() * normalizedTimeOffset);
|
|
24111
24197
|
};
|
|
@@ -24122,8 +24208,8 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24122
24208
|
if ((_this__controllerUpdateFlag = this._controllerUpdateFlag) == null ? void 0 : _this__controllerUpdateFlag.flag) {
|
|
24123
24209
|
this._reset();
|
|
24124
24210
|
}
|
|
24125
|
-
var
|
|
24126
|
-
var manuallyTransition = this._getAnimatorLayerData(
|
|
24211
|
+
var _this__getAnimatorStateInfo = this._getAnimatorStateInfo(stateName, layerIndex), state = _this__getAnimatorStateInfo.state, playLayerIndex = _this__getAnimatorStateInfo.layerIndex;
|
|
24212
|
+
var manuallyTransition = this._getAnimatorLayerData(playLayerIndex).manuallyTransition;
|
|
24127
24213
|
manuallyTransition.duration = normalizedTransitionDuration;
|
|
24128
24214
|
manuallyTransition.offset = normalizedTimeOffset;
|
|
24129
24215
|
manuallyTransition.destinationState = state;
|
|
@@ -24156,6 +24242,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24156
24242
|
return;
|
|
24157
24243
|
}
|
|
24158
24244
|
deltaTime *= this.speed;
|
|
24245
|
+
this._updateMark++;
|
|
24159
24246
|
for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
|
|
24160
24247
|
var animatorLayerData = this._getAnimatorLayerData(i1);
|
|
24161
24248
|
if (animatorLayerData.layerState === LayerState.Standby) {
|
|
@@ -24199,7 +24286,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24199
24286
|
var propertyOwners = animationCurveOwners[instanceId];
|
|
24200
24287
|
for(var property in propertyOwners){
|
|
24201
24288
|
var owner = propertyOwners[property];
|
|
24202
|
-
owner.
|
|
24289
|
+
owner.revertDefaultValue();
|
|
24203
24290
|
}
|
|
24204
24291
|
}
|
|
24205
24292
|
this._animatorLayersData.length = 0;
|
|
@@ -24230,29 +24317,22 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24230
24317
|
stateInfo.state = state;
|
|
24231
24318
|
return stateInfo;
|
|
24232
24319
|
};
|
|
24233
|
-
_proto.
|
|
24234
|
-
var curveLayerOwner = stateData.curveLayerOwner;
|
|
24235
|
-
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24236
|
-
var _curveLayerOwner_i;
|
|
24237
|
-
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.saveDefaultValue();
|
|
24238
|
-
}
|
|
24239
|
-
};
|
|
24240
|
-
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData) {
|
|
24320
|
+
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData, layerIndex) {
|
|
24241
24321
|
var animatorStateDataMap = animatorLayerData.animatorStateDataMap;
|
|
24242
24322
|
var animatorStateData = animatorStateDataMap[stateName];
|
|
24243
24323
|
if (!animatorStateData) {
|
|
24244
24324
|
animatorStateData = new AnimatorStateData();
|
|
24245
24325
|
animatorStateDataMap[stateName] = animatorStateData;
|
|
24246
|
-
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData);
|
|
24326
|
+
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex);
|
|
24247
24327
|
this._saveAnimatorEventHandlers(animatorState, animatorStateData);
|
|
24248
24328
|
}
|
|
24249
24329
|
return animatorStateData;
|
|
24250
24330
|
};
|
|
24251
|
-
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData) {
|
|
24331
|
+
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex) {
|
|
24252
24332
|
var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
|
|
24253
24333
|
var curveLayerOwner = animatorStateData.curveLayerOwner;
|
|
24254
|
-
var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
|
|
24255
24334
|
var _animatorState_clip = animatorState.clip, curves = _animatorState_clip._curveBindings;
|
|
24335
|
+
var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
|
|
24256
24336
|
for(var i = curves.length - 1; i >= 0; i--){
|
|
24257
24337
|
var curve = curves[i];
|
|
24258
24338
|
var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
|
|
@@ -24269,7 +24349,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24269
24349
|
curveLayerOwner[i] = layerOwner;
|
|
24270
24350
|
} else {
|
|
24271
24351
|
curveLayerOwner[i] = null;
|
|
24272
|
-
|
|
24352
|
+
Logger.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
|
|
24273
24353
|
}
|
|
24274
24354
|
}
|
|
24275
24355
|
};
|
|
@@ -24296,12 +24376,12 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24296
24376
|
};
|
|
24297
24377
|
_proto._clearCrossData = function _clearCrossData(animatorLayerData) {
|
|
24298
24378
|
animatorLayerData.crossCurveMark++;
|
|
24299
|
-
animatorLayerData.
|
|
24379
|
+
animatorLayerData.crossLayerOwnerCollection.length = 0;
|
|
24300
24380
|
};
|
|
24301
24381
|
_proto._addCrossOwner = function _addCrossOwner(animatorLayerData, layerOwner, curCurveIndex, nextCurveIndex) {
|
|
24302
24382
|
layerOwner.crossSrcCurveIndex = curCurveIndex;
|
|
24303
24383
|
layerOwner.crossDestCurveIndex = nextCurveIndex;
|
|
24304
|
-
animatorLayerData.
|
|
24384
|
+
animatorLayerData.crossLayerOwnerCollection.push(layerOwner);
|
|
24305
24385
|
};
|
|
24306
24386
|
_proto._prepareCrossFading = function _prepareCrossFading(animatorLayerData) {
|
|
24307
24387
|
// Add src cross curve data.
|
|
@@ -24316,10 +24396,10 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24316
24396
|
this._prepareDestCrossData(animatorLayerData, true);
|
|
24317
24397
|
};
|
|
24318
24398
|
_proto._prepareFixedPoseCrossFading = function _prepareFixedPoseCrossFading(animatorLayerData) {
|
|
24319
|
-
var
|
|
24399
|
+
var crossLayerOwnerCollection = animatorLayerData.crossLayerOwnerCollection;
|
|
24320
24400
|
// Save current cross curve data owner fixed pose.
|
|
24321
|
-
for(var i =
|
|
24322
|
-
var layerOwner =
|
|
24401
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
24402
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
24323
24403
|
if (!layerOwner) continue;
|
|
24324
24404
|
layerOwner.curveOwner.saveFixedPoseValue();
|
|
24325
24405
|
// Reset destCurveIndex When fixed pose crossFading again.
|
|
@@ -24347,7 +24427,6 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24347
24427
|
layerOwner.crossDestCurveIndex = i;
|
|
24348
24428
|
} else {
|
|
24349
24429
|
var owner = layerOwner.curveOwner;
|
|
24350
|
-
owner.saveDefaultValue();
|
|
24351
24430
|
saveFixed && owner.saveFixedPoseValue();
|
|
24352
24431
|
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
24353
24432
|
this._addCrossOwner(animatorLayerData, layerOwner, -1, i);
|
|
@@ -24365,7 +24444,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24365
24444
|
var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData, crossFadeTransitionInfo = layerData.crossFadeTransition;
|
|
24366
24445
|
var additive = blendingMode === exports.AnimatorLayerBlendingMode.Additive;
|
|
24367
24446
|
firstLayer && (weight = 1.0);
|
|
24368
|
-
|
|
24447
|
+
//@todo: All situations should be checked, optimizations will follow later.
|
|
24369
24448
|
layerData.layerState !== LayerState.FixedCrossFading && this._checkTransition(srcPlayData, crossFadeTransitionInfo, layerIndex);
|
|
24370
24449
|
switch(layerData.layerState){
|
|
24371
24450
|
case LayerState.Playing:
|
|
@@ -24377,6 +24456,9 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24377
24456
|
case LayerState.CrossFading:
|
|
24378
24457
|
this._updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, deltaTime, additive, aniUpdate);
|
|
24379
24458
|
break;
|
|
24459
|
+
case LayerState.Finished:
|
|
24460
|
+
this._updateFinishedState(srcPlayData, weight, additive, aniUpdate);
|
|
24461
|
+
break;
|
|
24380
24462
|
}
|
|
24381
24463
|
};
|
|
24382
24464
|
_proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
@@ -24384,19 +24466,27 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24384
24466
|
var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
|
|
24385
24467
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
24386
24468
|
playData.update(this.speed < 0);
|
|
24387
|
-
if (!aniUpdate) {
|
|
24388
|
-
return;
|
|
24389
|
-
}
|
|
24390
24469
|
var clipTime = playData.clipTime, playState = playData.playState;
|
|
24391
|
-
|
|
24392
|
-
|
|
24393
|
-
var
|
|
24394
|
-
|
|
24470
|
+
var finished = playState === AnimatorStatePlayState.Finished;
|
|
24471
|
+
if (aniUpdate || finished) {
|
|
24472
|
+
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
24473
|
+
var layerOwner = curveLayerOwner[i];
|
|
24474
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
24475
|
+
if (!owner) continue;
|
|
24476
|
+
var curve = curveBindings[i].curve;
|
|
24477
|
+
if (curve.keys.length) {
|
|
24478
|
+
this._checkRevertOwner(owner, additive);
|
|
24479
|
+
var value = owner.evaluateValue(curve, clipTime, additive);
|
|
24480
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
24481
|
+
finished && layerOwner.saveFinalValue();
|
|
24482
|
+
}
|
|
24483
|
+
}
|
|
24395
24484
|
}
|
|
24396
24485
|
playData.frameTime += state.speed * delta;
|
|
24397
24486
|
if (playState === AnimatorStatePlayState.Finished) {
|
|
24398
|
-
layerData.layerState = LayerState.
|
|
24487
|
+
layerData.layerState = LayerState.Finished;
|
|
24399
24488
|
}
|
|
24489
|
+
eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
24400
24490
|
if (lastPlayState === AnimatorStatePlayState.UnStarted) {
|
|
24401
24491
|
this._callAnimatorScriptOnEnter(state, layerIndex);
|
|
24402
24492
|
}
|
|
@@ -24407,7 +24497,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24407
24497
|
}
|
|
24408
24498
|
};
|
|
24409
24499
|
_proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
24410
|
-
var
|
|
24500
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
24411
24501
|
var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
|
|
24412
24502
|
var srcState = srcPlayData.state, srcStateData = srcPlayData.stateData, lastSrcPlayState = srcPlayData.playState;
|
|
24413
24503
|
var srcEventHandlers = srcStateData.eventHandlers;
|
|
@@ -24416,18 +24506,28 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24416
24506
|
var _destState_clip = destState.clip, destCurves = _destState_clip._curveBindings;
|
|
24417
24507
|
var lastSrcClipTime = srcPlayData.clipTime;
|
|
24418
24508
|
var lastDestClipTime = destPlayData.clipTime;
|
|
24419
|
-
var
|
|
24420
|
-
crossWeight
|
|
24509
|
+
var duration = destState._getDuration() * layerData.crossFadeTransition.duration;
|
|
24510
|
+
var crossWeight = Math.abs(destPlayData.frameTime) / duration;
|
|
24511
|
+
(crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
|
|
24421
24512
|
srcPlayData.update(this.speed < 0);
|
|
24422
24513
|
destPlayData.update(this.speed < 0);
|
|
24423
|
-
var srcPlayState = srcPlayData.playState;
|
|
24424
|
-
var destPlayState = destPlayData.playState;
|
|
24425
|
-
|
|
24426
|
-
if (
|
|
24427
|
-
|
|
24514
|
+
var srcClipTime = srcPlayData.clipTime, srcPlayState = srcPlayData.playState;
|
|
24515
|
+
var destClipTime = destPlayData.clipTime, destPlayState = destPlayData.playState;
|
|
24516
|
+
var finished = destPlayData.playState === AnimatorStatePlayState.Finished;
|
|
24517
|
+
if (aniUpdate || finished) {
|
|
24518
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
24519
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
24520
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
24521
|
+
if (!owner) continue;
|
|
24522
|
+
var srcCurveIndex = layerOwner.crossSrcCurveIndex;
|
|
24523
|
+
var destCurveIndex = layerOwner.crossDestCurveIndex;
|
|
24524
|
+
this._checkRevertOwner(owner, additive);
|
|
24525
|
+
var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
|
|
24526
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
24527
|
+
finished && layerOwner.saveFinalValue();
|
|
24528
|
+
}
|
|
24428
24529
|
}
|
|
24429
|
-
|
|
24430
|
-
var destClipTime = destPlayData.clipTime;
|
|
24530
|
+
this._updateCrossFadeData(layerData, crossWeight, delta, false);
|
|
24431
24531
|
srcEventHandlers.length && this._fireAnimationEvents(srcPlayData, srcEventHandlers, lastSrcClipTime, srcClipTime);
|
|
24432
24532
|
destEventHandlers.length && this._fireAnimationEvents(destPlayData, destEventHandlers, lastDestClipTime, destClipTime);
|
|
24433
24533
|
if (lastSrcPlayState === AnimatorStatePlayState.UnStarted) {
|
|
@@ -24446,30 +24546,35 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24446
24546
|
} else {
|
|
24447
24547
|
this._callAnimatorScriptOnUpdate(destState, layerIndex);
|
|
24448
24548
|
}
|
|
24449
|
-
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
24450
|
-
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
24451
|
-
if (!layerOwner) continue;
|
|
24452
|
-
var srcCurveIndex = layerOwner.crossSrcCurveIndex;
|
|
24453
|
-
var destCurveIndex = layerOwner.crossDestCurveIndex;
|
|
24454
|
-
layerOwner.curveOwner.crossFadeAndApplyValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
|
|
24455
|
-
}
|
|
24456
24549
|
};
|
|
24457
|
-
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex,
|
|
24458
|
-
var
|
|
24550
|
+
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
24551
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
24459
24552
|
var state = destPlayData.state, stateData = destPlayData.stateData, lastPlayState = destPlayData.playState;
|
|
24460
24553
|
var eventHandlers = stateData.eventHandlers;
|
|
24461
24554
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
24462
24555
|
var lastDestClipTime = destPlayData.clipTime;
|
|
24463
|
-
var
|
|
24464
|
-
crossWeight
|
|
24556
|
+
var duration = state._getDuration() * layerData.crossFadeTransition.duration;
|
|
24557
|
+
var crossWeight = Math.abs(destPlayData.frameTime) / duration;
|
|
24558
|
+
(crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
|
|
24465
24559
|
destPlayData.update(this.speed < 0);
|
|
24466
24560
|
var playState = destPlayData.playState;
|
|
24467
24561
|
this._updateCrossFadeData(layerData, crossWeight, delta, true);
|
|
24468
|
-
if (!aniUpdate) {
|
|
24469
|
-
return;
|
|
24470
|
-
}
|
|
24471
24562
|
var destClipTime = destPlayData.clipTime;
|
|
24472
|
-
|
|
24563
|
+
var finished = playState === AnimatorStatePlayState.Finished;
|
|
24564
|
+
// 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.
|
|
24565
|
+
if (aniUpdate || finished) {
|
|
24566
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
24567
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
24568
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
24569
|
+
if (!owner) continue;
|
|
24570
|
+
var curveIndex = layerOwner.crossDestCurveIndex;
|
|
24571
|
+
this._checkRevertOwner(owner, additive);
|
|
24572
|
+
var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
|
|
24573
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
24574
|
+
finished && layerOwner.saveFinalValue();
|
|
24575
|
+
}
|
|
24576
|
+
}
|
|
24577
|
+
//@todo: srcState is missing the judgment of the most recent period."
|
|
24473
24578
|
eventHandlers.length && this._fireAnimationEvents(destPlayData, eventHandlers, lastDestClipTime, destClipTime);
|
|
24474
24579
|
if (lastPlayState === AnimatorStatePlayState.UnStarted) {
|
|
24475
24580
|
this._callAnimatorScriptOnEnter(state, layerIndex);
|
|
@@ -24479,11 +24584,19 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24479
24584
|
} else {
|
|
24480
24585
|
this._callAnimatorScriptOnUpdate(state, layerIndex);
|
|
24481
24586
|
}
|
|
24482
|
-
|
|
24483
|
-
|
|
24484
|
-
|
|
24485
|
-
|
|
24486
|
-
|
|
24587
|
+
};
|
|
24588
|
+
_proto._updateFinishedState = function _updateFinishedState(playData, weight, additive, aniUpdate) {
|
|
24589
|
+
if (!aniUpdate) {
|
|
24590
|
+
return;
|
|
24591
|
+
}
|
|
24592
|
+
var curveLayerOwner = playData.stateData.curveLayerOwner;
|
|
24593
|
+
var _playData_state_clip = playData.state.clip, curveBindings = _playData_state_clip._curveBindings;
|
|
24594
|
+
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
24595
|
+
var layerOwner = curveLayerOwner[i];
|
|
24596
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
24597
|
+
if (!owner) continue;
|
|
24598
|
+
this._checkRevertOwner(owner, additive);
|
|
24599
|
+
owner.applyValue(layerOwner.finalValue, weight, additive);
|
|
24487
24600
|
}
|
|
24488
24601
|
};
|
|
24489
24602
|
_proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
|
|
@@ -24491,7 +24604,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24491
24604
|
destPlayData.frameTime += destPlayData.state.speed * delta;
|
|
24492
24605
|
if (crossWeight === 1.0) {
|
|
24493
24606
|
if (destPlayData.playState === AnimatorStatePlayState.Finished) {
|
|
24494
|
-
layerData.layerState = LayerState.
|
|
24607
|
+
layerData.layerState = LayerState.Finished;
|
|
24495
24608
|
} else {
|
|
24496
24609
|
layerData.layerState = LayerState.Playing;
|
|
24497
24610
|
}
|
|
@@ -24501,26 +24614,22 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24501
24614
|
fixed || (layerData.srcPlayData.frameTime += layerData.srcPlayData.state.speed * delta);
|
|
24502
24615
|
}
|
|
24503
24616
|
};
|
|
24504
|
-
_proto._preparePlay = function _preparePlay(layerData, playState
|
|
24617
|
+
_proto._preparePlay = function _preparePlay(layerData, playState) {
|
|
24505
24618
|
if (layerData.layerState === LayerState.Playing) {
|
|
24506
24619
|
var srcPlayData = layerData.srcPlayData;
|
|
24507
24620
|
if (srcPlayData.state !== playState) {
|
|
24508
24621
|
var curveLayerOwner = srcPlayData.stateData.curveLayerOwner;
|
|
24509
24622
|
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24510
24623
|
var _curveLayerOwner_i;
|
|
24511
|
-
|
|
24512
|
-
(owner == null ? void 0 : owner.hasSavedDefaultValue) && owner.revertDefaultValue();
|
|
24624
|
+
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.revertDefaultValue();
|
|
24513
24625
|
}
|
|
24514
|
-
this._saveDefaultValues(playStateData);
|
|
24515
24626
|
}
|
|
24516
24627
|
} else {
|
|
24517
|
-
// layerState is CrossFading, FixedCrossFading, Standby
|
|
24518
|
-
var
|
|
24519
|
-
for(var i1 =
|
|
24520
|
-
|
|
24521
|
-
owner1.hasSavedDefaultValue && owner1.revertDefaultValue();
|
|
24628
|
+
// layerState is CrossFading, FixedCrossFading, Standby, Finished
|
|
24629
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
24630
|
+
for(var i1 = crossLayerOwnerCollection.length - 1; i1 >= 0; i1--){
|
|
24631
|
+
crossLayerOwnerCollection[i1].curveOwner.revertDefaultValue();
|
|
24522
24632
|
}
|
|
24523
|
-
this._saveDefaultValues(playStateData);
|
|
24524
24633
|
}
|
|
24525
24634
|
};
|
|
24526
24635
|
_proto._checkTransition = function _checkTransition(stateData, crossFadeTransition, layerIndex) {
|
|
@@ -24537,24 +24646,24 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24537
24646
|
_proto._crossFadeByTransition = function _crossFadeByTransition(transition, layerIndex) {
|
|
24538
24647
|
var name = transition.destinationState.name;
|
|
24539
24648
|
var stateInfo = this._getAnimatorStateInfo(name, layerIndex);
|
|
24540
|
-
var crossState = stateInfo.state;
|
|
24649
|
+
var crossState = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
|
|
24541
24650
|
if (!crossState) {
|
|
24542
24651
|
return;
|
|
24543
24652
|
}
|
|
24544
24653
|
if (!crossState.clip) {
|
|
24545
|
-
|
|
24654
|
+
Logger.warn("The state named " + name + " has no AnimationClip data.");
|
|
24546
24655
|
return;
|
|
24547
24656
|
}
|
|
24548
|
-
var animatorLayerData = this._getAnimatorLayerData(
|
|
24657
|
+
var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
|
|
24549
24658
|
var layerState = animatorLayerData.layerState;
|
|
24550
24659
|
var destPlayData = animatorLayerData.destPlayData;
|
|
24551
|
-
var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData);
|
|
24660
|
+
var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData, playLayerIndex);
|
|
24552
24661
|
var duration = crossState._getDuration();
|
|
24553
24662
|
var offset = duration * transition.offset;
|
|
24554
24663
|
destPlayData.reset(crossState, animatorStateData, offset);
|
|
24555
24664
|
switch(layerState){
|
|
24556
|
-
// Maybe not play, maybe end.
|
|
24557
24665
|
case LayerState.Standby:
|
|
24666
|
+
case LayerState.Finished:
|
|
24558
24667
|
animatorLayerData.layerState = LayerState.FixedCrossFading;
|
|
24559
24668
|
this._clearCrossData(animatorLayerData);
|
|
24560
24669
|
this._prepareStandbyCrossFading(animatorLayerData);
|
|
@@ -24656,6 +24765,12 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24656
24765
|
}
|
|
24657
24766
|
}
|
|
24658
24767
|
};
|
|
24768
|
+
_proto._checkRevertOwner = function _checkRevertOwner(owner, additive) {
|
|
24769
|
+
if (additive && owner.updateMark !== this._updateMark) {
|
|
24770
|
+
owner.revertDefaultValue();
|
|
24771
|
+
}
|
|
24772
|
+
owner.updateMark = this._updateMark;
|
|
24773
|
+
};
|
|
24659
24774
|
_create_class(Animator, [
|
|
24660
24775
|
{
|
|
24661
24776
|
key: "animatorController",
|
|
@@ -24682,6 +24797,9 @@ __decorate([
|
|
|
24682
24797
|
__decorate([
|
|
24683
24798
|
ignoreClone
|
|
24684
24799
|
], Animator.prototype, "_controllerUpdateFlag", void 0);
|
|
24800
|
+
__decorate([
|
|
24801
|
+
ignoreClone
|
|
24802
|
+
], Animator.prototype, "_updateMark", void 0);
|
|
24685
24803
|
__decorate([
|
|
24686
24804
|
ignoreClone
|
|
24687
24805
|
], Animator.prototype, "_animatorLayersData", void 0);
|