@galacean/engine-core 1.0.0-beta.11 → 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 +310 -163
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +310 -163
- package/dist/module.js +311 -164
- 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/texture/Texture.d.ts +6 -0
- package/types/texture/Texture2D.d.ts +3 -1
- package/types/texture/enums/TextureUsage.d.ts +9 -0
- package/types/texture/index.d.ts +1 -0
- 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
|
@@ -799,6 +799,14 @@ __decorate([
|
|
|
799
799
|
TextureFormat[TextureFormat[/** 32-bit depth + 8-bit stencil format. */ "Depth32Stencil8"] = 31] = "Depth32Stencil8";
|
|
800
800
|
})(exports.TextureFormat || (exports.TextureFormat = {}));
|
|
801
801
|
|
|
802
|
+
/**
|
|
803
|
+
* Texture usage.
|
|
804
|
+
*/ exports.TextureUsage = void 0;
|
|
805
|
+
(function(TextureUsage) {
|
|
806
|
+
TextureUsage[TextureUsage[/** The content of the texture is intended to be specified once. */ "Static"] = 0] = "Static";
|
|
807
|
+
TextureUsage[TextureUsage[/** The content of the texture is intended to be updated frequently, with better performance. */ "Dynamic"] = 1] = "Dynamic";
|
|
808
|
+
})(exports.TextureUsage || (exports.TextureUsage = {}));
|
|
809
|
+
|
|
802
810
|
/**
|
|
803
811
|
* Wrapping mode of the texture.
|
|
804
812
|
*/ exports.TextureWrapMode = void 0;
|
|
@@ -939,6 +947,14 @@ var Logger = {
|
|
|
939
947
|
return this._height;
|
|
940
948
|
}
|
|
941
949
|
},
|
|
950
|
+
{
|
|
951
|
+
key: "usage",
|
|
952
|
+
get: /**
|
|
953
|
+
* The usage of the texture.
|
|
954
|
+
*/ function get() {
|
|
955
|
+
return this._usage;
|
|
956
|
+
}
|
|
957
|
+
},
|
|
942
958
|
{
|
|
943
959
|
key: "wrapModeU",
|
|
944
960
|
get: /**
|
|
@@ -1182,14 +1198,16 @@ var Logger = {
|
|
|
1182
1198
|
* Two-dimensional texture.
|
|
1183
1199
|
*/ var Texture2D = /*#__PURE__*/ function(Texture) {
|
|
1184
1200
|
_inherits(Texture2D, Texture);
|
|
1185
|
-
function Texture2D(engine, width, height, format, mipmap) {
|
|
1201
|
+
function Texture2D(engine, width, height, format, mipmap, usage) {
|
|
1186
1202
|
if (format === void 0) format = exports.TextureFormat.R8G8B8A8;
|
|
1187
1203
|
if (mipmap === void 0) mipmap = true;
|
|
1204
|
+
if (usage === void 0) usage = exports.TextureUsage.Static;
|
|
1188
1205
|
var _this;
|
|
1189
1206
|
_this = Texture.call(this, engine) || this;
|
|
1190
1207
|
_this._mipmap = mipmap;
|
|
1191
1208
|
_this._width = width;
|
|
1192
1209
|
_this._height = height;
|
|
1210
|
+
_this._usage = usage;
|
|
1193
1211
|
_this._format = format;
|
|
1194
1212
|
_this._mipmapCount = _this._getMipmapCount();
|
|
1195
1213
|
_this._isDepthTexture = format == exports.TextureFormat.Depth || format == exports.TextureFormat.DepthStencil || format == exports.TextureFormat.Depth16 || format == exports.TextureFormat.Depth24 || format == exports.TextureFormat.Depth32 || format == exports.TextureFormat.Depth24Stencil8 || format == exports.TextureFormat.Depth32Stencil8;
|
|
@@ -2289,29 +2307,7 @@ var /** @internal */ PromiseState;
|
|
|
2289
2307
|
* @remarks The release principle is that it is not referenced by the components, including direct and indirect reference.
|
|
2290
2308
|
*/ _proto.gc = function gc() {
|
|
2291
2309
|
this._gc(false);
|
|
2292
|
-
|
|
2293
|
-
engine._renderElementPool.garbageCollection();
|
|
2294
|
-
engine._meshRenderDataPool.garbageCollection();
|
|
2295
|
-
engine._spriteRenderDataPool.garbageCollection();
|
|
2296
|
-
engine._spriteMaskRenderDataPool.garbageCollection();
|
|
2297
|
-
engine._textRenderDataPool.garbageCollection();
|
|
2298
|
-
var _componentsManager = engine._componentsManager, _lightManager = engine._lightManager;
|
|
2299
|
-
_componentsManager._renderers.garbageCollection();
|
|
2300
|
-
// @ts-ignore
|
|
2301
|
-
_componentsManager._onStartScripts.garbageCollection();
|
|
2302
|
-
// @ts-ignore
|
|
2303
|
-
_componentsManager._onUpdateScripts.garbageCollection();
|
|
2304
|
-
// @ts-ignore
|
|
2305
|
-
_componentsManager._onLateUpdateScripts.garbageCollection();
|
|
2306
|
-
// @ts-ignore
|
|
2307
|
-
_componentsManager._onPhysicsUpdateScripts.garbageCollection();
|
|
2308
|
-
// @ts-ignore
|
|
2309
|
-
_componentsManager._onUpdateAnimations.garbageCollection();
|
|
2310
|
-
// @ts-ignore
|
|
2311
|
-
_componentsManager._onUpdateRenderers.garbageCollection();
|
|
2312
|
-
_lightManager._spotLights.garbageCollection();
|
|
2313
|
-
_lightManager._pointLights.garbageCollection();
|
|
2314
|
-
_lightManager._directLights.garbageCollection();
|
|
2310
|
+
this.engine._pendingGC();
|
|
2315
2311
|
};
|
|
2316
2312
|
/**
|
|
2317
2313
|
* Add content restorer.
|
|
@@ -3237,6 +3233,17 @@ exports.GLCapabilityType = void 0;
|
|
|
3237
3233
|
componentContainer.length = 0;
|
|
3238
3234
|
this._componentsContainerPool.push(componentContainer);
|
|
3239
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
|
+
};
|
|
3240
3247
|
return ComponentsManager;
|
|
3241
3248
|
}();
|
|
3242
3249
|
|
|
@@ -5868,6 +5875,11 @@ var Collision = function Collision() {
|
|
|
5868
5875
|
elements[i]._onLateUpdate();
|
|
5869
5876
|
}
|
|
5870
5877
|
};
|
|
5878
|
+
/**
|
|
5879
|
+
* @internal
|
|
5880
|
+
*/ _proto._gc = function _gc() {
|
|
5881
|
+
this._colliders.garbageCollection();
|
|
5882
|
+
};
|
|
5871
5883
|
_proto._setGravity = function _setGravity() {
|
|
5872
5884
|
this._nativePhysicsManager.setGravity(this._gravity);
|
|
5873
5885
|
};
|
|
@@ -8445,6 +8457,13 @@ __decorate([
|
|
|
8445
8457
|
shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
|
|
8446
8458
|
}
|
|
8447
8459
|
};
|
|
8460
|
+
/**
|
|
8461
|
+
* @internal
|
|
8462
|
+
*/ _proto._gc = function _gc() {
|
|
8463
|
+
this._spotLights.garbageCollection();
|
|
8464
|
+
this._pointLights.garbageCollection();
|
|
8465
|
+
this._directLights.garbageCollection();
|
|
8466
|
+
};
|
|
8448
8467
|
return LightManager;
|
|
8449
8468
|
}();
|
|
8450
8469
|
|
|
@@ -16894,6 +16913,7 @@ ShaderPool.init();
|
|
|
16894
16913
|
_this._frameInProcess = false;
|
|
16895
16914
|
_this._waitingDestroy = false;
|
|
16896
16915
|
_this._isDeviceLost = false;
|
|
16916
|
+
_this._waitingGC = false;
|
|
16897
16917
|
_this._animate = function() {
|
|
16898
16918
|
if (_this._vSyncCount) {
|
|
16899
16919
|
_this._requestId = engineMiniprogramAdapter.requestAnimationFrame(_this._animate);
|
|
@@ -16997,6 +17017,10 @@ ShaderPool.init();
|
|
|
16997
17017
|
if (this._waitingDestroy) {
|
|
16998
17018
|
this._destroy();
|
|
16999
17019
|
}
|
|
17020
|
+
if (this._waitingGC) {
|
|
17021
|
+
this._gc();
|
|
17022
|
+
this._waitingGC = false;
|
|
17023
|
+
}
|
|
17000
17024
|
this._frameInProcess = false;
|
|
17001
17025
|
};
|
|
17002
17026
|
/**
|
|
@@ -17155,6 +17179,15 @@ ShaderPool.init();
|
|
|
17155
17179
|
};
|
|
17156
17180
|
/**
|
|
17157
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
|
|
17158
17191
|
*/ _proto._initialize = function _initialize(configuration) {
|
|
17159
17192
|
var _this = this;
|
|
17160
17193
|
var physics = configuration.physics;
|
|
@@ -17217,6 +17250,16 @@ ShaderPool.init();
|
|
|
17217
17250
|
console.error(error);
|
|
17218
17251
|
});
|
|
17219
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
|
+
};
|
|
17220
17263
|
_create_class(Engine, [
|
|
17221
17264
|
{
|
|
17222
17265
|
key: "settings",
|
|
@@ -22632,7 +22675,6 @@ var DirtyFlag;
|
|
|
22632
22675
|
* @internal
|
|
22633
22676
|
*/ var AnimationCurveOwner = /*#__PURE__*/ function() {
|
|
22634
22677
|
function AnimationCurveOwner(target, type, property, cureType) {
|
|
22635
|
-
this.hasSavedDefaultValue = false;
|
|
22636
22678
|
this.baseEvaluateData = {
|
|
22637
22679
|
curKeyframeIndex: 0,
|
|
22638
22680
|
value: null
|
|
@@ -22645,7 +22687,7 @@ var DirtyFlag;
|
|
|
22645
22687
|
this.type = type;
|
|
22646
22688
|
this.property = property;
|
|
22647
22689
|
this.component = target.getComponent(type);
|
|
22648
|
-
this.
|
|
22690
|
+
this.cureType = cureType;
|
|
22649
22691
|
var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
|
|
22650
22692
|
this._assembler = new assemblerType();
|
|
22651
22693
|
this._assembler.initialize(this);
|
|
@@ -22654,89 +22696,80 @@ var DirtyFlag;
|
|
|
22654
22696
|
}
|
|
22655
22697
|
}
|
|
22656
22698
|
var _proto = AnimationCurveOwner.prototype;
|
|
22657
|
-
_proto.
|
|
22658
|
-
|
|
22659
|
-
if (additive) {
|
|
22660
|
-
var value = curve._evaluateAdditive(time, this.baseEvaluateData);
|
|
22661
|
-
var cureType = this._cureType;
|
|
22662
|
-
if (cureType._isReferenceType) {
|
|
22663
|
-
cureType._additiveValue(value, layerWeight, this.referenceTargetValue);
|
|
22664
|
-
} else {
|
|
22665
|
-
var assembler = this._assembler;
|
|
22666
|
-
var originValue = assembler.getTargetValue();
|
|
22667
|
-
var additiveValue = cureType._additiveValue(value, layerWeight, originValue);
|
|
22668
|
-
assembler.setTargetValue(additiveValue);
|
|
22669
|
-
}
|
|
22670
|
-
} else {
|
|
22671
|
-
var value1 = curve._evaluate(time, this.baseEvaluateData);
|
|
22672
|
-
this._applyValue(value1, layerWeight);
|
|
22673
|
-
}
|
|
22674
|
-
}
|
|
22699
|
+
_proto.evaluateValue = function evaluateValue(curve, time, additive) {
|
|
22700
|
+
return additive ? curve._evaluateAdditive(time, this.baseEvaluateData) : curve._evaluate(time, this.baseEvaluateData);
|
|
22675
22701
|
};
|
|
22676
|
-
_proto.
|
|
22677
|
-
var srcValue = srcCurve && srcCurve.keys.length ? additive ? srcCurve._evaluateAdditive(srcTime, this.baseEvaluateData) : srcCurve._evaluate(srcTime, this.baseEvaluateData) : additive ? this.
|
|
22678
|
-
var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.
|
|
22679
|
-
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);
|
|
22680
22706
|
};
|
|
22681
|
-
_proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight,
|
|
22682
|
-
var srcValue = additive ? this.
|
|
22683
|
-
var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.
|
|
22684
|
-
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);
|
|
22685
22711
|
};
|
|
22686
22712
|
_proto.revertDefaultValue = function revertDefaultValue() {
|
|
22687
22713
|
this._assembler.setTargetValue(this.defaultValue);
|
|
22688
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
|
+
};
|
|
22689
22723
|
_proto.saveDefaultValue = function saveDefaultValue() {
|
|
22690
|
-
if (this.
|
|
22691
|
-
this.
|
|
22724
|
+
if (this.cureType._isReferenceType) {
|
|
22725
|
+
this.cureType._copyValue(this.referenceTargetValue, this.defaultValue);
|
|
22692
22726
|
} else {
|
|
22693
22727
|
this.defaultValue = this._assembler.getTargetValue();
|
|
22694
22728
|
}
|
|
22695
|
-
this.hasSavedDefaultValue = true;
|
|
22696
22729
|
};
|
|
22697
22730
|
_proto.saveFixedPoseValue = function saveFixedPoseValue() {
|
|
22698
|
-
if (this.
|
|
22699
|
-
this.
|
|
22731
|
+
if (this.cureType._isReferenceType) {
|
|
22732
|
+
this.cureType._copyValue(this.referenceTargetValue, this.fixedPoseValue);
|
|
22700
22733
|
} else {
|
|
22701
22734
|
this.fixedPoseValue = this._assembler.getTargetValue();
|
|
22702
22735
|
}
|
|
22703
22736
|
};
|
|
22704
|
-
_proto.
|
|
22705
|
-
|
|
22706
|
-
|
|
22707
|
-
|
|
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);
|
|
22708
22742
|
} else {
|
|
22709
|
-
this._assembler
|
|
22743
|
+
var assembler = this._assembler;
|
|
22744
|
+
var originValue = assembler.getTargetValue();
|
|
22745
|
+
var additiveValue = cureType._additiveValue(value, weight, originValue);
|
|
22746
|
+
assembler.setTargetValue(additiveValue);
|
|
22710
22747
|
}
|
|
22711
22748
|
} else {
|
|
22712
|
-
if (
|
|
22713
|
-
|
|
22714
|
-
|
|
22749
|
+
if (weight === 1.0) {
|
|
22750
|
+
if (cureType._isReferenceType) {
|
|
22751
|
+
cureType._copyValue(value, this.referenceTargetValue);
|
|
22752
|
+
} else {
|
|
22753
|
+
this._assembler.setTargetValue(value);
|
|
22754
|
+
}
|
|
22715
22755
|
} else {
|
|
22716
|
-
|
|
22717
|
-
|
|
22718
|
-
|
|
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
|
+
}
|
|
22719
22764
|
}
|
|
22720
22765
|
}
|
|
22721
22766
|
};
|
|
22722
|
-
_proto.
|
|
22723
|
-
|
|
22724
|
-
|
|
22725
|
-
out = this.baseEvaluateData.value;
|
|
22726
|
-
this._cureType._lerpValue(srcValue, destValue, crossWeight, out);
|
|
22727
|
-
} else {
|
|
22728
|
-
out = this._cureType._lerpValue(srcValue, destValue, crossWeight);
|
|
22729
|
-
}
|
|
22730
|
-
if (additive) {
|
|
22731
|
-
if (this._cureType._isReferenceType) {
|
|
22732
|
-
this._cureType._additiveValue(out, layerWeight, this.referenceTargetValue);
|
|
22733
|
-
} else {
|
|
22734
|
-
var originValue = this._assembler.getTargetValue();
|
|
22735
|
-
var lerpValue = this._cureType._additiveValue(out, layerWeight, originValue);
|
|
22736
|
-
this._assembler.setTargetValue(lerpValue);
|
|
22737
|
-
}
|
|
22767
|
+
_proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
22768
|
+
if (this.cureType._isReferenceType) {
|
|
22769
|
+
return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
|
|
22738
22770
|
} else {
|
|
22739
|
-
this.
|
|
22771
|
+
this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
|
|
22772
|
+
return this.baseEvaluateData.value;
|
|
22740
22773
|
}
|
|
22741
22774
|
};
|
|
22742
22775
|
AnimationCurveOwner.registerAssembler = function registerAssembler(componentType, property, assemblerType) {
|
|
@@ -22832,9 +22865,24 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22832
22865
|
|
|
22833
22866
|
/**
|
|
22834
22867
|
* @internal
|
|
22835
|
-
*/ var AnimationCurveLayerOwner = function
|
|
22836
|
-
|
|
22837
|
-
|
|
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
|
+
}();
|
|
22838
22886
|
|
|
22839
22887
|
/**
|
|
22840
22888
|
* Associate AnimationCurve and the Entity
|
|
@@ -22849,13 +22897,18 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22849
22897
|
var curveType = this.curve.constructor;
|
|
22850
22898
|
var owner = new AnimationCurveOwner(entity, this.type, this.property, curveType);
|
|
22851
22899
|
curveType._initializeOwner(owner);
|
|
22900
|
+
owner.saveDefaultValue();
|
|
22852
22901
|
return owner;
|
|
22853
22902
|
};
|
|
22854
22903
|
/**
|
|
22855
22904
|
* @internal
|
|
22856
22905
|
*/ _proto._createCurveLayerOwner = function _createCurveLayerOwner(owner) {
|
|
22906
|
+
var curveType = this.curve.constructor;
|
|
22857
22907
|
var layerOwner = new AnimationCurveLayerOwner();
|
|
22858
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();
|
|
22859
22912
|
return layerOwner;
|
|
22860
22913
|
};
|
|
22861
22914
|
/**
|
|
@@ -22943,7 +22996,8 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22943
22996
|
var targetEntity = entity.findByPath(curveData.relativePath);
|
|
22944
22997
|
if (targetEntity) {
|
|
22945
22998
|
var curveOwner = curveData._getTempCurveOwner(targetEntity);
|
|
22946
|
-
curveOwner.
|
|
22999
|
+
var value = curveOwner.evaluateValue(curveData.curve, time, false);
|
|
23000
|
+
curveOwner.applyValue(value, 1, false);
|
|
22947
23001
|
}
|
|
22948
23002
|
}
|
|
22949
23003
|
};
|
|
@@ -23087,6 +23141,7 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
23087
23141
|
break;
|
|
23088
23142
|
}
|
|
23089
23143
|
}
|
|
23144
|
+
evaluateData.value = value;
|
|
23090
23145
|
return value;
|
|
23091
23146
|
};
|
|
23092
23147
|
/**
|
|
@@ -23143,6 +23198,11 @@ exports.AnimationArrayCurve = (_AnimationArrayCurve = /*#__PURE__*/ function(Ani
|
|
|
23143
23198
|
};
|
|
23144
23199
|
/**
|
|
23145
23200
|
* @internal
|
|
23201
|
+
*/ AnimationArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23202
|
+
owner.finalValue = [];
|
|
23203
|
+
};
|
|
23204
|
+
/**
|
|
23205
|
+
* @internal
|
|
23146
23206
|
*/ AnimationArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23147
23207
|
for(var i = 0, n = out.length; i < n; ++i){
|
|
23148
23208
|
var src = srcValue[i];
|
|
@@ -23233,6 +23293,11 @@ exports.AnimationBoolCurve = (_AnimationBoolCurve = /*#__PURE__*/ function(Anima
|
|
|
23233
23293
|
};
|
|
23234
23294
|
/**
|
|
23235
23295
|
* @internal
|
|
23296
|
+
*/ AnimationBoolCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23297
|
+
owner.finalValue = false;
|
|
23298
|
+
};
|
|
23299
|
+
/**
|
|
23300
|
+
* @internal
|
|
23236
23301
|
*/ AnimationBoolCurve._lerpValue = function _lerpValue(srcValue, destValue) {
|
|
23237
23302
|
return destValue;
|
|
23238
23303
|
};
|
|
@@ -23290,6 +23355,11 @@ exports.AnimationColorCurve = (_AnimationColorCurve = /*#__PURE__*/ function(Ani
|
|
|
23290
23355
|
};
|
|
23291
23356
|
/**
|
|
23292
23357
|
* @internal
|
|
23358
|
+
*/ AnimationColorCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23359
|
+
owner.finalValue = new miniprogram.Color();
|
|
23360
|
+
};
|
|
23361
|
+
/**
|
|
23362
|
+
* @internal
|
|
23293
23363
|
*/ AnimationColorCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23294
23364
|
miniprogram.Color.lerp(srcValue, destValue, weight, out);
|
|
23295
23365
|
return out;
|
|
@@ -23396,6 +23466,12 @@ exports.AnimationFloatArrayCurve = (_AnimationFloatArrayCurve = /*#__PURE__*/ fu
|
|
|
23396
23466
|
};
|
|
23397
23467
|
/**
|
|
23398
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
|
|
23399
23475
|
*/ AnimationFloatArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23400
23476
|
for(var i = 0, n = out.length; i < n; ++i){
|
|
23401
23477
|
var src = srcValue[i];
|
|
@@ -23486,6 +23562,11 @@ exports.AnimationFloatCurve = (_AnimationFloatCurve = /*#__PURE__*/ function(Ani
|
|
|
23486
23562
|
};
|
|
23487
23563
|
/**
|
|
23488
23564
|
* @internal
|
|
23565
|
+
*/ AnimationFloatCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23566
|
+
owner.finalValue = 0;
|
|
23567
|
+
};
|
|
23568
|
+
/**
|
|
23569
|
+
* @internal
|
|
23489
23570
|
*/ AnimationFloatCurve._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
23490
23571
|
return srcValue + (destValue - srcValue) * crossWeight;
|
|
23491
23572
|
};
|
|
@@ -23555,6 +23636,11 @@ exports.AnimationQuaternionCurve = (_AnimationQuaternionCurve = /*#__PURE__*/ fu
|
|
|
23555
23636
|
};
|
|
23556
23637
|
/**
|
|
23557
23638
|
* @internal
|
|
23639
|
+
*/ AnimationQuaternionCurve1._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23640
|
+
owner.finalValue = new miniprogram.Quaternion();
|
|
23641
|
+
};
|
|
23642
|
+
/**
|
|
23643
|
+
* @internal
|
|
23558
23644
|
*/ AnimationQuaternionCurve1._lerpValue = function _lerpValue(src, dest, weight, out) {
|
|
23559
23645
|
miniprogram.Quaternion.slerp(src, dest, weight, out);
|
|
23560
23646
|
return out;
|
|
@@ -23659,6 +23745,11 @@ exports.AnimationVector2Curve = (_AnimationVector2Curve = /*#__PURE__*/ function
|
|
|
23659
23745
|
};
|
|
23660
23746
|
/**
|
|
23661
23747
|
* @internal
|
|
23748
|
+
*/ AnimationVector2Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23749
|
+
owner.finalValue = new miniprogram.Vector2();
|
|
23750
|
+
};
|
|
23751
|
+
/**
|
|
23752
|
+
* @internal
|
|
23662
23753
|
*/ AnimationVector2Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23663
23754
|
miniprogram.Vector2.lerp(srcValue, destValue, weight, out);
|
|
23664
23755
|
return out;
|
|
@@ -23744,6 +23835,11 @@ exports.AnimationVector3Curve = (_AnimationVector3Curve = /*#__PURE__*/ function
|
|
|
23744
23835
|
};
|
|
23745
23836
|
/**
|
|
23746
23837
|
* @internal
|
|
23838
|
+
*/ AnimationVector3Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23839
|
+
owner.finalValue = new miniprogram.Vector3();
|
|
23840
|
+
};
|
|
23841
|
+
/**
|
|
23842
|
+
* @internal
|
|
23747
23843
|
*/ AnimationVector3Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23748
23844
|
miniprogram.Vector3.lerp(srcValue, destValue, weight, out);
|
|
23749
23845
|
return out;
|
|
@@ -23841,6 +23937,11 @@ exports.AnimationVector4Curve = (_AnimationVector4Curve = /*#__PURE__*/ function
|
|
|
23841
23937
|
};
|
|
23842
23938
|
/**
|
|
23843
23939
|
* @internal
|
|
23940
|
+
*/ AnimationVector4Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
23941
|
+
owner.finalValue = new miniprogram.Vector4();
|
|
23942
|
+
};
|
|
23943
|
+
/**
|
|
23944
|
+
* @internal
|
|
23844
23945
|
*/ AnimationVector4Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
23845
23946
|
miniprogram.Vector4.lerp(srcValue, destValue, weight, out);
|
|
23846
23947
|
return out;
|
|
@@ -23950,6 +24051,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23950
24051
|
LayerState[LayerState[/** Playing state. */ "Playing"] = 1] = "Playing";
|
|
23951
24052
|
LayerState[LayerState[/** CrossFading state. */ "CrossFading"] = 2] = "CrossFading";
|
|
23952
24053
|
LayerState[LayerState[/** FixedCrossFading state. */ "FixedCrossFading"] = 3] = "FixedCrossFading";
|
|
24054
|
+
LayerState[LayerState[/** Finished state. */ "Finished"] = 4] = "Finished";
|
|
23953
24055
|
})(LayerState || (LayerState = {}));
|
|
23954
24056
|
|
|
23955
24057
|
/**
|
|
@@ -24026,7 +24128,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24026
24128
|
this.layerState = LayerState.Standby;
|
|
24027
24129
|
this.crossCurveMark = 0;
|
|
24028
24130
|
this.manuallyTransition = new AnimatorStateTransition();
|
|
24029
|
-
this.
|
|
24131
|
+
this.crossLayerOwnerCollection = [];
|
|
24030
24132
|
}
|
|
24031
24133
|
var _proto = AnimatorLayerData.prototype;
|
|
24032
24134
|
_proto.switchPlayData = function switchPlayData() {
|
|
@@ -24056,6 +24158,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24056
24158
|
/** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
|
|
24057
24159
|
_this._animatorLayersData = [];
|
|
24058
24160
|
_this._curveOwnerPool = Object.create(null);
|
|
24161
|
+
_this._needRevertCurveOwners = [];
|
|
24059
24162
|
_this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
|
|
24060
24163
|
_this._tempAnimatorStateInfo = {
|
|
24061
24164
|
layerIndex: -1,
|
|
@@ -24078,7 +24181,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24078
24181
|
this._reset();
|
|
24079
24182
|
}
|
|
24080
24183
|
var stateInfo = this._getAnimatorStateInfo(stateName, layerIndex);
|
|
24081
|
-
var state = stateInfo.state;
|
|
24184
|
+
var state = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
|
|
24082
24185
|
if (!state) {
|
|
24083
24186
|
return;
|
|
24084
24187
|
}
|
|
@@ -24087,8 +24190,8 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24087
24190
|
return;
|
|
24088
24191
|
}
|
|
24089
24192
|
var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
|
|
24090
|
-
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData);
|
|
24091
|
-
this._preparePlay(animatorLayerData, state
|
|
24193
|
+
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData, playLayerIndex);
|
|
24194
|
+
this._preparePlay(animatorLayerData, state);
|
|
24092
24195
|
animatorLayerData.layerState = LayerState.Playing;
|
|
24093
24196
|
animatorLayerData.srcPlayData.reset(state, animatorStateData, state._getDuration() * normalizedTimeOffset);
|
|
24094
24197
|
};
|
|
@@ -24139,6 +24242,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24139
24242
|
return;
|
|
24140
24243
|
}
|
|
24141
24244
|
deltaTime *= this.speed;
|
|
24245
|
+
this._revertCurveOwners();
|
|
24142
24246
|
for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
|
|
24143
24247
|
var animatorLayerData = this._getAnimatorLayerData(i1);
|
|
24144
24248
|
if (animatorLayerData.layerState === LayerState.Standby) {
|
|
@@ -24182,10 +24286,11 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24182
24286
|
var propertyOwners = animationCurveOwners[instanceId];
|
|
24183
24287
|
for(var property in propertyOwners){
|
|
24184
24288
|
var owner = propertyOwners[property];
|
|
24185
|
-
owner.
|
|
24289
|
+
owner.revertDefaultValue();
|
|
24186
24290
|
}
|
|
24187
24291
|
}
|
|
24188
24292
|
this._animatorLayersData.length = 0;
|
|
24293
|
+
this._needRevertCurveOwners.length = 0;
|
|
24189
24294
|
this._curveOwnerPool = {};
|
|
24190
24295
|
this._animationEventHandlerPool.resetPool();
|
|
24191
24296
|
if (this._controllerUpdateFlag) {
|
|
@@ -24213,25 +24318,18 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24213
24318
|
stateInfo.state = state;
|
|
24214
24319
|
return stateInfo;
|
|
24215
24320
|
};
|
|
24216
|
-
_proto.
|
|
24217
|
-
var curveLayerOwner = stateData.curveLayerOwner;
|
|
24218
|
-
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24219
|
-
var _curveLayerOwner_i;
|
|
24220
|
-
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.saveDefaultValue();
|
|
24221
|
-
}
|
|
24222
|
-
};
|
|
24223
|
-
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData) {
|
|
24321
|
+
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData, layerIndex) {
|
|
24224
24322
|
var animatorStateDataMap = animatorLayerData.animatorStateDataMap;
|
|
24225
24323
|
var animatorStateData = animatorStateDataMap[stateName];
|
|
24226
24324
|
if (!animatorStateData) {
|
|
24227
24325
|
animatorStateData = new AnimatorStateData();
|
|
24228
24326
|
animatorStateDataMap[stateName] = animatorStateData;
|
|
24229
|
-
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData);
|
|
24327
|
+
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex);
|
|
24230
24328
|
this._saveAnimatorEventHandlers(animatorState, animatorStateData);
|
|
24231
24329
|
}
|
|
24232
24330
|
return animatorStateData;
|
|
24233
24331
|
};
|
|
24234
|
-
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData) {
|
|
24332
|
+
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex) {
|
|
24235
24333
|
var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
|
|
24236
24334
|
var curveLayerOwner = animatorStateData.curveLayerOwner;
|
|
24237
24335
|
var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
|
|
@@ -24243,9 +24341,22 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24243
24341
|
var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
|
|
24244
24342
|
var property = curve.property;
|
|
24245
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
|
+
}
|
|
24246
24350
|
// Get owner
|
|
24247
24351
|
var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
|
|
24248
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
|
+
}
|
|
24249
24360
|
// Get layer owner
|
|
24250
24361
|
var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
|
|
24251
24362
|
var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
|
|
@@ -24279,12 +24390,12 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24279
24390
|
};
|
|
24280
24391
|
_proto._clearCrossData = function _clearCrossData(animatorLayerData) {
|
|
24281
24392
|
animatorLayerData.crossCurveMark++;
|
|
24282
|
-
animatorLayerData.
|
|
24393
|
+
animatorLayerData.crossLayerOwnerCollection.length = 0;
|
|
24283
24394
|
};
|
|
24284
24395
|
_proto._addCrossOwner = function _addCrossOwner(animatorLayerData, layerOwner, curCurveIndex, nextCurveIndex) {
|
|
24285
24396
|
layerOwner.crossSrcCurveIndex = curCurveIndex;
|
|
24286
24397
|
layerOwner.crossDestCurveIndex = nextCurveIndex;
|
|
24287
|
-
animatorLayerData.
|
|
24398
|
+
animatorLayerData.crossLayerOwnerCollection.push(layerOwner);
|
|
24288
24399
|
};
|
|
24289
24400
|
_proto._prepareCrossFading = function _prepareCrossFading(animatorLayerData) {
|
|
24290
24401
|
// Add src cross curve data.
|
|
@@ -24299,10 +24410,10 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24299
24410
|
this._prepareDestCrossData(animatorLayerData, true);
|
|
24300
24411
|
};
|
|
24301
24412
|
_proto._prepareFixedPoseCrossFading = function _prepareFixedPoseCrossFading(animatorLayerData) {
|
|
24302
|
-
var
|
|
24413
|
+
var crossLayerOwnerCollection = animatorLayerData.crossLayerOwnerCollection;
|
|
24303
24414
|
// Save current cross curve data owner fixed pose.
|
|
24304
|
-
for(var i =
|
|
24305
|
-
var layerOwner =
|
|
24415
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
24416
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
24306
24417
|
if (!layerOwner) continue;
|
|
24307
24418
|
layerOwner.curveOwner.saveFixedPoseValue();
|
|
24308
24419
|
// Reset destCurveIndex When fixed pose crossFading again.
|
|
@@ -24330,7 +24441,6 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24330
24441
|
layerOwner.crossDestCurveIndex = i;
|
|
24331
24442
|
} else {
|
|
24332
24443
|
var owner = layerOwner.curveOwner;
|
|
24333
|
-
owner.saveDefaultValue();
|
|
24334
24444
|
saveFixed && owner.saveFixedPoseValue();
|
|
24335
24445
|
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
24336
24446
|
this._addCrossOwner(animatorLayerData, layerOwner, -1, i);
|
|
@@ -24348,7 +24458,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24348
24458
|
var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData, crossFadeTransitionInfo = layerData.crossFadeTransition;
|
|
24349
24459
|
var additive = blendingMode === exports.AnimatorLayerBlendingMode.Additive;
|
|
24350
24460
|
firstLayer && (weight = 1.0);
|
|
24351
|
-
|
|
24461
|
+
//@todo: All situations should be checked, optimizations will follow later.
|
|
24352
24462
|
layerData.layerState !== LayerState.FixedCrossFading && this._checkTransition(srcPlayData, crossFadeTransitionInfo, layerIndex);
|
|
24353
24463
|
switch(layerData.layerState){
|
|
24354
24464
|
case LayerState.Playing:
|
|
@@ -24360,6 +24470,9 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24360
24470
|
case LayerState.CrossFading:
|
|
24361
24471
|
this._updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, deltaTime, additive, aniUpdate);
|
|
24362
24472
|
break;
|
|
24473
|
+
case LayerState.Finished:
|
|
24474
|
+
this._updateFinishedState(srcPlayData, weight, additive, aniUpdate);
|
|
24475
|
+
break;
|
|
24363
24476
|
}
|
|
24364
24477
|
};
|
|
24365
24478
|
_proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
@@ -24367,19 +24480,26 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24367
24480
|
var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
|
|
24368
24481
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
24369
24482
|
playData.update(this.speed < 0);
|
|
24370
|
-
if (!aniUpdate) {
|
|
24371
|
-
return;
|
|
24372
|
-
}
|
|
24373
24483
|
var clipTime = playData.clipTime, playState = playData.playState;
|
|
24374
|
-
|
|
24375
|
-
|
|
24376
|
-
var
|
|
24377
|
-
|
|
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
|
+
}
|
|
24378
24497
|
}
|
|
24379
24498
|
playData.frameTime += state.speed * delta;
|
|
24380
24499
|
if (playState === AnimatorStatePlayState.Finished) {
|
|
24381
|
-
layerData.layerState = LayerState.
|
|
24500
|
+
layerData.layerState = LayerState.Finished;
|
|
24382
24501
|
}
|
|
24502
|
+
eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
24383
24503
|
if (lastPlayState === AnimatorStatePlayState.UnStarted) {
|
|
24384
24504
|
this._callAnimatorScriptOnEnter(state, layerIndex);
|
|
24385
24505
|
}
|
|
@@ -24390,7 +24510,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24390
24510
|
}
|
|
24391
24511
|
};
|
|
24392
24512
|
_proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
24393
|
-
var
|
|
24513
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
24394
24514
|
var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
|
|
24395
24515
|
var srcState = srcPlayData.state, srcStateData = srcPlayData.stateData, lastSrcPlayState = srcPlayData.playState;
|
|
24396
24516
|
var srcEventHandlers = srcStateData.eventHandlers;
|
|
@@ -24399,18 +24519,27 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24399
24519
|
var _destState_clip = destState.clip, destCurves = _destState_clip._curveBindings;
|
|
24400
24520
|
var lastSrcClipTime = srcPlayData.clipTime;
|
|
24401
24521
|
var lastDestClipTime = destPlayData.clipTime;
|
|
24402
|
-
var
|
|
24403
|
-
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);
|
|
24404
24525
|
srcPlayData.update(this.speed < 0);
|
|
24405
24526
|
destPlayData.update(this.speed < 0);
|
|
24406
|
-
var srcPlayState = srcPlayData.playState;
|
|
24407
|
-
var destPlayState = destPlayData.playState;
|
|
24408
|
-
|
|
24409
|
-
if (
|
|
24410
|
-
|
|
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
|
+
}
|
|
24411
24541
|
}
|
|
24412
|
-
|
|
24413
|
-
var destClipTime = destPlayData.clipTime;
|
|
24542
|
+
this._updateCrossFadeData(layerData, crossWeight, delta, false);
|
|
24414
24543
|
srcEventHandlers.length && this._fireAnimationEvents(srcPlayData, srcEventHandlers, lastSrcClipTime, srcClipTime);
|
|
24415
24544
|
destEventHandlers.length && this._fireAnimationEvents(destPlayData, destEventHandlers, lastDestClipTime, destClipTime);
|
|
24416
24545
|
if (lastSrcPlayState === AnimatorStatePlayState.UnStarted) {
|
|
@@ -24429,30 +24558,34 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24429
24558
|
} else {
|
|
24430
24559
|
this._callAnimatorScriptOnUpdate(destState, layerIndex);
|
|
24431
24560
|
}
|
|
24432
|
-
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
24433
|
-
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
24434
|
-
if (!layerOwner) continue;
|
|
24435
|
-
var srcCurveIndex = layerOwner.crossSrcCurveIndex;
|
|
24436
|
-
var destCurveIndex = layerOwner.crossDestCurveIndex;
|
|
24437
|
-
layerOwner.curveOwner.crossFadeAndApplyValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
|
|
24438
|
-
}
|
|
24439
24561
|
};
|
|
24440
|
-
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex,
|
|
24441
|
-
var
|
|
24562
|
+
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
24563
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
24442
24564
|
var state = destPlayData.state, stateData = destPlayData.stateData, lastPlayState = destPlayData.playState;
|
|
24443
24565
|
var eventHandlers = stateData.eventHandlers;
|
|
24444
24566
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
24445
24567
|
var lastDestClipTime = destPlayData.clipTime;
|
|
24446
|
-
var
|
|
24447
|
-
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);
|
|
24448
24571
|
destPlayData.update(this.speed < 0);
|
|
24449
24572
|
var playState = destPlayData.playState;
|
|
24450
24573
|
this._updateCrossFadeData(layerData, crossWeight, delta, true);
|
|
24451
|
-
if (!aniUpdate) {
|
|
24452
|
-
return;
|
|
24453
|
-
}
|
|
24454
24574
|
var destClipTime = destPlayData.clipTime;
|
|
24455
|
-
|
|
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."
|
|
24456
24589
|
eventHandlers.length && this._fireAnimationEvents(destPlayData, eventHandlers, lastDestClipTime, destClipTime);
|
|
24457
24590
|
if (lastPlayState === AnimatorStatePlayState.UnStarted) {
|
|
24458
24591
|
this._callAnimatorScriptOnEnter(state, layerIndex);
|
|
@@ -24462,11 +24595,18 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24462
24595
|
} else {
|
|
24463
24596
|
this._callAnimatorScriptOnUpdate(state, layerIndex);
|
|
24464
24597
|
}
|
|
24465
|
-
|
|
24466
|
-
|
|
24467
|
-
|
|
24468
|
-
|
|
24469
|
-
|
|
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);
|
|
24470
24610
|
}
|
|
24471
24611
|
};
|
|
24472
24612
|
_proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
|
|
@@ -24474,7 +24614,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24474
24614
|
destPlayData.frameTime += destPlayData.state.speed * delta;
|
|
24475
24615
|
if (crossWeight === 1.0) {
|
|
24476
24616
|
if (destPlayData.playState === AnimatorStatePlayState.Finished) {
|
|
24477
|
-
layerData.layerState = LayerState.
|
|
24617
|
+
layerData.layerState = LayerState.Finished;
|
|
24478
24618
|
} else {
|
|
24479
24619
|
layerData.layerState = LayerState.Playing;
|
|
24480
24620
|
}
|
|
@@ -24484,7 +24624,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24484
24624
|
fixed || (layerData.srcPlayData.frameTime += layerData.srcPlayData.state.speed * delta);
|
|
24485
24625
|
}
|
|
24486
24626
|
};
|
|
24487
|
-
_proto._preparePlay = function _preparePlay(layerData, playState
|
|
24627
|
+
_proto._preparePlay = function _preparePlay(layerData, playState) {
|
|
24488
24628
|
if (layerData.layerState === LayerState.Playing) {
|
|
24489
24629
|
var srcPlayData = layerData.srcPlayData;
|
|
24490
24630
|
if (srcPlayData.state !== playState) {
|
|
@@ -24492,18 +24632,16 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24492
24632
|
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24493
24633
|
var _curveLayerOwner_i;
|
|
24494
24634
|
var owner = (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner;
|
|
24495
|
-
|
|
24635
|
+
owner.revertDefaultValue();
|
|
24496
24636
|
}
|
|
24497
|
-
this._saveDefaultValues(playStateData);
|
|
24498
24637
|
}
|
|
24499
24638
|
} else {
|
|
24500
|
-
// layerState is CrossFading, FixedCrossFading, Standby
|
|
24501
|
-
var
|
|
24502
|
-
for(var i1 =
|
|
24503
|
-
var owner1 =
|
|
24504
|
-
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();
|
|
24505
24644
|
}
|
|
24506
|
-
this._saveDefaultValues(playStateData);
|
|
24507
24645
|
}
|
|
24508
24646
|
};
|
|
24509
24647
|
_proto._checkTransition = function _checkTransition(stateData, crossFadeTransition, layerIndex) {
|
|
@@ -24520,7 +24658,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24520
24658
|
_proto._crossFadeByTransition = function _crossFadeByTransition(transition, layerIndex) {
|
|
24521
24659
|
var name = transition.destinationState.name;
|
|
24522
24660
|
var stateInfo = this._getAnimatorStateInfo(name, layerIndex);
|
|
24523
|
-
var crossState = stateInfo.state;
|
|
24661
|
+
var crossState = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
|
|
24524
24662
|
if (!crossState) {
|
|
24525
24663
|
return;
|
|
24526
24664
|
}
|
|
@@ -24528,21 +24666,21 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24528
24666
|
console.warn("The state named " + name + " has no AnimationClip data.");
|
|
24529
24667
|
return;
|
|
24530
24668
|
}
|
|
24531
|
-
var animatorLayerData = this._getAnimatorLayerData(
|
|
24669
|
+
var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
|
|
24532
24670
|
var layerState = animatorLayerData.layerState;
|
|
24533
24671
|
var destPlayData = animatorLayerData.destPlayData;
|
|
24534
|
-
var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData);
|
|
24672
|
+
var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData, playLayerIndex);
|
|
24535
24673
|
var duration = crossState._getDuration();
|
|
24536
24674
|
var offset = duration * transition.offset;
|
|
24537
24675
|
destPlayData.reset(crossState, animatorStateData, offset);
|
|
24538
24676
|
switch(layerState){
|
|
24539
|
-
// Maybe not play, maybe end.
|
|
24540
24677
|
case LayerState.Standby:
|
|
24541
24678
|
animatorLayerData.layerState = LayerState.FixedCrossFading;
|
|
24542
24679
|
this._clearCrossData(animatorLayerData);
|
|
24543
24680
|
this._prepareStandbyCrossFading(animatorLayerData);
|
|
24544
24681
|
break;
|
|
24545
24682
|
case LayerState.Playing:
|
|
24683
|
+
case LayerState.Finished:
|
|
24546
24684
|
animatorLayerData.layerState = LayerState.CrossFading;
|
|
24547
24685
|
this._clearCrossData(animatorLayerData);
|
|
24548
24686
|
this._prepareCrossFading(animatorLayerData);
|
|
@@ -24639,6 +24777,12 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24639
24777
|
}
|
|
24640
24778
|
}
|
|
24641
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
|
+
};
|
|
24642
24786
|
_create_class(Animator, [
|
|
24643
24787
|
{
|
|
24644
24788
|
key: "animatorController",
|
|
@@ -24671,6 +24815,9 @@ __decorate([
|
|
|
24671
24815
|
__decorate([
|
|
24672
24816
|
ignoreClone
|
|
24673
24817
|
], Animator.prototype, "_curveOwnerPool", void 0);
|
|
24818
|
+
__decorate([
|
|
24819
|
+
ignoreClone
|
|
24820
|
+
], Animator.prototype, "_needRevertCurveOwners", void 0);
|
|
24674
24821
|
__decorate([
|
|
24675
24822
|
ignoreClone
|
|
24676
24823
|
], Animator.prototype, "_animationEventHandlerPool", void 0);
|