@galacean/engine 1.0.0-beta.12 → 1.0.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +289 -171
- package/dist/browser.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -7133,29 +7133,7 @@
|
|
|
7133
7133
|
* @remarks The release principle is that it is not referenced by the components, including direct and indirect reference.
|
|
7134
7134
|
*/ _proto.gc = function gc() {
|
|
7135
7135
|
this._gc(false);
|
|
7136
|
-
|
|
7137
|
-
engine._renderElementPool.garbageCollection();
|
|
7138
|
-
engine._meshRenderDataPool.garbageCollection();
|
|
7139
|
-
engine._spriteRenderDataPool.garbageCollection();
|
|
7140
|
-
engine._spriteMaskRenderDataPool.garbageCollection();
|
|
7141
|
-
engine._textRenderDataPool.garbageCollection();
|
|
7142
|
-
var _componentsManager = engine._componentsManager, _lightManager = engine._lightManager;
|
|
7143
|
-
_componentsManager._renderers.garbageCollection();
|
|
7144
|
-
// @ts-ignore
|
|
7145
|
-
_componentsManager._onStartScripts.garbageCollection();
|
|
7146
|
-
// @ts-ignore
|
|
7147
|
-
_componentsManager._onUpdateScripts.garbageCollection();
|
|
7148
|
-
// @ts-ignore
|
|
7149
|
-
_componentsManager._onLateUpdateScripts.garbageCollection();
|
|
7150
|
-
// @ts-ignore
|
|
7151
|
-
_componentsManager._onPhysicsUpdateScripts.garbageCollection();
|
|
7152
|
-
// @ts-ignore
|
|
7153
|
-
_componentsManager._onUpdateAnimations.garbageCollection();
|
|
7154
|
-
// @ts-ignore
|
|
7155
|
-
_componentsManager._onUpdateRenderers.garbageCollection();
|
|
7156
|
-
_lightManager._spotLights.garbageCollection();
|
|
7157
|
-
_lightManager._pointLights.garbageCollection();
|
|
7158
|
-
_lightManager._directLights.garbageCollection();
|
|
7136
|
+
this.engine._pendingGC();
|
|
7159
7137
|
};
|
|
7160
7138
|
/**
|
|
7161
7139
|
* Add content restorer.
|
|
@@ -8073,6 +8051,17 @@
|
|
|
8073
8051
|
componentContainer.length = 0;
|
|
8074
8052
|
this._componentsContainerPool.push(componentContainer);
|
|
8075
8053
|
};
|
|
8054
|
+
/**
|
|
8055
|
+
* @internal
|
|
8056
|
+
*/ _proto._gc = function _gc() {
|
|
8057
|
+
this._renderers.garbageCollection();
|
|
8058
|
+
this._onStartScripts.garbageCollection();
|
|
8059
|
+
this._onUpdateScripts.garbageCollection();
|
|
8060
|
+
this._onLateUpdateScripts.garbageCollection();
|
|
8061
|
+
this._onPhysicsUpdateScripts.garbageCollection();
|
|
8062
|
+
this._onUpdateAnimations.garbageCollection();
|
|
8063
|
+
this._onUpdateRenderers.garbageCollection();
|
|
8064
|
+
};
|
|
8076
8065
|
return ComponentsManager;
|
|
8077
8066
|
}();
|
|
8078
8067
|
/**
|
|
@@ -10682,6 +10671,11 @@
|
|
|
10682
10671
|
elements[i]._onLateUpdate();
|
|
10683
10672
|
}
|
|
10684
10673
|
};
|
|
10674
|
+
/**
|
|
10675
|
+
* @internal
|
|
10676
|
+
*/ _proto._gc = function _gc() {
|
|
10677
|
+
this._colliders.garbageCollection();
|
|
10678
|
+
};
|
|
10685
10679
|
_proto._setGravity = function _setGravity() {
|
|
10686
10680
|
this._nativePhysicsManager.setGravity(this._gravity);
|
|
10687
10681
|
};
|
|
@@ -13226,6 +13220,13 @@
|
|
|
13226
13220
|
shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
|
|
13227
13221
|
}
|
|
13228
13222
|
};
|
|
13223
|
+
/**
|
|
13224
|
+
* @internal
|
|
13225
|
+
*/ _proto._gc = function _gc() {
|
|
13226
|
+
this._spotLights.garbageCollection();
|
|
13227
|
+
this._pointLights.garbageCollection();
|
|
13228
|
+
this._directLights.garbageCollection();
|
|
13229
|
+
};
|
|
13229
13230
|
return LightManager;
|
|
13230
13231
|
}();
|
|
13231
13232
|
/**
|
|
@@ -21502,6 +21503,7 @@
|
|
|
21502
21503
|
_this._frameInProcess = false;
|
|
21503
21504
|
_this._waitingDestroy = false;
|
|
21504
21505
|
_this._isDeviceLost = false;
|
|
21506
|
+
_this._waitingGC = false;
|
|
21505
21507
|
_this._animate = function() {
|
|
21506
21508
|
if (_this._vSyncCount) {
|
|
21507
21509
|
_this._requestId = requestAnimationFrame(_this._animate);
|
|
@@ -21605,6 +21607,10 @@
|
|
|
21605
21607
|
if (this._waitingDestroy) {
|
|
21606
21608
|
this._destroy();
|
|
21607
21609
|
}
|
|
21610
|
+
if (this._waitingGC) {
|
|
21611
|
+
this._gc();
|
|
21612
|
+
this._waitingGC = false;
|
|
21613
|
+
}
|
|
21608
21614
|
this._frameInProcess = false;
|
|
21609
21615
|
};
|
|
21610
21616
|
/**
|
|
@@ -21763,6 +21769,15 @@
|
|
|
21763
21769
|
};
|
|
21764
21770
|
/**
|
|
21765
21771
|
* @internal
|
|
21772
|
+
*/ _proto._pendingGC = function _pendingGC() {
|
|
21773
|
+
if (this._frameInProcess) {
|
|
21774
|
+
this._waitingGC = true;
|
|
21775
|
+
} else {
|
|
21776
|
+
this._gc();
|
|
21777
|
+
}
|
|
21778
|
+
};
|
|
21779
|
+
/**
|
|
21780
|
+
* @internal
|
|
21766
21781
|
*/ _proto._initialize = function _initialize(configuration) {
|
|
21767
21782
|
var _this = this;
|
|
21768
21783
|
var physics = configuration.physics;
|
|
@@ -21825,6 +21840,16 @@
|
|
|
21825
21840
|
console.error(error);
|
|
21826
21841
|
});
|
|
21827
21842
|
};
|
|
21843
|
+
_proto._gc = function _gc() {
|
|
21844
|
+
this._renderElementPool.garbageCollection();
|
|
21845
|
+
this._meshRenderDataPool.garbageCollection();
|
|
21846
|
+
this._spriteRenderDataPool.garbageCollection();
|
|
21847
|
+
this._spriteMaskRenderDataPool.garbageCollection();
|
|
21848
|
+
this._textRenderDataPool.garbageCollection();
|
|
21849
|
+
this._componentsManager._gc();
|
|
21850
|
+
this._lightManager._gc();
|
|
21851
|
+
this.physicsManager._gc();
|
|
21852
|
+
};
|
|
21828
21853
|
_create_class$3(Engine, [
|
|
21829
21854
|
{
|
|
21830
21855
|
key: "settings",
|
|
@@ -27204,7 +27229,6 @@
|
|
|
27204
27229
|
* @internal
|
|
27205
27230
|
*/ var AnimationCurveOwner = /*#__PURE__*/ function() {
|
|
27206
27231
|
function AnimationCurveOwner(target, type, property, cureType) {
|
|
27207
|
-
this.hasSavedDefaultValue = false;
|
|
27208
27232
|
this.baseEvaluateData = {
|
|
27209
27233
|
curKeyframeIndex: 0,
|
|
27210
27234
|
value: null
|
|
@@ -27213,11 +27237,12 @@
|
|
|
27213
27237
|
curKeyframeIndex: 0,
|
|
27214
27238
|
value: null
|
|
27215
27239
|
};
|
|
27240
|
+
this.updateMark = 0;
|
|
27216
27241
|
this.target = target;
|
|
27217
27242
|
this.type = type;
|
|
27218
27243
|
this.property = property;
|
|
27219
27244
|
this.component = target.getComponent(type);
|
|
27220
|
-
this.
|
|
27245
|
+
this.cureType = cureType;
|
|
27221
27246
|
var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
|
|
27222
27247
|
this._assembler = new assemblerType();
|
|
27223
27248
|
this._assembler.initialize(this);
|
|
@@ -27226,89 +27251,80 @@
|
|
|
27226
27251
|
}
|
|
27227
27252
|
}
|
|
27228
27253
|
var _proto = AnimationCurveOwner.prototype;
|
|
27229
|
-
_proto.
|
|
27230
|
-
|
|
27231
|
-
if (additive) {
|
|
27232
|
-
var value = curve._evaluateAdditive(time, this.baseEvaluateData);
|
|
27233
|
-
var cureType = this._cureType;
|
|
27234
|
-
if (cureType._isReferenceType) {
|
|
27235
|
-
cureType._additiveValue(value, layerWeight, this.referenceTargetValue);
|
|
27236
|
-
} else {
|
|
27237
|
-
var assembler = this._assembler;
|
|
27238
|
-
var originValue = assembler.getTargetValue();
|
|
27239
|
-
var additiveValue = cureType._additiveValue(value, layerWeight, originValue);
|
|
27240
|
-
assembler.setTargetValue(additiveValue);
|
|
27241
|
-
}
|
|
27242
|
-
} else {
|
|
27243
|
-
var value1 = curve._evaluate(time, this.baseEvaluateData);
|
|
27244
|
-
this._applyValue(value1, layerWeight);
|
|
27245
|
-
}
|
|
27246
|
-
}
|
|
27254
|
+
_proto.evaluateValue = function evaluateValue(curve, time, additive) {
|
|
27255
|
+
return additive ? curve._evaluateAdditive(time, this.baseEvaluateData) : curve._evaluate(time, this.baseEvaluateData);
|
|
27247
27256
|
};
|
|
27248
|
-
_proto.
|
|
27249
|
-
var srcValue = srcCurve && srcCurve.keys.length ? additive ? srcCurve._evaluateAdditive(srcTime, this.baseEvaluateData) : srcCurve._evaluate(srcTime, this.baseEvaluateData) : additive ? this.
|
|
27250
|
-
var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.
|
|
27251
|
-
this.
|
|
27257
|
+
_proto.evaluateCrossFadeValue = function evaluateCrossFadeValue(srcCurve, destCurve, srcTime, destTime, crossWeight, additive) {
|
|
27258
|
+
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;
|
|
27259
|
+
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;
|
|
27260
|
+
return this._lerpValue(srcValue, destValue, crossWeight);
|
|
27252
27261
|
};
|
|
27253
|
-
_proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight,
|
|
27254
|
-
var srcValue = additive ? this.
|
|
27255
|
-
var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.
|
|
27256
|
-
this.
|
|
27262
|
+
_proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight, additive) {
|
|
27263
|
+
var srcValue = additive ? this.cureType._subtractValue(this.fixedPoseValue, this.defaultValue, this.baseEvaluateData.value) : this.fixedPoseValue;
|
|
27264
|
+
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;
|
|
27265
|
+
return this._lerpValue(srcValue, destValue, crossWeight);
|
|
27257
27266
|
};
|
|
27258
27267
|
_proto.revertDefaultValue = function revertDefaultValue() {
|
|
27259
27268
|
this._assembler.setTargetValue(this.defaultValue);
|
|
27260
27269
|
};
|
|
27270
|
+
_proto.getEvaluateValue = function getEvaluateValue(out) {
|
|
27271
|
+
if (this.cureType._isReferenceType) {
|
|
27272
|
+
this.cureType._copyValue(this.baseEvaluateData.value, out);
|
|
27273
|
+
return out;
|
|
27274
|
+
} else {
|
|
27275
|
+
return this.baseEvaluateData.value;
|
|
27276
|
+
}
|
|
27277
|
+
};
|
|
27261
27278
|
_proto.saveDefaultValue = function saveDefaultValue() {
|
|
27262
|
-
if (this.
|
|
27263
|
-
this.
|
|
27279
|
+
if (this.cureType._isReferenceType) {
|
|
27280
|
+
this.cureType._copyValue(this.referenceTargetValue, this.defaultValue);
|
|
27264
27281
|
} else {
|
|
27265
27282
|
this.defaultValue = this._assembler.getTargetValue();
|
|
27266
27283
|
}
|
|
27267
|
-
this.hasSavedDefaultValue = true;
|
|
27268
27284
|
};
|
|
27269
27285
|
_proto.saveFixedPoseValue = function saveFixedPoseValue() {
|
|
27270
|
-
if (this.
|
|
27271
|
-
this.
|
|
27286
|
+
if (this.cureType._isReferenceType) {
|
|
27287
|
+
this.cureType._copyValue(this.referenceTargetValue, this.fixedPoseValue);
|
|
27272
27288
|
} else {
|
|
27273
27289
|
this.fixedPoseValue = this._assembler.getTargetValue();
|
|
27274
27290
|
}
|
|
27275
27291
|
};
|
|
27276
|
-
_proto.
|
|
27277
|
-
|
|
27278
|
-
|
|
27279
|
-
|
|
27292
|
+
_proto.applyValue = function applyValue(value, weight, additive) {
|
|
27293
|
+
var cureType = this.cureType;
|
|
27294
|
+
if (additive) {
|
|
27295
|
+
if (cureType._isReferenceType) {
|
|
27296
|
+
cureType._additiveValue(value, weight, this.referenceTargetValue);
|
|
27280
27297
|
} else {
|
|
27281
|
-
this._assembler
|
|
27298
|
+
var assembler = this._assembler;
|
|
27299
|
+
var originValue = assembler.getTargetValue();
|
|
27300
|
+
var additiveValue = cureType._additiveValue(value, weight, originValue);
|
|
27301
|
+
assembler.setTargetValue(additiveValue);
|
|
27282
27302
|
}
|
|
27283
27303
|
} else {
|
|
27284
|
-
if (
|
|
27285
|
-
|
|
27286
|
-
|
|
27304
|
+
if (weight === 1.0) {
|
|
27305
|
+
if (cureType._isReferenceType) {
|
|
27306
|
+
cureType._copyValue(value, this.referenceTargetValue);
|
|
27307
|
+
} else {
|
|
27308
|
+
this._assembler.setTargetValue(value);
|
|
27309
|
+
}
|
|
27287
27310
|
} else {
|
|
27288
|
-
|
|
27289
|
-
|
|
27290
|
-
|
|
27311
|
+
if (cureType._isReferenceType) {
|
|
27312
|
+
var targetValue = this.referenceTargetValue;
|
|
27313
|
+
cureType._lerpValue(targetValue, value, weight, targetValue);
|
|
27314
|
+
} else {
|
|
27315
|
+
var originValue1 = this._assembler.getTargetValue();
|
|
27316
|
+
var lerpValue = cureType._lerpValue(originValue1, value, weight);
|
|
27317
|
+
this._assembler.setTargetValue(lerpValue);
|
|
27318
|
+
}
|
|
27291
27319
|
}
|
|
27292
27320
|
}
|
|
27293
27321
|
};
|
|
27294
|
-
_proto.
|
|
27295
|
-
|
|
27296
|
-
|
|
27297
|
-
out = this.baseEvaluateData.value;
|
|
27298
|
-
this._cureType._lerpValue(srcValue, destValue, crossWeight, out);
|
|
27299
|
-
} else {
|
|
27300
|
-
out = this._cureType._lerpValue(srcValue, destValue, crossWeight);
|
|
27301
|
-
}
|
|
27302
|
-
if (additive) {
|
|
27303
|
-
if (this._cureType._isReferenceType) {
|
|
27304
|
-
this._cureType._additiveValue(out, layerWeight, this.referenceTargetValue);
|
|
27305
|
-
} else {
|
|
27306
|
-
var originValue = this._assembler.getTargetValue();
|
|
27307
|
-
var lerpValue = this._cureType._additiveValue(out, layerWeight, originValue);
|
|
27308
|
-
this._assembler.setTargetValue(lerpValue);
|
|
27309
|
-
}
|
|
27322
|
+
_proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
27323
|
+
if (this.cureType._isReferenceType) {
|
|
27324
|
+
return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
|
|
27310
27325
|
} else {
|
|
27311
|
-
this.
|
|
27326
|
+
this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
|
|
27327
|
+
return this.baseEvaluateData.value;
|
|
27312
27328
|
}
|
|
27313
27329
|
};
|
|
27314
27330
|
AnimationCurveOwner.registerAssembler = function registerAssembler(componentType, property, assemblerType) {
|
|
@@ -27399,9 +27415,24 @@
|
|
|
27399
27415
|
AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights", BlendShapeWeightsAnimationCurveOwnerAssembler);
|
|
27400
27416
|
/**
|
|
27401
27417
|
* @internal
|
|
27402
|
-
*/ var AnimationCurveLayerOwner = function
|
|
27403
|
-
|
|
27404
|
-
|
|
27418
|
+
*/ var AnimationCurveLayerOwner = /*#__PURE__*/ function() {
|
|
27419
|
+
var AnimationCurveLayerOwner = function AnimationCurveLayerOwner() {
|
|
27420
|
+
this.crossCurveMark = 0;
|
|
27421
|
+
};
|
|
27422
|
+
var _proto = AnimationCurveLayerOwner.prototype;
|
|
27423
|
+
_proto.initFinalValue = function initFinalValue() {
|
|
27424
|
+
var _this_curveOwner = this.curveOwner, cureType = _this_curveOwner.cureType, defaultValue = _this_curveOwner.defaultValue;
|
|
27425
|
+
if (cureType._isReferenceType) {
|
|
27426
|
+
cureType._copyValue(defaultValue, this.finalValue);
|
|
27427
|
+
} else {
|
|
27428
|
+
this.finalValue = defaultValue;
|
|
27429
|
+
}
|
|
27430
|
+
};
|
|
27431
|
+
_proto.saveFinalValue = function saveFinalValue() {
|
|
27432
|
+
this.finalValue = this.curveOwner.getEvaluateValue(this.finalValue);
|
|
27433
|
+
};
|
|
27434
|
+
return AnimationCurveLayerOwner;
|
|
27435
|
+
}();
|
|
27405
27436
|
/**
|
|
27406
27437
|
* Associate AnimationCurve and the Entity
|
|
27407
27438
|
*/ var AnimationClipCurveBinding = /*#__PURE__*/ function() {
|
|
@@ -27415,13 +27446,18 @@
|
|
|
27415
27446
|
var curveType = this.curve.constructor;
|
|
27416
27447
|
var owner = new AnimationCurveOwner(entity, this.type, this.property, curveType);
|
|
27417
27448
|
curveType._initializeOwner(owner);
|
|
27449
|
+
owner.saveDefaultValue();
|
|
27418
27450
|
return owner;
|
|
27419
27451
|
};
|
|
27420
27452
|
/**
|
|
27421
27453
|
* @internal
|
|
27422
27454
|
*/ _proto._createCurveLayerOwner = function _createCurveLayerOwner(owner) {
|
|
27455
|
+
var curveType = this.curve.constructor;
|
|
27423
27456
|
var layerOwner = new AnimationCurveLayerOwner();
|
|
27424
27457
|
layerOwner.curveOwner = owner;
|
|
27458
|
+
curveType._initializeLayerOwner(layerOwner);
|
|
27459
|
+
// If curve.keys.length is 0, updateFinishedState will assign 0 to the target, causing an error, so initialize by assigning defaultValue to finalValue.
|
|
27460
|
+
layerOwner.initFinalValue();
|
|
27425
27461
|
return layerOwner;
|
|
27426
27462
|
};
|
|
27427
27463
|
/**
|
|
@@ -27506,7 +27542,8 @@
|
|
|
27506
27542
|
var targetEntity = entity.findByPath(curveData.relativePath);
|
|
27507
27543
|
if (targetEntity) {
|
|
27508
27544
|
var curveOwner = curveData._getTempCurveOwner(targetEntity);
|
|
27509
|
-
curveOwner.
|
|
27545
|
+
var value = curveOwner.evaluateValue(curveData.curve, time, false);
|
|
27546
|
+
curveOwner.applyValue(value, 1, false);
|
|
27510
27547
|
}
|
|
27511
27548
|
}
|
|
27512
27549
|
};
|
|
@@ -27648,6 +27685,7 @@
|
|
|
27648
27685
|
break;
|
|
27649
27686
|
}
|
|
27650
27687
|
}
|
|
27688
|
+
evaluateData.value = value;
|
|
27651
27689
|
return value;
|
|
27652
27690
|
};
|
|
27653
27691
|
/**
|
|
@@ -27703,6 +27741,11 @@
|
|
|
27703
27741
|
};
|
|
27704
27742
|
/**
|
|
27705
27743
|
* @internal
|
|
27744
|
+
*/ AnimationArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
27745
|
+
owner.finalValue = [];
|
|
27746
|
+
};
|
|
27747
|
+
/**
|
|
27748
|
+
* @internal
|
|
27706
27749
|
*/ AnimationArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
27707
27750
|
for(var i = 0, n = out.length; i < n; ++i){
|
|
27708
27751
|
var src = srcValue[i];
|
|
@@ -27792,6 +27835,11 @@
|
|
|
27792
27835
|
};
|
|
27793
27836
|
/**
|
|
27794
27837
|
* @internal
|
|
27838
|
+
*/ AnimationBoolCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
27839
|
+
owner.finalValue = false;
|
|
27840
|
+
};
|
|
27841
|
+
/**
|
|
27842
|
+
* @internal
|
|
27795
27843
|
*/ AnimationBoolCurve._lerpValue = function _lerpValue(srcValue, destValue) {
|
|
27796
27844
|
return destValue;
|
|
27797
27845
|
};
|
|
@@ -27848,6 +27896,11 @@
|
|
|
27848
27896
|
};
|
|
27849
27897
|
/**
|
|
27850
27898
|
* @internal
|
|
27899
|
+
*/ AnimationColorCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
27900
|
+
owner.finalValue = new Color$1();
|
|
27901
|
+
};
|
|
27902
|
+
/**
|
|
27903
|
+
* @internal
|
|
27851
27904
|
*/ AnimationColorCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
27852
27905
|
Color$1.lerp(srcValue, destValue, weight, out);
|
|
27853
27906
|
return out;
|
|
@@ -27953,6 +28006,12 @@
|
|
|
27953
28006
|
};
|
|
27954
28007
|
/**
|
|
27955
28008
|
* @internal
|
|
28009
|
+
*/ AnimationFloatArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
28010
|
+
var size = owner.curveOwner.referenceTargetValue.length;
|
|
28011
|
+
owner.finalValue = new Float32Array(size);
|
|
28012
|
+
};
|
|
28013
|
+
/**
|
|
28014
|
+
* @internal
|
|
27956
28015
|
*/ AnimationFloatArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
27957
28016
|
for(var i = 0, n = out.length; i < n; ++i){
|
|
27958
28017
|
var src = srcValue[i];
|
|
@@ -28042,6 +28101,11 @@
|
|
|
28042
28101
|
};
|
|
28043
28102
|
/**
|
|
28044
28103
|
* @internal
|
|
28104
|
+
*/ AnimationFloatCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
28105
|
+
owner.finalValue = 0;
|
|
28106
|
+
};
|
|
28107
|
+
/**
|
|
28108
|
+
* @internal
|
|
28045
28109
|
*/ AnimationFloatCurve._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
28046
28110
|
return srcValue + (destValue - srcValue) * crossWeight;
|
|
28047
28111
|
};
|
|
@@ -28110,6 +28174,11 @@
|
|
|
28110
28174
|
};
|
|
28111
28175
|
/**
|
|
28112
28176
|
* @internal
|
|
28177
|
+
*/ AnimationQuaternionCurve1._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
28178
|
+
owner.finalValue = new Quaternion();
|
|
28179
|
+
};
|
|
28180
|
+
/**
|
|
28181
|
+
* @internal
|
|
28113
28182
|
*/ AnimationQuaternionCurve1._lerpValue = function _lerpValue(src, dest, weight, out) {
|
|
28114
28183
|
Quaternion.slerp(src, dest, weight, out);
|
|
28115
28184
|
return out;
|
|
@@ -28213,6 +28282,11 @@
|
|
|
28213
28282
|
};
|
|
28214
28283
|
/**
|
|
28215
28284
|
* @internal
|
|
28285
|
+
*/ AnimationVector2Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
28286
|
+
owner.finalValue = new Vector2();
|
|
28287
|
+
};
|
|
28288
|
+
/**
|
|
28289
|
+
* @internal
|
|
28216
28290
|
*/ AnimationVector2Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
28217
28291
|
Vector2.lerp(srcValue, destValue, weight, out);
|
|
28218
28292
|
return out;
|
|
@@ -28297,6 +28371,11 @@
|
|
|
28297
28371
|
};
|
|
28298
28372
|
/**
|
|
28299
28373
|
* @internal
|
|
28374
|
+
*/ AnimationVector3Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
28375
|
+
owner.finalValue = new Vector3();
|
|
28376
|
+
};
|
|
28377
|
+
/**
|
|
28378
|
+
* @internal
|
|
28300
28379
|
*/ AnimationVector3Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
28301
28380
|
Vector3.lerp(srcValue, destValue, weight, out);
|
|
28302
28381
|
return out;
|
|
@@ -28393,6 +28472,11 @@
|
|
|
28393
28472
|
};
|
|
28394
28473
|
/**
|
|
28395
28474
|
* @internal
|
|
28475
|
+
*/ AnimationVector4Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
28476
|
+
owner.finalValue = new Vector4();
|
|
28477
|
+
};
|
|
28478
|
+
/**
|
|
28479
|
+
* @internal
|
|
28396
28480
|
*/ AnimationVector4Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
28397
28481
|
Vector4.lerp(srcValue, destValue, weight, out);
|
|
28398
28482
|
return out;
|
|
@@ -28498,6 +28582,7 @@
|
|
|
28498
28582
|
LayerState[LayerState[/** Playing state. */ "Playing"] = 1] = "Playing";
|
|
28499
28583
|
LayerState[LayerState[/** CrossFading state. */ "CrossFading"] = 2] = "CrossFading";
|
|
28500
28584
|
LayerState[LayerState[/** FixedCrossFading state. */ "FixedCrossFading"] = 3] = "FixedCrossFading";
|
|
28585
|
+
LayerState[LayerState[/** Finished state. */ "Finished"] = 4] = "Finished";
|
|
28501
28586
|
})(LayerState || (LayerState = {}));
|
|
28502
28587
|
/**
|
|
28503
28588
|
* @internal
|
|
@@ -28569,7 +28654,7 @@
|
|
|
28569
28654
|
this.layerState = LayerState.Standby;
|
|
28570
28655
|
this.crossCurveMark = 0;
|
|
28571
28656
|
this.manuallyTransition = new AnimatorStateTransition();
|
|
28572
|
-
this.
|
|
28657
|
+
this.crossLayerOwnerCollection = [];
|
|
28573
28658
|
};
|
|
28574
28659
|
var _proto = AnimatorLayerData.prototype;
|
|
28575
28660
|
_proto.switchPlayData = function switchPlayData() {
|
|
@@ -28594,6 +28679,7 @@
|
|
|
28594
28679
|
_this = Component.call(this, entity) || this;
|
|
28595
28680
|
/** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
|
|
28596
28681
|
/** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
|
|
28682
|
+
_this._updateMark = 0;
|
|
28597
28683
|
_this._animatorLayersData = [];
|
|
28598
28684
|
_this._curveOwnerPool = Object.create(null);
|
|
28599
28685
|
_this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
|
|
@@ -28619,17 +28705,17 @@
|
|
|
28619
28705
|
this._reset();
|
|
28620
28706
|
}
|
|
28621
28707
|
var stateInfo = this._getAnimatorStateInfo(stateName, layerIndex);
|
|
28622
|
-
var state = stateInfo.state;
|
|
28708
|
+
var state = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
|
|
28623
28709
|
if (!state) {
|
|
28624
28710
|
return;
|
|
28625
28711
|
}
|
|
28626
28712
|
if (!state.clip) {
|
|
28627
|
-
|
|
28713
|
+
Logger.warn("The state named " + stateName + " has no AnimationClip data.");
|
|
28628
28714
|
return;
|
|
28629
28715
|
}
|
|
28630
|
-
var animatorLayerData = this._getAnimatorLayerData(
|
|
28631
|
-
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData);
|
|
28632
|
-
this._preparePlay(animatorLayerData, state
|
|
28716
|
+
var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
|
|
28717
|
+
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData, playLayerIndex);
|
|
28718
|
+
this._preparePlay(animatorLayerData, state);
|
|
28633
28719
|
animatorLayerData.layerState = LayerState.Playing;
|
|
28634
28720
|
animatorLayerData.srcPlayData.reset(state, animatorStateData, state._getDuration() * normalizedTimeOffset);
|
|
28635
28721
|
};
|
|
@@ -28646,8 +28732,8 @@
|
|
|
28646
28732
|
if ((_this__controllerUpdateFlag = this._controllerUpdateFlag) == null ? void 0 : _this__controllerUpdateFlag.flag) {
|
|
28647
28733
|
this._reset();
|
|
28648
28734
|
}
|
|
28649
|
-
var
|
|
28650
|
-
var manuallyTransition = this._getAnimatorLayerData(
|
|
28735
|
+
var _this__getAnimatorStateInfo = this._getAnimatorStateInfo(stateName, layerIndex), state = _this__getAnimatorStateInfo.state, playLayerIndex = _this__getAnimatorStateInfo.layerIndex;
|
|
28736
|
+
var manuallyTransition = this._getAnimatorLayerData(playLayerIndex).manuallyTransition;
|
|
28651
28737
|
manuallyTransition.duration = normalizedTransitionDuration;
|
|
28652
28738
|
manuallyTransition.offset = normalizedTimeOffset;
|
|
28653
28739
|
manuallyTransition.destinationState = state;
|
|
@@ -28680,6 +28766,7 @@
|
|
|
28680
28766
|
return;
|
|
28681
28767
|
}
|
|
28682
28768
|
deltaTime *= this.speed;
|
|
28769
|
+
this._updateMark++;
|
|
28683
28770
|
for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
|
|
28684
28771
|
var animatorLayerData = this._getAnimatorLayerData(i1);
|
|
28685
28772
|
if (animatorLayerData.layerState === LayerState.Standby) {
|
|
@@ -28723,7 +28810,7 @@
|
|
|
28723
28810
|
var propertyOwners = animationCurveOwners[instanceId];
|
|
28724
28811
|
for(var property in propertyOwners){
|
|
28725
28812
|
var owner = propertyOwners[property];
|
|
28726
|
-
owner.
|
|
28813
|
+
owner.revertDefaultValue();
|
|
28727
28814
|
}
|
|
28728
28815
|
}
|
|
28729
28816
|
this._animatorLayersData.length = 0;
|
|
@@ -28754,29 +28841,22 @@
|
|
|
28754
28841
|
stateInfo.state = state;
|
|
28755
28842
|
return stateInfo;
|
|
28756
28843
|
};
|
|
28757
|
-
_proto.
|
|
28758
|
-
var curveLayerOwner = stateData.curveLayerOwner;
|
|
28759
|
-
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
28760
|
-
var _curveLayerOwner_i;
|
|
28761
|
-
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.saveDefaultValue();
|
|
28762
|
-
}
|
|
28763
|
-
};
|
|
28764
|
-
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData) {
|
|
28844
|
+
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData, layerIndex) {
|
|
28765
28845
|
var animatorStateDataMap = animatorLayerData.animatorStateDataMap;
|
|
28766
28846
|
var animatorStateData = animatorStateDataMap[stateName];
|
|
28767
28847
|
if (!animatorStateData) {
|
|
28768
28848
|
animatorStateData = new AnimatorStateData();
|
|
28769
28849
|
animatorStateDataMap[stateName] = animatorStateData;
|
|
28770
|
-
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData);
|
|
28850
|
+
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex);
|
|
28771
28851
|
this._saveAnimatorEventHandlers(animatorState, animatorStateData);
|
|
28772
28852
|
}
|
|
28773
28853
|
return animatorStateData;
|
|
28774
28854
|
};
|
|
28775
|
-
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData) {
|
|
28855
|
+
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex) {
|
|
28776
28856
|
var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
|
|
28777
28857
|
var curveLayerOwner = animatorStateData.curveLayerOwner;
|
|
28778
|
-
var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
|
|
28779
28858
|
var _animatorState_clip = animatorState.clip, curves = _animatorState_clip._curveBindings;
|
|
28859
|
+
var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
|
|
28780
28860
|
for(var i = curves.length - 1; i >= 0; i--){
|
|
28781
28861
|
var curve = curves[i];
|
|
28782
28862
|
var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
|
|
@@ -28793,7 +28873,7 @@
|
|
|
28793
28873
|
curveLayerOwner[i] = layerOwner;
|
|
28794
28874
|
} else {
|
|
28795
28875
|
curveLayerOwner[i] = null;
|
|
28796
|
-
|
|
28876
|
+
Logger.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
|
|
28797
28877
|
}
|
|
28798
28878
|
}
|
|
28799
28879
|
};
|
|
@@ -28820,12 +28900,12 @@
|
|
|
28820
28900
|
};
|
|
28821
28901
|
_proto._clearCrossData = function _clearCrossData(animatorLayerData) {
|
|
28822
28902
|
animatorLayerData.crossCurveMark++;
|
|
28823
|
-
animatorLayerData.
|
|
28903
|
+
animatorLayerData.crossLayerOwnerCollection.length = 0;
|
|
28824
28904
|
};
|
|
28825
28905
|
_proto._addCrossOwner = function _addCrossOwner(animatorLayerData, layerOwner, curCurveIndex, nextCurveIndex) {
|
|
28826
28906
|
layerOwner.crossSrcCurveIndex = curCurveIndex;
|
|
28827
28907
|
layerOwner.crossDestCurveIndex = nextCurveIndex;
|
|
28828
|
-
animatorLayerData.
|
|
28908
|
+
animatorLayerData.crossLayerOwnerCollection.push(layerOwner);
|
|
28829
28909
|
};
|
|
28830
28910
|
_proto._prepareCrossFading = function _prepareCrossFading(animatorLayerData) {
|
|
28831
28911
|
// Add src cross curve data.
|
|
@@ -28840,10 +28920,10 @@
|
|
|
28840
28920
|
this._prepareDestCrossData(animatorLayerData, true);
|
|
28841
28921
|
};
|
|
28842
28922
|
_proto._prepareFixedPoseCrossFading = function _prepareFixedPoseCrossFading(animatorLayerData) {
|
|
28843
|
-
var
|
|
28923
|
+
var crossLayerOwnerCollection = animatorLayerData.crossLayerOwnerCollection;
|
|
28844
28924
|
// Save current cross curve data owner fixed pose.
|
|
28845
|
-
for(var i =
|
|
28846
|
-
var layerOwner =
|
|
28925
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
28926
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
28847
28927
|
if (!layerOwner) continue;
|
|
28848
28928
|
layerOwner.curveOwner.saveFixedPoseValue();
|
|
28849
28929
|
// Reset destCurveIndex When fixed pose crossFading again.
|
|
@@ -28871,7 +28951,6 @@
|
|
|
28871
28951
|
layerOwner.crossDestCurveIndex = i;
|
|
28872
28952
|
} else {
|
|
28873
28953
|
var owner = layerOwner.curveOwner;
|
|
28874
|
-
owner.saveDefaultValue();
|
|
28875
28954
|
saveFixed && owner.saveFixedPoseValue();
|
|
28876
28955
|
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
28877
28956
|
this._addCrossOwner(animatorLayerData, layerOwner, -1, i);
|
|
@@ -28889,7 +28968,7 @@
|
|
|
28889
28968
|
var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData, crossFadeTransitionInfo = layerData.crossFadeTransition;
|
|
28890
28969
|
var additive = blendingMode === exports.AnimatorLayerBlendingMode.Additive;
|
|
28891
28970
|
firstLayer && (weight = 1.0);
|
|
28892
|
-
|
|
28971
|
+
//@todo: All situations should be checked, optimizations will follow later.
|
|
28893
28972
|
layerData.layerState !== LayerState.FixedCrossFading && this._checkTransition(srcPlayData, crossFadeTransitionInfo, layerIndex);
|
|
28894
28973
|
switch(layerData.layerState){
|
|
28895
28974
|
case LayerState.Playing:
|
|
@@ -28901,6 +28980,9 @@
|
|
|
28901
28980
|
case LayerState.CrossFading:
|
|
28902
28981
|
this._updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, deltaTime, additive, aniUpdate);
|
|
28903
28982
|
break;
|
|
28983
|
+
case LayerState.Finished:
|
|
28984
|
+
this._updateFinishedState(srcPlayData, weight, additive, aniUpdate);
|
|
28985
|
+
break;
|
|
28904
28986
|
}
|
|
28905
28987
|
};
|
|
28906
28988
|
_proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
@@ -28908,19 +28990,27 @@
|
|
|
28908
28990
|
var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
|
|
28909
28991
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
28910
28992
|
playData.update(this.speed < 0);
|
|
28911
|
-
if (!aniUpdate) {
|
|
28912
|
-
return;
|
|
28913
|
-
}
|
|
28914
28993
|
var clipTime = playData.clipTime, playState = playData.playState;
|
|
28915
|
-
|
|
28916
|
-
|
|
28917
|
-
var
|
|
28918
|
-
|
|
28994
|
+
var finished = playState === AnimatorStatePlayState.Finished;
|
|
28995
|
+
if (aniUpdate || finished) {
|
|
28996
|
+
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
28997
|
+
var layerOwner = curveLayerOwner[i];
|
|
28998
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
28999
|
+
if (!owner) continue;
|
|
29000
|
+
var curve = curveBindings[i].curve;
|
|
29001
|
+
if (curve.keys.length) {
|
|
29002
|
+
this._checkRevertOwner(owner, additive);
|
|
29003
|
+
var value = owner.evaluateValue(curve, clipTime, additive);
|
|
29004
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
29005
|
+
finished && layerOwner.saveFinalValue();
|
|
29006
|
+
}
|
|
29007
|
+
}
|
|
28919
29008
|
}
|
|
28920
29009
|
playData.frameTime += state.speed * delta;
|
|
28921
29010
|
if (playState === AnimatorStatePlayState.Finished) {
|
|
28922
|
-
layerData.layerState = LayerState.
|
|
29011
|
+
layerData.layerState = LayerState.Finished;
|
|
28923
29012
|
}
|
|
29013
|
+
eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
28924
29014
|
if (lastPlayState === AnimatorStatePlayState.UnStarted) {
|
|
28925
29015
|
this._callAnimatorScriptOnEnter(state, layerIndex);
|
|
28926
29016
|
}
|
|
@@ -28931,7 +29021,7 @@
|
|
|
28931
29021
|
}
|
|
28932
29022
|
};
|
|
28933
29023
|
_proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
28934
|
-
var
|
|
29024
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
28935
29025
|
var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
|
|
28936
29026
|
var srcState = srcPlayData.state, srcStateData = srcPlayData.stateData, lastSrcPlayState = srcPlayData.playState;
|
|
28937
29027
|
var srcEventHandlers = srcStateData.eventHandlers;
|
|
@@ -28940,18 +29030,28 @@
|
|
|
28940
29030
|
var _destState_clip = destState.clip, destCurves = _destState_clip._curveBindings;
|
|
28941
29031
|
var lastSrcClipTime = srcPlayData.clipTime;
|
|
28942
29032
|
var lastDestClipTime = destPlayData.clipTime;
|
|
28943
|
-
var
|
|
28944
|
-
crossWeight
|
|
29033
|
+
var duration = destState._getDuration() * layerData.crossFadeTransition.duration;
|
|
29034
|
+
var crossWeight = Math.abs(destPlayData.frameTime) / duration;
|
|
29035
|
+
(crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
|
|
28945
29036
|
srcPlayData.update(this.speed < 0);
|
|
28946
29037
|
destPlayData.update(this.speed < 0);
|
|
28947
|
-
var srcPlayState = srcPlayData.playState;
|
|
28948
|
-
var destPlayState = destPlayData.playState;
|
|
28949
|
-
|
|
28950
|
-
if (
|
|
28951
|
-
|
|
29038
|
+
var srcClipTime = srcPlayData.clipTime, srcPlayState = srcPlayData.playState;
|
|
29039
|
+
var destClipTime = destPlayData.clipTime, destPlayState = destPlayData.playState;
|
|
29040
|
+
var finished = destPlayData.playState === AnimatorStatePlayState.Finished;
|
|
29041
|
+
if (aniUpdate || finished) {
|
|
29042
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
29043
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
29044
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
29045
|
+
if (!owner) continue;
|
|
29046
|
+
var srcCurveIndex = layerOwner.crossSrcCurveIndex;
|
|
29047
|
+
var destCurveIndex = layerOwner.crossDestCurveIndex;
|
|
29048
|
+
this._checkRevertOwner(owner, additive);
|
|
29049
|
+
var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
|
|
29050
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
29051
|
+
finished && layerOwner.saveFinalValue();
|
|
29052
|
+
}
|
|
28952
29053
|
}
|
|
28953
|
-
|
|
28954
|
-
var destClipTime = destPlayData.clipTime;
|
|
29054
|
+
this._updateCrossFadeData(layerData, crossWeight, delta, false);
|
|
28955
29055
|
srcEventHandlers.length && this._fireAnimationEvents(srcPlayData, srcEventHandlers, lastSrcClipTime, srcClipTime);
|
|
28956
29056
|
destEventHandlers.length && this._fireAnimationEvents(destPlayData, destEventHandlers, lastDestClipTime, destClipTime);
|
|
28957
29057
|
if (lastSrcPlayState === AnimatorStatePlayState.UnStarted) {
|
|
@@ -28970,30 +29070,35 @@
|
|
|
28970
29070
|
} else {
|
|
28971
29071
|
this._callAnimatorScriptOnUpdate(destState, layerIndex);
|
|
28972
29072
|
}
|
|
28973
|
-
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
28974
|
-
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
28975
|
-
if (!layerOwner) continue;
|
|
28976
|
-
var srcCurveIndex = layerOwner.crossSrcCurveIndex;
|
|
28977
|
-
var destCurveIndex = layerOwner.crossDestCurveIndex;
|
|
28978
|
-
layerOwner.curveOwner.crossFadeAndApplyValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
|
|
28979
|
-
}
|
|
28980
29073
|
};
|
|
28981
|
-
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex,
|
|
28982
|
-
var
|
|
29074
|
+
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
29075
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
28983
29076
|
var state = destPlayData.state, stateData = destPlayData.stateData, lastPlayState = destPlayData.playState;
|
|
28984
29077
|
var eventHandlers = stateData.eventHandlers;
|
|
28985
29078
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
28986
29079
|
var lastDestClipTime = destPlayData.clipTime;
|
|
28987
|
-
var
|
|
28988
|
-
crossWeight
|
|
29080
|
+
var duration = state._getDuration() * layerData.crossFadeTransition.duration;
|
|
29081
|
+
var crossWeight = Math.abs(destPlayData.frameTime) / duration;
|
|
29082
|
+
(crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
|
|
28989
29083
|
destPlayData.update(this.speed < 0);
|
|
28990
29084
|
var playState = destPlayData.playState;
|
|
28991
29085
|
this._updateCrossFadeData(layerData, crossWeight, delta, true);
|
|
28992
|
-
if (!aniUpdate) {
|
|
28993
|
-
return;
|
|
28994
|
-
}
|
|
28995
29086
|
var destClipTime = destPlayData.clipTime;
|
|
28996
|
-
|
|
29087
|
+
var finished = playState === AnimatorStatePlayState.Finished;
|
|
29088
|
+
// 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.
|
|
29089
|
+
if (aniUpdate || finished) {
|
|
29090
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
29091
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
29092
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
29093
|
+
if (!owner) continue;
|
|
29094
|
+
var curveIndex = layerOwner.crossDestCurveIndex;
|
|
29095
|
+
this._checkRevertOwner(owner, additive);
|
|
29096
|
+
var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
|
|
29097
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
29098
|
+
finished && layerOwner.saveFinalValue();
|
|
29099
|
+
}
|
|
29100
|
+
}
|
|
29101
|
+
//@todo: srcState is missing the judgment of the most recent period."
|
|
28997
29102
|
eventHandlers.length && this._fireAnimationEvents(destPlayData, eventHandlers, lastDestClipTime, destClipTime);
|
|
28998
29103
|
if (lastPlayState === AnimatorStatePlayState.UnStarted) {
|
|
28999
29104
|
this._callAnimatorScriptOnEnter(state, layerIndex);
|
|
@@ -29003,11 +29108,19 @@
|
|
|
29003
29108
|
} else {
|
|
29004
29109
|
this._callAnimatorScriptOnUpdate(state, layerIndex);
|
|
29005
29110
|
}
|
|
29006
|
-
|
|
29007
|
-
|
|
29008
|
-
|
|
29009
|
-
|
|
29010
|
-
|
|
29111
|
+
};
|
|
29112
|
+
_proto._updateFinishedState = function _updateFinishedState(playData, weight, additive, aniUpdate) {
|
|
29113
|
+
if (!aniUpdate) {
|
|
29114
|
+
return;
|
|
29115
|
+
}
|
|
29116
|
+
var curveLayerOwner = playData.stateData.curveLayerOwner;
|
|
29117
|
+
var _playData_state_clip = playData.state.clip, curveBindings = _playData_state_clip._curveBindings;
|
|
29118
|
+
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
29119
|
+
var layerOwner = curveLayerOwner[i];
|
|
29120
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
29121
|
+
if (!owner) continue;
|
|
29122
|
+
this._checkRevertOwner(owner, additive);
|
|
29123
|
+
owner.applyValue(layerOwner.finalValue, weight, additive);
|
|
29011
29124
|
}
|
|
29012
29125
|
};
|
|
29013
29126
|
_proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
|
|
@@ -29015,7 +29128,7 @@
|
|
|
29015
29128
|
destPlayData.frameTime += destPlayData.state.speed * delta;
|
|
29016
29129
|
if (crossWeight === 1.0) {
|
|
29017
29130
|
if (destPlayData.playState === AnimatorStatePlayState.Finished) {
|
|
29018
|
-
layerData.layerState = LayerState.
|
|
29131
|
+
layerData.layerState = LayerState.Finished;
|
|
29019
29132
|
} else {
|
|
29020
29133
|
layerData.layerState = LayerState.Playing;
|
|
29021
29134
|
}
|
|
@@ -29025,26 +29138,22 @@
|
|
|
29025
29138
|
fixed || (layerData.srcPlayData.frameTime += layerData.srcPlayData.state.speed * delta);
|
|
29026
29139
|
}
|
|
29027
29140
|
};
|
|
29028
|
-
_proto._preparePlay = function _preparePlay(layerData, playState
|
|
29141
|
+
_proto._preparePlay = function _preparePlay(layerData, playState) {
|
|
29029
29142
|
if (layerData.layerState === LayerState.Playing) {
|
|
29030
29143
|
var srcPlayData = layerData.srcPlayData;
|
|
29031
29144
|
if (srcPlayData.state !== playState) {
|
|
29032
29145
|
var curveLayerOwner = srcPlayData.stateData.curveLayerOwner;
|
|
29033
29146
|
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
29034
29147
|
var _curveLayerOwner_i;
|
|
29035
|
-
|
|
29036
|
-
(owner == null ? void 0 : owner.hasSavedDefaultValue) && owner.revertDefaultValue();
|
|
29148
|
+
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.revertDefaultValue();
|
|
29037
29149
|
}
|
|
29038
|
-
this._saveDefaultValues(playStateData);
|
|
29039
29150
|
}
|
|
29040
29151
|
} else {
|
|
29041
|
-
// layerState is CrossFading, FixedCrossFading, Standby
|
|
29042
|
-
var
|
|
29043
|
-
for(var i1 =
|
|
29044
|
-
|
|
29045
|
-
owner1.hasSavedDefaultValue && owner1.revertDefaultValue();
|
|
29152
|
+
// layerState is CrossFading, FixedCrossFading, Standby, Finished
|
|
29153
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
29154
|
+
for(var i1 = crossLayerOwnerCollection.length - 1; i1 >= 0; i1--){
|
|
29155
|
+
crossLayerOwnerCollection[i1].curveOwner.revertDefaultValue();
|
|
29046
29156
|
}
|
|
29047
|
-
this._saveDefaultValues(playStateData);
|
|
29048
29157
|
}
|
|
29049
29158
|
};
|
|
29050
29159
|
_proto._checkTransition = function _checkTransition(stateData, crossFadeTransition, layerIndex) {
|
|
@@ -29061,24 +29170,24 @@
|
|
|
29061
29170
|
_proto._crossFadeByTransition = function _crossFadeByTransition(transition, layerIndex) {
|
|
29062
29171
|
var name = transition.destinationState.name;
|
|
29063
29172
|
var stateInfo = this._getAnimatorStateInfo(name, layerIndex);
|
|
29064
|
-
var crossState = stateInfo.state;
|
|
29173
|
+
var crossState = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
|
|
29065
29174
|
if (!crossState) {
|
|
29066
29175
|
return;
|
|
29067
29176
|
}
|
|
29068
29177
|
if (!crossState.clip) {
|
|
29069
|
-
|
|
29178
|
+
Logger.warn("The state named " + name + " has no AnimationClip data.");
|
|
29070
29179
|
return;
|
|
29071
29180
|
}
|
|
29072
|
-
var animatorLayerData = this._getAnimatorLayerData(
|
|
29181
|
+
var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
|
|
29073
29182
|
var layerState = animatorLayerData.layerState;
|
|
29074
29183
|
var destPlayData = animatorLayerData.destPlayData;
|
|
29075
|
-
var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData);
|
|
29184
|
+
var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData, playLayerIndex);
|
|
29076
29185
|
var duration = crossState._getDuration();
|
|
29077
29186
|
var offset = duration * transition.offset;
|
|
29078
29187
|
destPlayData.reset(crossState, animatorStateData, offset);
|
|
29079
29188
|
switch(layerState){
|
|
29080
|
-
// Maybe not play, maybe end.
|
|
29081
29189
|
case LayerState.Standby:
|
|
29190
|
+
case LayerState.Finished:
|
|
29082
29191
|
animatorLayerData.layerState = LayerState.FixedCrossFading;
|
|
29083
29192
|
this._clearCrossData(animatorLayerData);
|
|
29084
29193
|
this._prepareStandbyCrossFading(animatorLayerData);
|
|
@@ -29180,6 +29289,12 @@
|
|
|
29180
29289
|
}
|
|
29181
29290
|
}
|
|
29182
29291
|
};
|
|
29292
|
+
_proto._checkRevertOwner = function _checkRevertOwner(owner, additive) {
|
|
29293
|
+
if (additive && owner.updateMark !== this._updateMark) {
|
|
29294
|
+
owner.revertDefaultValue();
|
|
29295
|
+
}
|
|
29296
|
+
owner.updateMark = this._updateMark;
|
|
29297
|
+
};
|
|
29183
29298
|
_create_class$3(Animator, [
|
|
29184
29299
|
{
|
|
29185
29300
|
key: "animatorController",
|
|
@@ -29206,6 +29321,9 @@
|
|
|
29206
29321
|
__decorate$1([
|
|
29207
29322
|
ignoreClone
|
|
29208
29323
|
], Animator.prototype, "_controllerUpdateFlag", void 0);
|
|
29324
|
+
__decorate$1([
|
|
29325
|
+
ignoreClone
|
|
29326
|
+
], Animator.prototype, "_updateMark", void 0);
|
|
29209
29327
|
__decorate$1([
|
|
29210
29328
|
ignoreClone
|
|
29211
29329
|
], Animator.prototype, "_animatorLayersData", void 0);
|
|
@@ -38178,7 +38296,7 @@
|
|
|
38178
38296
|
], GALACEAN_animation_event);
|
|
38179
38297
|
|
|
38180
38298
|
//@ts-ignore
|
|
38181
|
-
var version = "1.0.0-beta.
|
|
38299
|
+
var version = "1.0.0-beta.14";
|
|
38182
38300
|
console.log("Galacean engine version: " + version);
|
|
38183
38301
|
for(var key in CoreObjects){
|
|
38184
38302
|
Loader.registerClass(key, CoreObjects[key]);
|