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