@galacean/engine-core 1.0.0-beta.12 → 1.0.0-beta.13
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 +291 -162
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +291 -162
- package/dist/module.js +291 -162
- 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
|
|
@@ -22663,7 +22687,7 @@ var DirtyFlag;
|
|
|
22663
22687
|
this.type = type;
|
|
22664
22688
|
this.property = property;
|
|
22665
22689
|
this.component = target.getComponent(type);
|
|
22666
|
-
this.
|
|
22690
|
+
this.cureType = cureType;
|
|
22667
22691
|
var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
|
|
22668
22692
|
this._assembler = new assemblerType();
|
|
22669
22693
|
this._assembler.initialize(this);
|
|
@@ -22672,89 +22696,80 @@ var DirtyFlag;
|
|
|
22672
22696
|
}
|
|
22673
22697
|
}
|
|
22674
22698
|
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
|
-
}
|
|
22699
|
+
_proto.evaluateValue = function evaluateValue(curve, time, additive) {
|
|
22700
|
+
return additive ? curve._evaluateAdditive(time, this.baseEvaluateData) : curve._evaluate(time, this.baseEvaluateData);
|
|
22693
22701
|
};
|
|
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.
|
|
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);
|
|
22698
22706
|
};
|
|
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.
|
|
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);
|
|
22703
22711
|
};
|
|
22704
22712
|
_proto.revertDefaultValue = function revertDefaultValue() {
|
|
22705
22713
|
this._assembler.setTargetValue(this.defaultValue);
|
|
22706
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
|
+
};
|
|
22707
22723
|
_proto.saveDefaultValue = function saveDefaultValue() {
|
|
22708
|
-
if (this.
|
|
22709
|
-
this.
|
|
22724
|
+
if (this.cureType._isReferenceType) {
|
|
22725
|
+
this.cureType._copyValue(this.referenceTargetValue, this.defaultValue);
|
|
22710
22726
|
} else {
|
|
22711
22727
|
this.defaultValue = this._assembler.getTargetValue();
|
|
22712
22728
|
}
|
|
22713
|
-
this.hasSavedDefaultValue = true;
|
|
22714
22729
|
};
|
|
22715
22730
|
_proto.saveFixedPoseValue = function saveFixedPoseValue() {
|
|
22716
|
-
if (this.
|
|
22717
|
-
this.
|
|
22731
|
+
if (this.cureType._isReferenceType) {
|
|
22732
|
+
this.cureType._copyValue(this.referenceTargetValue, this.fixedPoseValue);
|
|
22718
22733
|
} else {
|
|
22719
22734
|
this.fixedPoseValue = this._assembler.getTargetValue();
|
|
22720
22735
|
}
|
|
22721
22736
|
};
|
|
22722
|
-
_proto.
|
|
22723
|
-
|
|
22724
|
-
|
|
22725
|
-
|
|
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);
|
|
22726
22742
|
} else {
|
|
22727
|
-
this._assembler
|
|
22743
|
+
var assembler = this._assembler;
|
|
22744
|
+
var originValue = assembler.getTargetValue();
|
|
22745
|
+
var additiveValue = cureType._additiveValue(value, weight, originValue);
|
|
22746
|
+
assembler.setTargetValue(additiveValue);
|
|
22728
22747
|
}
|
|
22729
22748
|
} else {
|
|
22730
|
-
if (
|
|
22731
|
-
|
|
22732
|
-
|
|
22749
|
+
if (weight === 1.0) {
|
|
22750
|
+
if (cureType._isReferenceType) {
|
|
22751
|
+
cureType._copyValue(value, this.referenceTargetValue);
|
|
22752
|
+
} else {
|
|
22753
|
+
this._assembler.setTargetValue(value);
|
|
22754
|
+
}
|
|
22733
22755
|
} else {
|
|
22734
|
-
|
|
22735
|
-
|
|
22736
|
-
|
|
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
|
+
}
|
|
22737
22764
|
}
|
|
22738
22765
|
}
|
|
22739
22766
|
};
|
|
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
|
-
}
|
|
22767
|
+
_proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
22768
|
+
if (this.cureType._isReferenceType) {
|
|
22769
|
+
return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
|
|
22756
22770
|
} else {
|
|
22757
|
-
this.
|
|
22771
|
+
this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
|
|
22772
|
+
return this.baseEvaluateData.value;
|
|
22758
22773
|
}
|
|
22759
22774
|
};
|
|
22760
22775
|
AnimationCurveOwner.registerAssembler = function registerAssembler(componentType, property, assemblerType) {
|
|
@@ -22850,9 +22865,24 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22850
22865
|
|
|
22851
22866
|
/**
|
|
22852
22867
|
* @internal
|
|
22853
|
-
*/ var AnimationCurveLayerOwner = function
|
|
22854
|
-
|
|
22855
|
-
|
|
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
|
+
}();
|
|
22856
22886
|
|
|
22857
22887
|
/**
|
|
22858
22888
|
* Associate AnimationCurve and the Entity
|
|
@@ -22867,13 +22897,18 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22867
22897
|
var curveType = this.curve.constructor;
|
|
22868
22898
|
var owner = new AnimationCurveOwner(entity, this.type, this.property, curveType);
|
|
22869
22899
|
curveType._initializeOwner(owner);
|
|
22900
|
+
owner.saveDefaultValue();
|
|
22870
22901
|
return owner;
|
|
22871
22902
|
};
|
|
22872
22903
|
/**
|
|
22873
22904
|
* @internal
|
|
22874
22905
|
*/ _proto._createCurveLayerOwner = function _createCurveLayerOwner(owner) {
|
|
22906
|
+
var curveType = this.curve.constructor;
|
|
22875
22907
|
var layerOwner = new AnimationCurveLayerOwner();
|
|
22876
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();
|
|
22877
22912
|
return layerOwner;
|
|
22878
22913
|
};
|
|
22879
22914
|
/**
|
|
@@ -22961,7 +22996,8 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22961
22996
|
var targetEntity = entity.findByPath(curveData.relativePath);
|
|
22962
22997
|
if (targetEntity) {
|
|
22963
22998
|
var curveOwner = curveData._getTempCurveOwner(targetEntity);
|
|
22964
|
-
curveOwner.
|
|
22999
|
+
var value = curveOwner.evaluateValue(curveData.curve, time, false);
|
|
23000
|
+
curveOwner.applyValue(value, 1, false);
|
|
22965
23001
|
}
|
|
22966
23002
|
}
|
|
22967
23003
|
};
|
|
@@ -23105,6 +23141,7 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
23105
23141
|
break;
|
|
23106
23142
|
}
|
|
23107
23143
|
}
|
|
23144
|
+
evaluateData.value = value;
|
|
23108
23145
|
return value;
|
|
23109
23146
|
};
|
|
23110
23147
|
/**
|
|
@@ -23161,6 +23198,11 @@ exports.AnimationArrayCurve = (_AnimationArrayCurve = /*#__PURE__*/ function(Ani
|
|
|
23161
23198
|
};
|
|
23162
23199
|
/**
|
|
23163
23200
|
* @internal
|
|
23201
|
+
*/ AnimationArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23202
|
+
owner.finalValue = [];
|
|
23203
|
+
};
|
|
23204
|
+
/**
|
|
23205
|
+
* @internal
|
|
23164
23206
|
*/ AnimationArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23165
23207
|
for(var i = 0, n = out.length; i < n; ++i){
|
|
23166
23208
|
var src = srcValue[i];
|
|
@@ -23251,6 +23293,11 @@ exports.AnimationBoolCurve = (_AnimationBoolCurve = /*#__PURE__*/ function(Anima
|
|
|
23251
23293
|
};
|
|
23252
23294
|
/**
|
|
23253
23295
|
* @internal
|
|
23296
|
+
*/ AnimationBoolCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23297
|
+
owner.finalValue = false;
|
|
23298
|
+
};
|
|
23299
|
+
/**
|
|
23300
|
+
* @internal
|
|
23254
23301
|
*/ AnimationBoolCurve._lerpValue = function _lerpValue(srcValue, destValue) {
|
|
23255
23302
|
return destValue;
|
|
23256
23303
|
};
|
|
@@ -23308,6 +23355,11 @@ exports.AnimationColorCurve = (_AnimationColorCurve = /*#__PURE__*/ function(Ani
|
|
|
23308
23355
|
};
|
|
23309
23356
|
/**
|
|
23310
23357
|
* @internal
|
|
23358
|
+
*/ AnimationColorCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23359
|
+
owner.finalValue = new miniprogram.Color();
|
|
23360
|
+
};
|
|
23361
|
+
/**
|
|
23362
|
+
* @internal
|
|
23311
23363
|
*/ AnimationColorCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23312
23364
|
miniprogram.Color.lerp(srcValue, destValue, weight, out);
|
|
23313
23365
|
return out;
|
|
@@ -23414,6 +23466,12 @@ exports.AnimationFloatArrayCurve = (_AnimationFloatArrayCurve = /*#__PURE__*/ fu
|
|
|
23414
23466
|
};
|
|
23415
23467
|
/**
|
|
23416
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
|
|
23417
23475
|
*/ AnimationFloatArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23418
23476
|
for(var i = 0, n = out.length; i < n; ++i){
|
|
23419
23477
|
var src = srcValue[i];
|
|
@@ -23504,6 +23562,11 @@ exports.AnimationFloatCurve = (_AnimationFloatCurve = /*#__PURE__*/ function(Ani
|
|
|
23504
23562
|
};
|
|
23505
23563
|
/**
|
|
23506
23564
|
* @internal
|
|
23565
|
+
*/ AnimationFloatCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23566
|
+
owner.finalValue = 0;
|
|
23567
|
+
};
|
|
23568
|
+
/**
|
|
23569
|
+
* @internal
|
|
23507
23570
|
*/ AnimationFloatCurve._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
23508
23571
|
return srcValue + (destValue - srcValue) * crossWeight;
|
|
23509
23572
|
};
|
|
@@ -23573,6 +23636,11 @@ exports.AnimationQuaternionCurve = (_AnimationQuaternionCurve = /*#__PURE__*/ fu
|
|
|
23573
23636
|
};
|
|
23574
23637
|
/**
|
|
23575
23638
|
* @internal
|
|
23639
|
+
*/ AnimationQuaternionCurve1._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23640
|
+
owner.finalValue = new miniprogram.Quaternion();
|
|
23641
|
+
};
|
|
23642
|
+
/**
|
|
23643
|
+
* @internal
|
|
23576
23644
|
*/ AnimationQuaternionCurve1._lerpValue = function _lerpValue(src, dest, weight, out) {
|
|
23577
23645
|
miniprogram.Quaternion.slerp(src, dest, weight, out);
|
|
23578
23646
|
return out;
|
|
@@ -23677,6 +23745,11 @@ exports.AnimationVector2Curve = (_AnimationVector2Curve = /*#__PURE__*/ function
|
|
|
23677
23745
|
};
|
|
23678
23746
|
/**
|
|
23679
23747
|
* @internal
|
|
23748
|
+
*/ AnimationVector2Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23749
|
+
owner.finalValue = new miniprogram.Vector2();
|
|
23750
|
+
};
|
|
23751
|
+
/**
|
|
23752
|
+
* @internal
|
|
23680
23753
|
*/ AnimationVector2Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23681
23754
|
miniprogram.Vector2.lerp(srcValue, destValue, weight, out);
|
|
23682
23755
|
return out;
|
|
@@ -23762,6 +23835,11 @@ exports.AnimationVector3Curve = (_AnimationVector3Curve = /*#__PURE__*/ function
|
|
|
23762
23835
|
};
|
|
23763
23836
|
/**
|
|
23764
23837
|
* @internal
|
|
23838
|
+
*/ AnimationVector3Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23839
|
+
owner.finalValue = new miniprogram.Vector3();
|
|
23840
|
+
};
|
|
23841
|
+
/**
|
|
23842
|
+
* @internal
|
|
23765
23843
|
*/ AnimationVector3Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23766
23844
|
miniprogram.Vector3.lerp(srcValue, destValue, weight, out);
|
|
23767
23845
|
return out;
|
|
@@ -23859,6 +23937,11 @@ exports.AnimationVector4Curve = (_AnimationVector4Curve = /*#__PURE__*/ function
|
|
|
23859
23937
|
};
|
|
23860
23938
|
/**
|
|
23861
23939
|
* @internal
|
|
23940
|
+
*/ AnimationVector4Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23941
|
+
owner.finalValue = new miniprogram.Vector4();
|
|
23942
|
+
};
|
|
23943
|
+
/**
|
|
23944
|
+
* @internal
|
|
23862
23945
|
*/ AnimationVector4Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23863
23946
|
miniprogram.Vector4.lerp(srcValue, destValue, weight, out);
|
|
23864
23947
|
return out;
|
|
@@ -23968,6 +24051,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23968
24051
|
LayerState[LayerState[/** Playing state. */ "Playing"] = 1] = "Playing";
|
|
23969
24052
|
LayerState[LayerState[/** CrossFading state. */ "CrossFading"] = 2] = "CrossFading";
|
|
23970
24053
|
LayerState[LayerState[/** FixedCrossFading state. */ "FixedCrossFading"] = 3] = "FixedCrossFading";
|
|
24054
|
+
LayerState[LayerState[/** Finished state. */ "Finished"] = 4] = "Finished";
|
|
23971
24055
|
})(LayerState || (LayerState = {}));
|
|
23972
24056
|
|
|
23973
24057
|
/**
|
|
@@ -24044,7 +24128,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24044
24128
|
this.layerState = LayerState.Standby;
|
|
24045
24129
|
this.crossCurveMark = 0;
|
|
24046
24130
|
this.manuallyTransition = new AnimatorStateTransition();
|
|
24047
|
-
this.
|
|
24131
|
+
this.crossLayerOwnerCollection = [];
|
|
24048
24132
|
}
|
|
24049
24133
|
var _proto = AnimatorLayerData.prototype;
|
|
24050
24134
|
_proto.switchPlayData = function switchPlayData() {
|
|
@@ -24074,6 +24158,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24074
24158
|
/** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
|
|
24075
24159
|
_this._animatorLayersData = [];
|
|
24076
24160
|
_this._curveOwnerPool = Object.create(null);
|
|
24161
|
+
_this._needRevertCurveOwners = [];
|
|
24077
24162
|
_this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
|
|
24078
24163
|
_this._tempAnimatorStateInfo = {
|
|
24079
24164
|
layerIndex: -1,
|
|
@@ -24096,7 +24181,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24096
24181
|
this._reset();
|
|
24097
24182
|
}
|
|
24098
24183
|
var stateInfo = this._getAnimatorStateInfo(stateName, layerIndex);
|
|
24099
|
-
var state = stateInfo.state;
|
|
24184
|
+
var state = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
|
|
24100
24185
|
if (!state) {
|
|
24101
24186
|
return;
|
|
24102
24187
|
}
|
|
@@ -24105,8 +24190,8 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24105
24190
|
return;
|
|
24106
24191
|
}
|
|
24107
24192
|
var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
|
|
24108
|
-
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData);
|
|
24109
|
-
this._preparePlay(animatorLayerData, state
|
|
24193
|
+
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData, playLayerIndex);
|
|
24194
|
+
this._preparePlay(animatorLayerData, state);
|
|
24110
24195
|
animatorLayerData.layerState = LayerState.Playing;
|
|
24111
24196
|
animatorLayerData.srcPlayData.reset(state, animatorStateData, state._getDuration() * normalizedTimeOffset);
|
|
24112
24197
|
};
|
|
@@ -24157,6 +24242,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24157
24242
|
return;
|
|
24158
24243
|
}
|
|
24159
24244
|
deltaTime *= this.speed;
|
|
24245
|
+
this._revertCurveOwners();
|
|
24160
24246
|
for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
|
|
24161
24247
|
var animatorLayerData = this._getAnimatorLayerData(i1);
|
|
24162
24248
|
if (animatorLayerData.layerState === LayerState.Standby) {
|
|
@@ -24200,10 +24286,11 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24200
24286
|
var propertyOwners = animationCurveOwners[instanceId];
|
|
24201
24287
|
for(var property in propertyOwners){
|
|
24202
24288
|
var owner = propertyOwners[property];
|
|
24203
|
-
owner.
|
|
24289
|
+
owner.revertDefaultValue();
|
|
24204
24290
|
}
|
|
24205
24291
|
}
|
|
24206
24292
|
this._animatorLayersData.length = 0;
|
|
24293
|
+
this._needRevertCurveOwners.length = 0;
|
|
24207
24294
|
this._curveOwnerPool = {};
|
|
24208
24295
|
this._animationEventHandlerPool.resetPool();
|
|
24209
24296
|
if (this._controllerUpdateFlag) {
|
|
@@ -24231,25 +24318,18 @@ 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
24335
|
var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
|
|
@@ -24261,9 +24341,22 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24261
24341
|
var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
|
|
24262
24342
|
var property = curve.property;
|
|
24263
24343
|
var instanceId = targetEntity.instanceId;
|
|
24344
|
+
var needRevert = false;
|
|
24345
|
+
var baseAnimatorLayerData = this._animatorLayersData[0];
|
|
24346
|
+
var baseLayerCurveOwnerPool = baseAnimatorLayerData.curveOwnerPool;
|
|
24347
|
+
if (this.animatorController.layers[layerIndex].blendingMode === exports.AnimatorLayerBlendingMode.Additive && layerIndex > 0 && !(baseLayerCurveOwnerPool[instanceId] && baseLayerCurveOwnerPool[instanceId][property])) {
|
|
24348
|
+
needRevert = true;
|
|
24349
|
+
}
|
|
24264
24350
|
// Get owner
|
|
24265
24351
|
var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
|
|
24266
24352
|
var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity));
|
|
24353
|
+
//@todo: There is performance waste here, which will be handled together with organizing AnimatorStateData later. The logic is changing from runtime to initialization.
|
|
24354
|
+
if (needRevert) {
|
|
24355
|
+
this._needRevertCurveOwners.push(owner);
|
|
24356
|
+
} else {
|
|
24357
|
+
var index = this._needRevertCurveOwners.indexOf(owner);
|
|
24358
|
+
index > -1 && this._needRevertCurveOwners.splice(index, 1);
|
|
24359
|
+
}
|
|
24267
24360
|
// Get layer owner
|
|
24268
24361
|
var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
|
|
24269
24362
|
var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
|
|
@@ -24297,12 +24390,12 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24297
24390
|
};
|
|
24298
24391
|
_proto._clearCrossData = function _clearCrossData(animatorLayerData) {
|
|
24299
24392
|
animatorLayerData.crossCurveMark++;
|
|
24300
|
-
animatorLayerData.
|
|
24393
|
+
animatorLayerData.crossLayerOwnerCollection.length = 0;
|
|
24301
24394
|
};
|
|
24302
24395
|
_proto._addCrossOwner = function _addCrossOwner(animatorLayerData, layerOwner, curCurveIndex, nextCurveIndex) {
|
|
24303
24396
|
layerOwner.crossSrcCurveIndex = curCurveIndex;
|
|
24304
24397
|
layerOwner.crossDestCurveIndex = nextCurveIndex;
|
|
24305
|
-
animatorLayerData.
|
|
24398
|
+
animatorLayerData.crossLayerOwnerCollection.push(layerOwner);
|
|
24306
24399
|
};
|
|
24307
24400
|
_proto._prepareCrossFading = function _prepareCrossFading(animatorLayerData) {
|
|
24308
24401
|
// Add src cross curve data.
|
|
@@ -24317,10 +24410,10 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24317
24410
|
this._prepareDestCrossData(animatorLayerData, true);
|
|
24318
24411
|
};
|
|
24319
24412
|
_proto._prepareFixedPoseCrossFading = function _prepareFixedPoseCrossFading(animatorLayerData) {
|
|
24320
|
-
var
|
|
24413
|
+
var crossLayerOwnerCollection = animatorLayerData.crossLayerOwnerCollection;
|
|
24321
24414
|
// Save current cross curve data owner fixed pose.
|
|
24322
|
-
for(var i =
|
|
24323
|
-
var layerOwner =
|
|
24415
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
24416
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
24324
24417
|
if (!layerOwner) continue;
|
|
24325
24418
|
layerOwner.curveOwner.saveFixedPoseValue();
|
|
24326
24419
|
// Reset destCurveIndex When fixed pose crossFading again.
|
|
@@ -24348,7 +24441,6 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24348
24441
|
layerOwner.crossDestCurveIndex = i;
|
|
24349
24442
|
} else {
|
|
24350
24443
|
var owner = layerOwner.curveOwner;
|
|
24351
|
-
owner.saveDefaultValue();
|
|
24352
24444
|
saveFixed && owner.saveFixedPoseValue();
|
|
24353
24445
|
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
24354
24446
|
this._addCrossOwner(animatorLayerData, layerOwner, -1, i);
|
|
@@ -24366,7 +24458,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24366
24458
|
var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData, crossFadeTransitionInfo = layerData.crossFadeTransition;
|
|
24367
24459
|
var additive = blendingMode === exports.AnimatorLayerBlendingMode.Additive;
|
|
24368
24460
|
firstLayer && (weight = 1.0);
|
|
24369
|
-
|
|
24461
|
+
//@todo: All situations should be checked, optimizations will follow later.
|
|
24370
24462
|
layerData.layerState !== LayerState.FixedCrossFading && this._checkTransition(srcPlayData, crossFadeTransitionInfo, layerIndex);
|
|
24371
24463
|
switch(layerData.layerState){
|
|
24372
24464
|
case LayerState.Playing:
|
|
@@ -24378,6 +24470,9 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24378
24470
|
case LayerState.CrossFading:
|
|
24379
24471
|
this._updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, deltaTime, additive, aniUpdate);
|
|
24380
24472
|
break;
|
|
24473
|
+
case LayerState.Finished:
|
|
24474
|
+
this._updateFinishedState(srcPlayData, weight, additive, aniUpdate);
|
|
24475
|
+
break;
|
|
24381
24476
|
}
|
|
24382
24477
|
};
|
|
24383
24478
|
_proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
@@ -24385,19 +24480,26 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24385
24480
|
var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
|
|
24386
24481
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
24387
24482
|
playData.update(this.speed < 0);
|
|
24388
|
-
if (!aniUpdate) {
|
|
24389
|
-
return;
|
|
24390
|
-
}
|
|
24391
24483
|
var clipTime = playData.clipTime, playState = playData.playState;
|
|
24392
|
-
|
|
24393
|
-
|
|
24394
|
-
var
|
|
24395
|
-
|
|
24484
|
+
var finished = playState === AnimatorStatePlayState.Finished;
|
|
24485
|
+
if (aniUpdate || finished) {
|
|
24486
|
+
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
24487
|
+
var layerOwner = curveLayerOwner[i];
|
|
24488
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
24489
|
+
if (!owner) continue;
|
|
24490
|
+
var curve = curveBindings[i].curve;
|
|
24491
|
+
if (curve.keys.length) {
|
|
24492
|
+
var value = owner.evaluateValue(curve, clipTime, additive);
|
|
24493
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
24494
|
+
finished && layerOwner.saveFinalValue();
|
|
24495
|
+
}
|
|
24496
|
+
}
|
|
24396
24497
|
}
|
|
24397
24498
|
playData.frameTime += state.speed * delta;
|
|
24398
24499
|
if (playState === AnimatorStatePlayState.Finished) {
|
|
24399
|
-
layerData.layerState = LayerState.
|
|
24500
|
+
layerData.layerState = LayerState.Finished;
|
|
24400
24501
|
}
|
|
24502
|
+
eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
24401
24503
|
if (lastPlayState === AnimatorStatePlayState.UnStarted) {
|
|
24402
24504
|
this._callAnimatorScriptOnEnter(state, layerIndex);
|
|
24403
24505
|
}
|
|
@@ -24408,7 +24510,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24408
24510
|
}
|
|
24409
24511
|
};
|
|
24410
24512
|
_proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
24411
|
-
var
|
|
24513
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
24412
24514
|
var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
|
|
24413
24515
|
var srcState = srcPlayData.state, srcStateData = srcPlayData.stateData, lastSrcPlayState = srcPlayData.playState;
|
|
24414
24516
|
var srcEventHandlers = srcStateData.eventHandlers;
|
|
@@ -24417,18 +24519,27 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24417
24519
|
var _destState_clip = destState.clip, destCurves = _destState_clip._curveBindings;
|
|
24418
24520
|
var lastSrcClipTime = srcPlayData.clipTime;
|
|
24419
24521
|
var lastDestClipTime = destPlayData.clipTime;
|
|
24420
|
-
var
|
|
24421
|
-
crossWeight
|
|
24522
|
+
var duration = destState._getDuration() * layerData.crossFadeTransition.duration;
|
|
24523
|
+
var crossWeight = Math.abs(destPlayData.frameTime) / duration;
|
|
24524
|
+
(crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
|
|
24422
24525
|
srcPlayData.update(this.speed < 0);
|
|
24423
24526
|
destPlayData.update(this.speed < 0);
|
|
24424
|
-
var srcPlayState = srcPlayData.playState;
|
|
24425
|
-
var destPlayState = destPlayData.playState;
|
|
24426
|
-
|
|
24427
|
-
if (
|
|
24428
|
-
|
|
24527
|
+
var srcClipTime = srcPlayData.clipTime, srcPlayState = srcPlayData.playState;
|
|
24528
|
+
var destClipTime = destPlayData.clipTime, destPlayState = destPlayData.playState;
|
|
24529
|
+
var finished = destPlayData.playState === AnimatorStatePlayState.Finished;
|
|
24530
|
+
if (aniUpdate || finished) {
|
|
24531
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
24532
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
24533
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
24534
|
+
if (!owner) continue;
|
|
24535
|
+
var srcCurveIndex = layerOwner.crossSrcCurveIndex;
|
|
24536
|
+
var destCurveIndex = layerOwner.crossDestCurveIndex;
|
|
24537
|
+
var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
|
|
24538
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
24539
|
+
finished && layerOwner.saveFinalValue();
|
|
24540
|
+
}
|
|
24429
24541
|
}
|
|
24430
|
-
|
|
24431
|
-
var destClipTime = destPlayData.clipTime;
|
|
24542
|
+
this._updateCrossFadeData(layerData, crossWeight, delta, false);
|
|
24432
24543
|
srcEventHandlers.length && this._fireAnimationEvents(srcPlayData, srcEventHandlers, lastSrcClipTime, srcClipTime);
|
|
24433
24544
|
destEventHandlers.length && this._fireAnimationEvents(destPlayData, destEventHandlers, lastDestClipTime, destClipTime);
|
|
24434
24545
|
if (lastSrcPlayState === AnimatorStatePlayState.UnStarted) {
|
|
@@ -24447,30 +24558,34 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24447
24558
|
} else {
|
|
24448
24559
|
this._callAnimatorScriptOnUpdate(destState, layerIndex);
|
|
24449
24560
|
}
|
|
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
24561
|
};
|
|
24458
|
-
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex,
|
|
24459
|
-
var
|
|
24562
|
+
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
24563
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
24460
24564
|
var state = destPlayData.state, stateData = destPlayData.stateData, lastPlayState = destPlayData.playState;
|
|
24461
24565
|
var eventHandlers = stateData.eventHandlers;
|
|
24462
24566
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
24463
24567
|
var lastDestClipTime = destPlayData.clipTime;
|
|
24464
|
-
var
|
|
24465
|
-
crossWeight
|
|
24568
|
+
var duration = state._getDuration() * layerData.crossFadeTransition.duration;
|
|
24569
|
+
var crossWeight = Math.abs(destPlayData.frameTime) / duration;
|
|
24570
|
+
(crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
|
|
24466
24571
|
destPlayData.update(this.speed < 0);
|
|
24467
24572
|
var playState = destPlayData.playState;
|
|
24468
24573
|
this._updateCrossFadeData(layerData, crossWeight, delta, true);
|
|
24469
|
-
if (!aniUpdate) {
|
|
24470
|
-
return;
|
|
24471
|
-
}
|
|
24472
24574
|
var destClipTime = destPlayData.clipTime;
|
|
24473
|
-
|
|
24575
|
+
var finished = playState === AnimatorStatePlayState.Finished;
|
|
24576
|
+
// 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.
|
|
24577
|
+
if (aniUpdate || finished) {
|
|
24578
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
24579
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
24580
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
24581
|
+
if (!owner) continue;
|
|
24582
|
+
var curveIndex = layerOwner.crossDestCurveIndex;
|
|
24583
|
+
var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
|
|
24584
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
24585
|
+
finished && layerOwner.saveFinalValue();
|
|
24586
|
+
}
|
|
24587
|
+
}
|
|
24588
|
+
//@todo: srcState is missing the judgment of the most recent period."
|
|
24474
24589
|
eventHandlers.length && this._fireAnimationEvents(destPlayData, eventHandlers, lastDestClipTime, destClipTime);
|
|
24475
24590
|
if (lastPlayState === AnimatorStatePlayState.UnStarted) {
|
|
24476
24591
|
this._callAnimatorScriptOnEnter(state, layerIndex);
|
|
@@ -24480,11 +24595,18 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24480
24595
|
} else {
|
|
24481
24596
|
this._callAnimatorScriptOnUpdate(state, layerIndex);
|
|
24482
24597
|
}
|
|
24483
|
-
|
|
24484
|
-
|
|
24485
|
-
|
|
24486
|
-
|
|
24487
|
-
|
|
24598
|
+
};
|
|
24599
|
+
_proto._updateFinishedState = function _updateFinishedState(playData, weight, additive, aniUpdate) {
|
|
24600
|
+
if (!aniUpdate) {
|
|
24601
|
+
return;
|
|
24602
|
+
}
|
|
24603
|
+
var curveLayerOwner = playData.stateData.curveLayerOwner;
|
|
24604
|
+
var _playData_state_clip = playData.state.clip, curveBindings = _playData_state_clip._curveBindings;
|
|
24605
|
+
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
24606
|
+
var layerOwner = curveLayerOwner[i];
|
|
24607
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
24608
|
+
if (!owner) continue;
|
|
24609
|
+
owner.applyValue(layerOwner.finalValue, weight, additive);
|
|
24488
24610
|
}
|
|
24489
24611
|
};
|
|
24490
24612
|
_proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
|
|
@@ -24492,7 +24614,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24492
24614
|
destPlayData.frameTime += destPlayData.state.speed * delta;
|
|
24493
24615
|
if (crossWeight === 1.0) {
|
|
24494
24616
|
if (destPlayData.playState === AnimatorStatePlayState.Finished) {
|
|
24495
|
-
layerData.layerState = LayerState.
|
|
24617
|
+
layerData.layerState = LayerState.Finished;
|
|
24496
24618
|
} else {
|
|
24497
24619
|
layerData.layerState = LayerState.Playing;
|
|
24498
24620
|
}
|
|
@@ -24502,7 +24624,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24502
24624
|
fixed || (layerData.srcPlayData.frameTime += layerData.srcPlayData.state.speed * delta);
|
|
24503
24625
|
}
|
|
24504
24626
|
};
|
|
24505
|
-
_proto._preparePlay = function _preparePlay(layerData, playState
|
|
24627
|
+
_proto._preparePlay = function _preparePlay(layerData, playState) {
|
|
24506
24628
|
if (layerData.layerState === LayerState.Playing) {
|
|
24507
24629
|
var srcPlayData = layerData.srcPlayData;
|
|
24508
24630
|
if (srcPlayData.state !== playState) {
|
|
@@ -24510,18 +24632,16 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24510
24632
|
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24511
24633
|
var _curveLayerOwner_i;
|
|
24512
24634
|
var owner = (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner;
|
|
24513
|
-
|
|
24635
|
+
owner.revertDefaultValue();
|
|
24514
24636
|
}
|
|
24515
|
-
this._saveDefaultValues(playStateData);
|
|
24516
24637
|
}
|
|
24517
24638
|
} else {
|
|
24518
|
-
// layerState is CrossFading, FixedCrossFading, Standby
|
|
24519
|
-
var
|
|
24520
|
-
for(var i1 =
|
|
24521
|
-
var owner1 =
|
|
24522
|
-
owner1.
|
|
24639
|
+
// layerState is CrossFading, FixedCrossFading, Standby, Finished
|
|
24640
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
24641
|
+
for(var i1 = crossLayerOwnerCollection.length - 1; i1 >= 0; i1--){
|
|
24642
|
+
var owner1 = crossLayerOwnerCollection[i1].curveOwner;
|
|
24643
|
+
owner1.revertDefaultValue();
|
|
24523
24644
|
}
|
|
24524
|
-
this._saveDefaultValues(playStateData);
|
|
24525
24645
|
}
|
|
24526
24646
|
};
|
|
24527
24647
|
_proto._checkTransition = function _checkTransition(stateData, crossFadeTransition, layerIndex) {
|
|
@@ -24538,7 +24658,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24538
24658
|
_proto._crossFadeByTransition = function _crossFadeByTransition(transition, layerIndex) {
|
|
24539
24659
|
var name = transition.destinationState.name;
|
|
24540
24660
|
var stateInfo = this._getAnimatorStateInfo(name, layerIndex);
|
|
24541
|
-
var crossState = stateInfo.state;
|
|
24661
|
+
var crossState = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
|
|
24542
24662
|
if (!crossState) {
|
|
24543
24663
|
return;
|
|
24544
24664
|
}
|
|
@@ -24546,21 +24666,21 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24546
24666
|
console.warn("The state named " + name + " has no AnimationClip data.");
|
|
24547
24667
|
return;
|
|
24548
24668
|
}
|
|
24549
|
-
var animatorLayerData = this._getAnimatorLayerData(
|
|
24669
|
+
var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
|
|
24550
24670
|
var layerState = animatorLayerData.layerState;
|
|
24551
24671
|
var destPlayData = animatorLayerData.destPlayData;
|
|
24552
|
-
var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData);
|
|
24672
|
+
var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData, playLayerIndex);
|
|
24553
24673
|
var duration = crossState._getDuration();
|
|
24554
24674
|
var offset = duration * transition.offset;
|
|
24555
24675
|
destPlayData.reset(crossState, animatorStateData, offset);
|
|
24556
24676
|
switch(layerState){
|
|
24557
|
-
// Maybe not play, maybe end.
|
|
24558
24677
|
case LayerState.Standby:
|
|
24559
24678
|
animatorLayerData.layerState = LayerState.FixedCrossFading;
|
|
24560
24679
|
this._clearCrossData(animatorLayerData);
|
|
24561
24680
|
this._prepareStandbyCrossFading(animatorLayerData);
|
|
24562
24681
|
break;
|
|
24563
24682
|
case LayerState.Playing:
|
|
24683
|
+
case LayerState.Finished:
|
|
24564
24684
|
animatorLayerData.layerState = LayerState.CrossFading;
|
|
24565
24685
|
this._clearCrossData(animatorLayerData);
|
|
24566
24686
|
this._prepareCrossFading(animatorLayerData);
|
|
@@ -24657,6 +24777,12 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24657
24777
|
}
|
|
24658
24778
|
}
|
|
24659
24779
|
};
|
|
24780
|
+
_proto._revertCurveOwners = function _revertCurveOwners() {
|
|
24781
|
+
var curveOwners = this._needRevertCurveOwners;
|
|
24782
|
+
for(var i = 0, n = curveOwners.length; i < n; ++i){
|
|
24783
|
+
curveOwners[i].revertDefaultValue();
|
|
24784
|
+
}
|
|
24785
|
+
};
|
|
24660
24786
|
_create_class(Animator, [
|
|
24661
24787
|
{
|
|
24662
24788
|
key: "animatorController",
|
|
@@ -24689,6 +24815,9 @@ __decorate([
|
|
|
24689
24815
|
__decorate([
|
|
24690
24816
|
ignoreClone
|
|
24691
24817
|
], Animator.prototype, "_curveOwnerPool", void 0);
|
|
24818
|
+
__decorate([
|
|
24819
|
+
ignoreClone
|
|
24820
|
+
], Animator.prototype, "_needRevertCurveOwners", void 0);
|
|
24692
24821
|
__decorate([
|
|
24693
24822
|
ignoreClone
|
|
24694
24823
|
], Animator.prototype, "_animationEventHandlerPool", void 0);
|