@galacean/engine-core 0.0.0-experimental-shaderlab.2 → 0.0.0-experimental-stateMachine.0
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 +403 -74
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +403 -74
- package/dist/module.js +403 -74
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/animation/Animator.d.ts +30 -1
- package/types/animation/AnimatorCondition.d.ts +13 -0
- package/types/animation/AnimatorController.d.ts +21 -2
- package/types/animation/AnimatorControllerParameter.d.ts +10 -0
- package/types/animation/AnimatorState.d.ts +17 -4
- package/types/animation/AnimatorStateMachine.d.ts +39 -0
- package/types/animation/AnimatorTransition.d.ts +33 -0
- package/types/asset/AssetType.d.ts +0 -4
- package/types/RenderPipeline/MeshRenderData.d.ts +0 -17
- package/types/RenderPipeline/RenderPass.d.ts +0 -55
- package/types/physics/PhysicsManager.d.ts +0 -76
- package/types/renderingHardwareInterface/IHardwareRenderer.d.ts +0 -6
- /package/types/RenderPipeline/{Index.d.ts → index.d.ts} +0 -0
package/dist/main.js
CHANGED
|
@@ -4940,7 +4940,8 @@ __decorate([
|
|
|
4940
4940
|
}
|
|
4941
4941
|
var shaderInfo = Shader._shaderLab.parseShader(nameOrShaderSource);
|
|
4942
4942
|
if (shaderMap[shaderInfo.name]) {
|
|
4943
|
-
|
|
4943
|
+
console.error('Shader named "' + shaderInfo.name + '" already exists.');
|
|
4944
|
+
return;
|
|
4944
4945
|
}
|
|
4945
4946
|
var subShaderList = shaderInfo.subShaders.map(function(subShaderInfo) {
|
|
4946
4947
|
var passList = subShaderInfo.passes.map(function(passInfo) {
|
|
@@ -4979,7 +4980,8 @@ __decorate([
|
|
|
4979
4980
|
return shader;
|
|
4980
4981
|
} else {
|
|
4981
4982
|
if (shaderMap[nameOrShaderSource]) {
|
|
4982
|
-
|
|
4983
|
+
console.error('Shader named "' + nameOrShaderSource + '" already exists.');
|
|
4984
|
+
return;
|
|
4983
4985
|
}
|
|
4984
4986
|
if (typeof vertexSourceOrShaderPassesOrSubShaders === "string") {
|
|
4985
4987
|
var shaderPass = new ShaderPass(vertexSourceOrShaderPassesOrSubShaders, fragmentSource);
|
|
@@ -16085,8 +16087,6 @@ var TextRenderData = /*#__PURE__*/ function(RenderData1) {
|
|
|
16085
16087
|
AssetType[/** 2D Texture. */ "Texture2D"] = "Texture2D";
|
|
16086
16088
|
AssetType[/** Cube Texture. */ "TextureCube"] = "TextureCube";
|
|
16087
16089
|
AssetType[/** Material. */ "Material"] = "Material";
|
|
16088
|
-
AssetType[/** Shader */ "Shader"] = "Shader";
|
|
16089
|
-
AssetType[/** Shader Chunk */ "ShaderChunk"] = "ShaderChunk";
|
|
16090
16090
|
AssetType[/** Mesh. */ "Mesh"] = "Mesh";
|
|
16091
16091
|
AssetType[/** AnimationClip. */ "AnimationClip"] = "AnimationClip";
|
|
16092
16092
|
AssetType[/** AnimatorController. */ "AnimatorController"] = "AnimatorController";
|
|
@@ -22128,9 +22128,10 @@ __decorate([
|
|
|
22128
22128
|
*/ _proto._updateShaderData = function _updateShaderData(shaderData) {
|
|
22129
22129
|
var _this = this, spotLight = _this._spotLights, pointLight = _this._pointLights, directLight = _this._directLights;
|
|
22130
22130
|
var _this1 = this, spotData = _this1._spotData, pointData = _this1._pointData, directData = _this1._directData;
|
|
22131
|
-
var
|
|
22132
|
-
var
|
|
22133
|
-
var
|
|
22131
|
+
var maxLight = LightManager._maxLight;
|
|
22132
|
+
var spotLightCount = Math.min(spotLight.length, maxLight);
|
|
22133
|
+
var pointLightCount = Math.min(pointLight.length, maxLight);
|
|
22134
|
+
var directLightCount = Math.min(directLight.length, maxLight);
|
|
22134
22135
|
for(var i = 0; i < spotLightCount; i++){
|
|
22135
22136
|
spotLight.get(i)._appendData(i, spotData);
|
|
22136
22137
|
}
|
|
@@ -26952,13 +26953,71 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
26952
26953
|
}();
|
|
26953
26954
|
|
|
26954
26955
|
/**
|
|
26955
|
-
*
|
|
26956
|
-
*/ var
|
|
26957
|
-
/** The duration of the transition. This is represented in normalized time. */ this.duration = 0;
|
|
26958
|
-
/** The time at which the destination state will start. This is represented in normalized time. */ this.offset = 0;
|
|
26959
|
-
/** ExitTime represents the exact time at which the transition can take effect. This is represented in normalized time. */ this.exitTime = 1;
|
|
26956
|
+
* Condition that is used to determine if a transition must be taken.
|
|
26957
|
+
*/ var AnimatorCondition = function AnimatorCondition() {
|
|
26960
26958
|
};
|
|
26961
26959
|
|
|
26960
|
+
/**
|
|
26961
|
+
* Transitions define when and how the state machine switch from on state to another. AnimatorTransition always originate from a StateMachine or a StateMachine entry.
|
|
26962
|
+
*/ var AnimatorStateTransition = /*#__PURE__*/ function() {
|
|
26963
|
+
function AnimatorStateTransition() {
|
|
26964
|
+
/** The duration of the transition. This is represented in normalized time. */ this.duration = 0;
|
|
26965
|
+
/** The time at which the destination state will start. This is represented in normalized time. */ this.offset = 0;
|
|
26966
|
+
/** ExitTime represents the exact time at which the transition can take effect. This is represented in normalized time. */ this.exitTime = 1;
|
|
26967
|
+
/** Mutes the transition. The transition will never occur. */ this.mute = false;
|
|
26968
|
+
/** Is the transition destination the exit of the current state machine. */ this.isExit = false;
|
|
26969
|
+
this._conditions = [];
|
|
26970
|
+
this._solo = false;
|
|
26971
|
+
}
|
|
26972
|
+
var _proto = AnimatorStateTransition.prototype;
|
|
26973
|
+
_proto.addCondition = function addCondition(param, parameter, threshold) {
|
|
26974
|
+
if (typeof param === "object") {
|
|
26975
|
+
this._conditions.push(param);
|
|
26976
|
+
return param;
|
|
26977
|
+
} else {
|
|
26978
|
+
var condition = new AnimatorCondition();
|
|
26979
|
+
condition.mode = param;
|
|
26980
|
+
condition.parameter = parameter;
|
|
26981
|
+
condition.threshold = threshold;
|
|
26982
|
+
this._conditions.push(condition);
|
|
26983
|
+
return condition;
|
|
26984
|
+
}
|
|
26985
|
+
};
|
|
26986
|
+
/**
|
|
26987
|
+
* Remove a condition from the transition.
|
|
26988
|
+
* @param condition - The condition to remove
|
|
26989
|
+
*/ _proto.removeCondition = function removeCondition(condition) {
|
|
26990
|
+
var index = this._conditions.indexOf(condition);
|
|
26991
|
+
index !== -1 && this._conditions.splice(index, 1);
|
|
26992
|
+
};
|
|
26993
|
+
_create_class(AnimatorStateTransition, [
|
|
26994
|
+
{
|
|
26995
|
+
key: "solo",
|
|
26996
|
+
get: /** Mutes all other transitions in the source state. */ function get() {
|
|
26997
|
+
return this._solo;
|
|
26998
|
+
},
|
|
26999
|
+
set: function set(value) {
|
|
27000
|
+
if (this._solo === value) return;
|
|
27001
|
+
this._solo = value;
|
|
27002
|
+
if (value) {
|
|
27003
|
+
this._srcState && this._srcState._updateSoloTransition(true);
|
|
27004
|
+
} else {
|
|
27005
|
+
this._srcState && this._srcState._updateSoloTransition();
|
|
27006
|
+
}
|
|
27007
|
+
}
|
|
27008
|
+
},
|
|
27009
|
+
{
|
|
27010
|
+
key: "conditions",
|
|
27011
|
+
get: /**
|
|
27012
|
+
* The conditions in the transition.
|
|
27013
|
+
*/ function get() {
|
|
27014
|
+
return this._conditions;
|
|
27015
|
+
}
|
|
27016
|
+
}
|
|
27017
|
+
]);
|
|
27018
|
+
return AnimatorStateTransition;
|
|
27019
|
+
}();
|
|
27020
|
+
|
|
26962
27021
|
/**
|
|
26963
27022
|
* Animation wrap mode.
|
|
26964
27023
|
*/ exports.WrapMode = void 0;
|
|
@@ -27034,6 +27093,16 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
27034
27093
|
this.eventHandlers = [];
|
|
27035
27094
|
};
|
|
27036
27095
|
|
|
27096
|
+
exports.AnimatorConditionMode = void 0;
|
|
27097
|
+
(function(AnimatorConditionMode) {
|
|
27098
|
+
AnimatorConditionMode[AnimatorConditionMode["If"] = 0] = "If";
|
|
27099
|
+
AnimatorConditionMode[AnimatorConditionMode["IfNot"] = 1] = "IfNot";
|
|
27100
|
+
AnimatorConditionMode[AnimatorConditionMode["Greater"] = 2] = "Greater";
|
|
27101
|
+
AnimatorConditionMode[AnimatorConditionMode["Less"] = 3] = "Less";
|
|
27102
|
+
AnimatorConditionMode[AnimatorConditionMode["Equals"] = 4] = "Equals";
|
|
27103
|
+
AnimatorConditionMode[AnimatorConditionMode["NotEquals"] = 5] = "NotEquals";
|
|
27104
|
+
})(exports.AnimatorConditionMode || (exports.AnimatorConditionMode = {}));
|
|
27105
|
+
|
|
27037
27106
|
/**
|
|
27038
27107
|
* The controller of the animation system.
|
|
27039
27108
|
*/ var Animator = /*#__PURE__*/ function(Component1) {
|
|
@@ -27086,26 +27155,29 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
27086
27155
|
animatorLayerData.srcPlayData.reset(state, animatorStateData, state._getDuration() * normalizedTimeOffset);
|
|
27087
27156
|
this.update(0);
|
|
27088
27157
|
};
|
|
27089
|
-
|
|
27090
|
-
* Create a cross fade from the current state to another state.
|
|
27091
|
-
* @param stateName - The state name
|
|
27092
|
-
* @param normalizedTransitionDuration - The duration of the transition (normalized)
|
|
27093
|
-
* @param layerIndex - The layer index(default -1). If layer is -1, play the first state with the given state name
|
|
27094
|
-
* @param normalizedTimeOffset - The time offset between 0 and 1(default 0)
|
|
27095
|
-
*/ _proto.crossFade = function crossFade(stateName, normalizedTransitionDuration, layerIndex, normalizedTimeOffset) {
|
|
27158
|
+
_proto.crossFade = function crossFade(stateNameOrTransition, normalizedTransitionDurationOrLayerIndex, layerIndex, normalizedTimeOffset) {
|
|
27096
27159
|
if (layerIndex === void 0) layerIndex = -1;
|
|
27097
27160
|
if (normalizedTimeOffset === void 0) normalizedTimeOffset = 0;
|
|
27098
|
-
var
|
|
27099
|
-
|
|
27100
|
-
|
|
27161
|
+
var state;
|
|
27162
|
+
var playLayerIndex;
|
|
27163
|
+
var normalizedTransitionDuration;
|
|
27164
|
+
var transition;
|
|
27165
|
+
if (typeof stateNameOrTransition === "string") {
|
|
27166
|
+
var info = this._getAnimatorStateInfo(stateNameOrTransition, layerIndex);
|
|
27167
|
+
state = info.state;
|
|
27168
|
+
playLayerIndex = info.layerIndex;
|
|
27169
|
+
normalizedTransitionDuration = normalizedTransitionDurationOrLayerIndex;
|
|
27170
|
+
var manuallyTransition = this._getAnimatorLayerData(playLayerIndex).manuallyTransition;
|
|
27171
|
+
manuallyTransition.duration = normalizedTransitionDuration;
|
|
27172
|
+
manuallyTransition.offset = normalizedTimeOffset;
|
|
27173
|
+
manuallyTransition.destinationState = state;
|
|
27174
|
+
transition = manuallyTransition;
|
|
27175
|
+
} else {
|
|
27176
|
+
state = stateNameOrTransition.destinationState;
|
|
27177
|
+
playLayerIndex = normalizedTransitionDurationOrLayerIndex != null ? normalizedTransitionDurationOrLayerIndex : this._getAnimatorStateInfo(state.name, playLayerIndex).layerIndex;
|
|
27178
|
+
transition = stateNameOrTransition;
|
|
27101
27179
|
}
|
|
27102
|
-
this.
|
|
27103
|
-
var _this__getAnimatorStateInfo = this._getAnimatorStateInfo(stateName, layerIndex), state = _this__getAnimatorStateInfo.state, playLayerIndex = _this__getAnimatorStateInfo.layerIndex;
|
|
27104
|
-
var manuallyTransition = this._getAnimatorLayerData(playLayerIndex).manuallyTransition;
|
|
27105
|
-
manuallyTransition.duration = normalizedTransitionDuration;
|
|
27106
|
-
manuallyTransition.offset = normalizedTimeOffset;
|
|
27107
|
-
manuallyTransition.destinationState = state;
|
|
27108
|
-
if (this._crossFadeByTransition(manuallyTransition, playLayerIndex)) {
|
|
27180
|
+
if (this._crossFadeByTransition(transition, playLayerIndex)) {
|
|
27109
27181
|
this.update(0);
|
|
27110
27182
|
}
|
|
27111
27183
|
};
|
|
@@ -27132,7 +27204,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
27132
27204
|
return;
|
|
27133
27205
|
}
|
|
27134
27206
|
if ((_this__controllerUpdateFlag = this._controllerUpdateFlag) == null ? void 0 : _this__controllerUpdateFlag.flag) {
|
|
27135
|
-
this.
|
|
27207
|
+
this._checkEntryState();
|
|
27136
27208
|
return;
|
|
27137
27209
|
}
|
|
27138
27210
|
this._updateMark++;
|
|
@@ -27160,9 +27232,31 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
27160
27232
|
return this._getAnimatorStateInfo(stateName, layerIndex).state;
|
|
27161
27233
|
};
|
|
27162
27234
|
/**
|
|
27235
|
+
* Get the layer by name.
|
|
27236
|
+
* @param name - The layer's name.
|
|
27237
|
+
*/ _proto.findLayerByName = function findLayerByName(name1) {
|
|
27238
|
+
return this._animatorController._layersMap[name1];
|
|
27239
|
+
};
|
|
27240
|
+
/**
|
|
27241
|
+
* Get the parameter by name.
|
|
27242
|
+
* @param name - The name of the parameter
|
|
27243
|
+
*/ _proto.getParameter = function getParameter(name1) {
|
|
27244
|
+
return this._animatorController._parametersMap[name1] || null;
|
|
27245
|
+
};
|
|
27246
|
+
/**
|
|
27247
|
+
* Set the value of the given parameter.
|
|
27248
|
+
* @param name - The name of the parameter
|
|
27249
|
+
*/ _proto.setParameter = function setParameter(name1, value) {
|
|
27250
|
+
var controller = this._animatorController;
|
|
27251
|
+
var parameter = controller._parametersMap[name1];
|
|
27252
|
+
if (parameter) {
|
|
27253
|
+
parameter.value = value;
|
|
27254
|
+
}
|
|
27255
|
+
};
|
|
27256
|
+
/**
|
|
27163
27257
|
* @internal
|
|
27164
27258
|
*/ _proto._onEnable = function _onEnable() {
|
|
27165
|
-
this.animatorController && this.
|
|
27259
|
+
this.animatorController && this._checkEntryState();
|
|
27166
27260
|
this._entity.getComponentsIncludeChildren(exports.Renderer, this._controlledRenderers);
|
|
27167
27261
|
};
|
|
27168
27262
|
/**
|
|
@@ -27236,20 +27330,19 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
27236
27330
|
var relativePath = curve.relativePath;
|
|
27237
27331
|
var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
|
|
27238
27332
|
if (targetEntity) {
|
|
27239
|
-
var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners,
|
|
27240
|
-
var propertyPath = "" + curve.typeIndex + "." + curve.property;
|
|
27333
|
+
var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
|
|
27241
27334
|
var component = curve.typeIndex > 0 ? targetEntity.getComponents(curve.type, AnimationCurveOwner._components)[curve.typeIndex] : targetEntity.getComponent(curve.type);
|
|
27242
27335
|
if (!component) {
|
|
27243
27336
|
continue;
|
|
27244
27337
|
}
|
|
27245
27338
|
var property = curve.property;
|
|
27246
|
-
var instanceId =
|
|
27339
|
+
var instanceId = component.instanceId;
|
|
27247
27340
|
// Get owner
|
|
27248
27341
|
var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
|
|
27249
27342
|
var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity, component));
|
|
27250
27343
|
// Get layer owner
|
|
27251
27344
|
var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
|
|
27252
|
-
var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[
|
|
27345
|
+
var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
|
|
27253
27346
|
if (mask && mask.pathMasks.length) {
|
|
27254
27347
|
var _mask_getPathMask;
|
|
27255
27348
|
var _mask_getPathMask_active;
|
|
@@ -27354,7 +27447,8 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
27354
27447
|
return animatorLayerData;
|
|
27355
27448
|
};
|
|
27356
27449
|
_proto._updateLayer = function _updateLayer(layerIndex, firstLayer, deltaTime, aniUpdate) {
|
|
27357
|
-
var _this__animatorController_layers_layerIndex = this._animatorController.layers[layerIndex], blendingMode = _this__animatorController_layers_layerIndex.blendingMode, weight = _this__animatorController_layers_layerIndex.weight;
|
|
27450
|
+
var _this__animatorController_layers_layerIndex = this._animatorController.layers[layerIndex], blendingMode = _this__animatorController_layers_layerIndex.blendingMode, weight = _this__animatorController_layers_layerIndex.weight, stateMachine = _this__animatorController_layers_layerIndex.stateMachine;
|
|
27451
|
+
if (!stateMachine) return;
|
|
27358
27452
|
var layerData = this._animatorLayersData[layerIndex];
|
|
27359
27453
|
var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData;
|
|
27360
27454
|
var additive = blendingMode === exports.AnimatorLayerBlendingMode.Additive;
|
|
@@ -27379,6 +27473,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
27379
27473
|
var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
|
|
27380
27474
|
var transitions = state.transitions;
|
|
27381
27475
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
27476
|
+
var anyStateTransitions = this.layers[layerIndex].stateMachine.anyStateTransitions;
|
|
27382
27477
|
var speed = state.speed * this.speed;
|
|
27383
27478
|
playData.frameTime += speed * delta;
|
|
27384
27479
|
playData.update(speed < 0);
|
|
@@ -27411,10 +27506,10 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
27411
27506
|
} else {
|
|
27412
27507
|
this._callAnimatorScriptOnUpdate(state, layerIndex);
|
|
27413
27508
|
}
|
|
27414
|
-
if (transitions.length) {
|
|
27509
|
+
if (transitions.length || anyStateTransitions.length) {
|
|
27415
27510
|
var layerState = layerData.layerState;
|
|
27416
27511
|
if (layerState !== LayerState.CrossFading && layerState !== LayerState.FixedCrossFading) {
|
|
27417
|
-
this._checkTransition(playData, transitions, layerIndex, lastClipTime, clipTime);
|
|
27512
|
+
this._checkTransition(playData, transitions, anyStateTransitions, layerIndex, lastClipTime, clipTime);
|
|
27418
27513
|
}
|
|
27419
27514
|
}
|
|
27420
27515
|
};
|
|
@@ -27560,43 +27655,61 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
27560
27655
|
}
|
|
27561
27656
|
}
|
|
27562
27657
|
};
|
|
27563
|
-
_proto._checkTransition = function _checkTransition(playState, transitions, layerIndex, lastClipTime, clipTime) {
|
|
27658
|
+
_proto._checkTransition = function _checkTransition(playState, transitions, anyStateTransitions, layerIndex, lastClipTime, clipTime) {
|
|
27564
27659
|
var state = playState.state;
|
|
27565
27660
|
var clipDuration = state.clip.length;
|
|
27661
|
+
var targetTransition = null;
|
|
27566
27662
|
if (this.speed * state.speed >= 0) {
|
|
27567
27663
|
if (clipTime < lastClipTime) {
|
|
27568
|
-
this._checkSubTransition(playState, transitions, layerIndex, lastClipTime, state.clipEndTime * clipDuration);
|
|
27569
|
-
|
|
27570
|
-
|
|
27664
|
+
targetTransition = this._checkSubTransition(playState, transitions, layerIndex, lastClipTime, state.clipEndTime * clipDuration);
|
|
27665
|
+
if (!targetTransition) {
|
|
27666
|
+
playState.currentTransitionIndex = 0;
|
|
27667
|
+
targetTransition = this._checkSubTransition(playState, transitions, layerIndex, state.clipStartTime * clipDuration, clipTime);
|
|
27668
|
+
}
|
|
27571
27669
|
} else {
|
|
27572
|
-
this._checkSubTransition(playState, transitions, layerIndex, lastClipTime, clipTime);
|
|
27670
|
+
targetTransition = this._checkSubTransition(playState, transitions, layerIndex, lastClipTime, clipTime);
|
|
27573
27671
|
}
|
|
27574
27672
|
} else {
|
|
27575
27673
|
if (clipTime > lastClipTime) {
|
|
27576
|
-
this._checkBackwardsSubTransition(playState, transitions, layerIndex, lastClipTime, state.clipStartTime * clipDuration);
|
|
27577
|
-
|
|
27578
|
-
|
|
27674
|
+
targetTransition = this._checkBackwardsSubTransition(playState, transitions, layerIndex, lastClipTime, state.clipStartTime * clipDuration);
|
|
27675
|
+
if (!targetTransition) {
|
|
27676
|
+
playState.currentTransitionIndex = transitions.length - 1;
|
|
27677
|
+
targetTransition = this._checkBackwardsSubTransition(playState, transitions, layerIndex, clipTime, state.clipEndTime * clipDuration);
|
|
27678
|
+
}
|
|
27579
27679
|
} else {
|
|
27580
|
-
this._checkBackwardsSubTransition(playState, transitions, layerIndex, lastClipTime, clipTime);
|
|
27680
|
+
targetTransition = this._checkBackwardsSubTransition(playState, transitions, layerIndex, lastClipTime, clipTime);
|
|
27681
|
+
}
|
|
27682
|
+
}
|
|
27683
|
+
if (!targetTransition) {
|
|
27684
|
+
for(var i = 0, n = anyStateTransitions.length; i < n; ++i){
|
|
27685
|
+
var transition = anyStateTransitions[i];
|
|
27686
|
+
if (this._checkConditions(state, transition)) {
|
|
27687
|
+
this._crossFadeByTransition(transition, layerIndex);
|
|
27688
|
+
break;
|
|
27689
|
+
}
|
|
27581
27690
|
}
|
|
27582
27691
|
}
|
|
27583
27692
|
};
|
|
27584
27693
|
_proto._checkSubTransition = function _checkSubTransition(playState, transitions, layerIndex, lastClipTime, curClipTime) {
|
|
27694
|
+
var state = playState.state;
|
|
27585
27695
|
var transitionIndex = playState.currentTransitionIndex;
|
|
27586
|
-
var duration =
|
|
27696
|
+
var duration = state._getDuration();
|
|
27587
27697
|
for(var n = transitions.length; transitionIndex < n; transitionIndex++){
|
|
27588
27698
|
var transition = transitions[transitionIndex];
|
|
27589
27699
|
var exitTime = transition.exitTime * duration;
|
|
27590
27700
|
if (exitTime > curClipTime) {
|
|
27591
27701
|
break;
|
|
27592
27702
|
}
|
|
27593
|
-
if (exitTime >= lastClipTime) {
|
|
27594
|
-
this._crossFadeByTransition(transition, layerIndex);
|
|
27703
|
+
if (exitTime >= lastClipTime && this._checkConditions(state, transition)) {
|
|
27595
27704
|
playState.currentTransitionIndex = Math.min(transitionIndex + 1, n - 1);
|
|
27705
|
+
this._applyTransition(transition, layerIndex);
|
|
27706
|
+
return transition;
|
|
27596
27707
|
}
|
|
27597
27708
|
}
|
|
27709
|
+
return null;
|
|
27598
27710
|
};
|
|
27599
27711
|
_proto._checkBackwardsSubTransition = function _checkBackwardsSubTransition(playState, transitions, layerIndex, lastClipTime, curClipTime) {
|
|
27712
|
+
var state = playState.state;
|
|
27600
27713
|
var transitionIndex = playState.currentTransitionIndex;
|
|
27601
27714
|
var duration = playState.state._getDuration();
|
|
27602
27715
|
for(; transitionIndex >= 0; transitionIndex--){
|
|
@@ -27605,14 +27718,76 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
27605
27718
|
if (exitTime < curClipTime) {
|
|
27606
27719
|
break;
|
|
27607
27720
|
}
|
|
27608
|
-
if (exitTime <= lastClipTime) {
|
|
27609
|
-
this._crossFadeByTransition(transition, layerIndex);
|
|
27721
|
+
if (exitTime <= lastClipTime && this._checkConditions(state, transition)) {
|
|
27610
27722
|
playState.currentTransitionIndex = Math.max(transitionIndex - 1, 0);
|
|
27723
|
+
this._applyTransition(transition, layerIndex);
|
|
27724
|
+
return transition;
|
|
27725
|
+
}
|
|
27726
|
+
}
|
|
27727
|
+
return null;
|
|
27728
|
+
};
|
|
27729
|
+
_proto._applyTransition = function _applyTransition(transition, layerIndex) {
|
|
27730
|
+
if (transition.isExit) {
|
|
27731
|
+
this._checkEntryState();
|
|
27732
|
+
return;
|
|
27733
|
+
}
|
|
27734
|
+
this._crossFadeByTransition(transition, layerIndex);
|
|
27735
|
+
};
|
|
27736
|
+
_proto._checkConditions = function _checkConditions(state, transition) {
|
|
27737
|
+
var mute = transition.mute, conditions = transition.conditions, solo = transition.solo;
|
|
27738
|
+
if (mute) return false;
|
|
27739
|
+
if (state && state._hasSoloTransition && !solo) return false;
|
|
27740
|
+
var allPass = true;
|
|
27741
|
+
for(var i = 0, n = conditions.length; i < n; ++i){
|
|
27742
|
+
var pass = false;
|
|
27743
|
+
var _conditions_i = conditions[i], mode = _conditions_i.mode, name1 = _conditions_i.parameter, threshold = _conditions_i.threshold;
|
|
27744
|
+
var parameter = this.getParameter(name1);
|
|
27745
|
+
switch(mode){
|
|
27746
|
+
case exports.AnimatorConditionMode.Equals:
|
|
27747
|
+
if (parameter.value === threshold) {
|
|
27748
|
+
pass = true;
|
|
27749
|
+
}
|
|
27750
|
+
break;
|
|
27751
|
+
case exports.AnimatorConditionMode.Greater:
|
|
27752
|
+
if (parameter.value > threshold) {
|
|
27753
|
+
pass = true;
|
|
27754
|
+
}
|
|
27755
|
+
break;
|
|
27756
|
+
case exports.AnimatorConditionMode.Less:
|
|
27757
|
+
if (parameter.value < threshold) {
|
|
27758
|
+
pass = true;
|
|
27759
|
+
}
|
|
27760
|
+
break;
|
|
27761
|
+
case exports.AnimatorConditionMode.NotEquals:
|
|
27762
|
+
if (parameter.value !== threshold) {
|
|
27763
|
+
pass = true;
|
|
27764
|
+
}
|
|
27765
|
+
break;
|
|
27766
|
+
case exports.AnimatorConditionMode.If:
|
|
27767
|
+
if (parameter.value === true) {
|
|
27768
|
+
pass = true;
|
|
27769
|
+
}
|
|
27770
|
+
break;
|
|
27771
|
+
case exports.AnimatorConditionMode.IfNot:
|
|
27772
|
+
if (parameter.value === false) {
|
|
27773
|
+
pass = true;
|
|
27774
|
+
}
|
|
27775
|
+
break;
|
|
27776
|
+
}
|
|
27777
|
+
if (!pass) {
|
|
27778
|
+
allPass = false;
|
|
27779
|
+
break;
|
|
27611
27780
|
}
|
|
27612
27781
|
}
|
|
27782
|
+
return allPass;
|
|
27613
27783
|
};
|
|
27614
27784
|
_proto._crossFadeByTransition = function _crossFadeByTransition(transition, layerIndex) {
|
|
27785
|
+
var _this__controllerUpdateFlag;
|
|
27615
27786
|
var crossState = transition.destinationState;
|
|
27787
|
+
if ((_this__controllerUpdateFlag = this._controllerUpdateFlag) == null ? void 0 : _this__controllerUpdateFlag.flag) {
|
|
27788
|
+
this._reset();
|
|
27789
|
+
}
|
|
27790
|
+
this._playFrameCount = this.engine.time.frameCount;
|
|
27616
27791
|
if (!crossState) {
|
|
27617
27792
|
return false;
|
|
27618
27793
|
}
|
|
@@ -27723,13 +27898,24 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
27723
27898
|
scripts[i].onStateExit(this, state, layerIndex);
|
|
27724
27899
|
}
|
|
27725
27900
|
};
|
|
27726
|
-
_proto.
|
|
27901
|
+
_proto._checkEntryState = function _checkEntryState() {
|
|
27727
27902
|
var layers = this._animatorController.layers;
|
|
27728
27903
|
for(var i = 0, n = layers.length; i < n; ++i){
|
|
27729
|
-
var _stateMachine;
|
|
27730
27904
|
var stateMachine = layers[i].stateMachine;
|
|
27731
|
-
if (
|
|
27732
|
-
|
|
27905
|
+
if (!stateMachine) continue;
|
|
27906
|
+
var entryTransitions = stateMachine._entryTransitions;
|
|
27907
|
+
var length = entryTransitions.length;
|
|
27908
|
+
if (length) {
|
|
27909
|
+
for(var j = 0, m = length; j < m; j++){
|
|
27910
|
+
var transition = entryTransitions[j];
|
|
27911
|
+
if (this._checkConditions(null, transition)) {
|
|
27912
|
+
this.crossFade(transition, i);
|
|
27913
|
+
break;
|
|
27914
|
+
}
|
|
27915
|
+
}
|
|
27916
|
+
} else {
|
|
27917
|
+
var defaultState = stateMachine.defaultState;
|
|
27918
|
+
defaultState && this.play(defaultState.name, i);
|
|
27733
27919
|
}
|
|
27734
27920
|
}
|
|
27735
27921
|
};
|
|
@@ -27755,6 +27941,22 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
27755
27941
|
this._animatorController = animatorController;
|
|
27756
27942
|
}
|
|
27757
27943
|
}
|
|
27944
|
+
},
|
|
27945
|
+
{
|
|
27946
|
+
key: "layers",
|
|
27947
|
+
get: /**
|
|
27948
|
+
* The layers in the animator's controller.
|
|
27949
|
+
*/ function get() {
|
|
27950
|
+
return this._animatorController._layers;
|
|
27951
|
+
}
|
|
27952
|
+
},
|
|
27953
|
+
{
|
|
27954
|
+
key: "parameters",
|
|
27955
|
+
get: /**
|
|
27956
|
+
* The parameters in the animator's controller.
|
|
27957
|
+
*/ function get() {
|
|
27958
|
+
return this._animatorController._parameters;
|
|
27959
|
+
}
|
|
27758
27960
|
}
|
|
27759
27961
|
]);
|
|
27760
27962
|
return Animator;
|
|
@@ -27784,15 +27986,46 @@ __decorate([
|
|
|
27784
27986
|
ignoreClone
|
|
27785
27987
|
], Animator.prototype, "_controlledRenderers", void 0);
|
|
27786
27988
|
|
|
27989
|
+
/**
|
|
27990
|
+
* Used to communicate between scripting and the controller, parameters can be set in scripting and used by the controller.
|
|
27991
|
+
*/ var AnimatorControllerParameter = function AnimatorControllerParameter() {
|
|
27992
|
+
};
|
|
27993
|
+
|
|
27787
27994
|
/**
|
|
27788
27995
|
* Store the data for Animator playback.
|
|
27789
27996
|
*/ var AnimatorController = /*#__PURE__*/ function() {
|
|
27790
27997
|
function AnimatorController() {
|
|
27998
|
+
/** @internal */ this._parameters = [];
|
|
27999
|
+
/** @internal */ this._parametersMap = {};
|
|
28000
|
+
/** @internal */ this._layers = [];
|
|
28001
|
+
/** @internal */ this._layersMap = {};
|
|
27791
28002
|
this._updateFlagManager = new UpdateFlagManager();
|
|
27792
|
-
this._layers = [];
|
|
27793
|
-
this._layersMap = {};
|
|
27794
28003
|
}
|
|
27795
28004
|
var _proto = AnimatorController.prototype;
|
|
28005
|
+
_proto.addParameter = function addParameter(param, defaultValue) {
|
|
28006
|
+
if (typeof param === "string") {
|
|
28007
|
+
var parameter = new AnimatorControllerParameter();
|
|
28008
|
+
parameter.name = param;
|
|
28009
|
+
parameter.value = defaultValue;
|
|
28010
|
+
this._parametersMap[param] = parameter;
|
|
28011
|
+
this._parameters.push(parameter);
|
|
28012
|
+
return parameter;
|
|
28013
|
+
} else {
|
|
28014
|
+
this._parametersMap[param.name] = param;
|
|
28015
|
+
this._parameters.push(param);
|
|
28016
|
+
return param;
|
|
28017
|
+
}
|
|
28018
|
+
};
|
|
28019
|
+
/**
|
|
28020
|
+
* Remove a parameter from the controller.
|
|
28021
|
+
* @param parameter - The parameter
|
|
28022
|
+
*/ _proto.removeParameter = function removeParameter(parameter) {
|
|
28023
|
+
var index = this._parameters.indexOf(parameter);
|
|
28024
|
+
if (index !== -1) {
|
|
28025
|
+
this._parameters.splice(index, 1);
|
|
28026
|
+
delete this._parametersMap[parameter.name];
|
|
28027
|
+
}
|
|
28028
|
+
};
|
|
27796
28029
|
/**
|
|
27797
28030
|
* Get the layer by name.
|
|
27798
28031
|
* @param name - The layer's name.
|
|
@@ -27838,6 +28071,14 @@ __decorate([
|
|
|
27838
28071
|
*/ function get() {
|
|
27839
28072
|
return this._layers;
|
|
27840
28073
|
}
|
|
28074
|
+
},
|
|
28075
|
+
{
|
|
28076
|
+
key: "parameters",
|
|
28077
|
+
get: /**
|
|
28078
|
+
* The parameters in the controller.
|
|
28079
|
+
*/ function get() {
|
|
28080
|
+
return this._parameters;
|
|
28081
|
+
}
|
|
27841
28082
|
}
|
|
27842
28083
|
]);
|
|
27843
28084
|
return AnimatorController;
|
|
@@ -27899,16 +28140,22 @@ __decorate([
|
|
|
27899
28140
|
this./** @internal */ _onStateUpdateScripts = [];
|
|
27900
28141
|
this./** @internal */ _onStateExitScripts = [];
|
|
27901
28142
|
this./** @internal */ _updateFlagManager = new UpdateFlagManager();
|
|
28143
|
+
this./** @internal */ _hasSoloTransition = false;
|
|
27902
28144
|
this._clipStartTime = 0;
|
|
27903
28145
|
this._clipEndTime = 1;
|
|
27904
28146
|
this._transitions = [];
|
|
27905
28147
|
this._onClipChanged = this._onClipChanged.bind(this);
|
|
27906
28148
|
}
|
|
27907
28149
|
var _proto = AnimatorState.prototype;
|
|
27908
|
-
|
|
27909
|
-
|
|
27910
|
-
|
|
27911
|
-
|
|
28150
|
+
_proto.addTransition = function addTransition(transitionOrAnimatorState) {
|
|
28151
|
+
var transition;
|
|
28152
|
+
if (_instanceof(transitionOrAnimatorState, AnimatorState)) {
|
|
28153
|
+
transition = new AnimatorStateTransition();
|
|
28154
|
+
transition.destinationState = transitionOrAnimatorState;
|
|
28155
|
+
} else {
|
|
28156
|
+
transition = transitionOrAnimatorState;
|
|
28157
|
+
}
|
|
28158
|
+
transition._srcState = this;
|
|
27912
28159
|
var transitions = this._transitions;
|
|
27913
28160
|
var count = transitions.length;
|
|
27914
28161
|
var time = transition.exitTime;
|
|
@@ -27920,6 +28167,10 @@ __decorate([
|
|
|
27920
28167
|
while(--index >= 0 && time < transitions[index].exitTime);
|
|
27921
28168
|
transitions.splice(index + 1, 0, transition);
|
|
27922
28169
|
}
|
|
28170
|
+
if (transition.solo) {
|
|
28171
|
+
!this._hasSoloTransition && this._updateSoloTransition(true);
|
|
28172
|
+
}
|
|
28173
|
+
return transition;
|
|
27923
28174
|
};
|
|
27924
28175
|
/**
|
|
27925
28176
|
* Remove a transition from the state.
|
|
@@ -27927,6 +28178,7 @@ __decorate([
|
|
|
27927
28178
|
*/ _proto.removeTransition = function removeTransition(transition) {
|
|
27928
28179
|
var index = this._transitions.indexOf(transition);
|
|
27929
28180
|
index !== -1 && this._transitions.splice(index, 1);
|
|
28181
|
+
this._updateSoloTransition();
|
|
27930
28182
|
};
|
|
27931
28183
|
/**
|
|
27932
28184
|
* Adds a state machine script class of type T to the AnimatorState.
|
|
@@ -27981,6 +28233,21 @@ __decorate([
|
|
|
27981
28233
|
*/ _proto._onClipChanged = function _onClipChanged() {
|
|
27982
28234
|
this._updateFlagManager.dispatch();
|
|
27983
28235
|
};
|
|
28236
|
+
/**
|
|
28237
|
+
* @internal
|
|
28238
|
+
*/ _proto._updateSoloTransition = function _updateSoloTransition(hasSolo) {
|
|
28239
|
+
if (hasSolo !== undefined) {
|
|
28240
|
+
this._hasSoloTransition = hasSolo;
|
|
28241
|
+
} else {
|
|
28242
|
+
this._hasSoloTransition = false;
|
|
28243
|
+
for(var i = 0, n = this.transitions.length; i < n; ++i){
|
|
28244
|
+
if (this.transitions[i].solo) {
|
|
28245
|
+
this._hasSoloTransition = true;
|
|
28246
|
+
return;
|
|
28247
|
+
}
|
|
28248
|
+
}
|
|
28249
|
+
}
|
|
28250
|
+
};
|
|
27984
28251
|
_create_class(AnimatorState, [
|
|
27985
28252
|
{
|
|
27986
28253
|
key: "transitions",
|
|
@@ -28011,10 +28278,26 @@ __decorate([
|
|
|
28011
28278
|
clip && clip._updateFlagManager.addListener(this._onClipChanged);
|
|
28012
28279
|
}
|
|
28013
28280
|
},
|
|
28281
|
+
{
|
|
28282
|
+
key: "startTime",
|
|
28283
|
+
get: /**
|
|
28284
|
+
* The start time of this state's clip
|
|
28285
|
+
*/ function get() {
|
|
28286
|
+
return this._clip.length * this._clipStartTime;
|
|
28287
|
+
}
|
|
28288
|
+
},
|
|
28289
|
+
{
|
|
28290
|
+
key: "endTime",
|
|
28291
|
+
get: /**
|
|
28292
|
+
* The end time of this state's clip
|
|
28293
|
+
*/ function get() {
|
|
28294
|
+
return this._clip.length * this._clipEndTime;
|
|
28295
|
+
}
|
|
28296
|
+
},
|
|
28014
28297
|
{
|
|
28015
28298
|
key: "clipStartTime",
|
|
28016
28299
|
get: /**
|
|
28017
|
-
* The start time of the clip, the range is 0 to 1, default is 0.
|
|
28300
|
+
* The normalized start time of the clip, the range is 0 to 1, default is 0.
|
|
28018
28301
|
*/ function get() {
|
|
28019
28302
|
return this._clipStartTime;
|
|
28020
28303
|
},
|
|
@@ -28025,7 +28308,7 @@ __decorate([
|
|
|
28025
28308
|
{
|
|
28026
28309
|
key: "clipEndTime",
|
|
28027
28310
|
get: /**
|
|
28028
|
-
* The end time of the clip, the range is 0 to 1, default is 1.
|
|
28311
|
+
* The normalized end time of the clip, the range is 0 to 1, default is 1.
|
|
28029
28312
|
*/ function get() {
|
|
28030
28313
|
return this._clipEndTime;
|
|
28031
28314
|
},
|
|
@@ -28042,6 +28325,8 @@ __decorate([
|
|
|
28042
28325
|
*/ var AnimatorStateMachine = /*#__PURE__*/ function() {
|
|
28043
28326
|
function AnimatorStateMachine() {
|
|
28044
28327
|
/** The list of states. */ this.states = [];
|
|
28328
|
+
/** @internal */ this._entryTransitions = [];
|
|
28329
|
+
/** @internal */ this._anyStateTransitions = [];
|
|
28045
28330
|
/** @internal */ this._statesMap = {};
|
|
28046
28331
|
}
|
|
28047
28332
|
var _proto = AnimatorStateMachine.prototype;
|
|
@@ -28090,19 +28375,63 @@ __decorate([
|
|
|
28090
28375
|
}
|
|
28091
28376
|
return name;
|
|
28092
28377
|
};
|
|
28378
|
+
_proto.addEntryStateTransition = function addEntryStateTransition(transitionOrAnimatorState) {
|
|
28379
|
+
var transition;
|
|
28380
|
+
if (_instanceof(transitionOrAnimatorState, AnimatorState)) {
|
|
28381
|
+
transition = new AnimatorStateTransition();
|
|
28382
|
+
transition.destinationState = transitionOrAnimatorState;
|
|
28383
|
+
} else {
|
|
28384
|
+
transition = transitionOrAnimatorState;
|
|
28385
|
+
}
|
|
28386
|
+
this._entryTransitions.push(transition);
|
|
28387
|
+
return transition;
|
|
28388
|
+
};
|
|
28389
|
+
/**
|
|
28390
|
+
* Remove an entry transition.
|
|
28391
|
+
* @param transition - The transition
|
|
28392
|
+
*/ _proto.removeEntryStateTransition = function removeEntryStateTransition(transition) {
|
|
28393
|
+
var index = this._entryTransitions.indexOf(transition);
|
|
28394
|
+
index !== -1 && this._entryTransitions.splice(index, 1);
|
|
28395
|
+
};
|
|
28396
|
+
_proto.addAnyStateTransition = function addAnyStateTransition(transitionOrAnimatorState) {
|
|
28397
|
+
var transition;
|
|
28398
|
+
if (_instanceof(transitionOrAnimatorState, AnimatorState)) {
|
|
28399
|
+
transition = new AnimatorStateTransition();
|
|
28400
|
+
transition.destinationState = transitionOrAnimatorState;
|
|
28401
|
+
} else {
|
|
28402
|
+
transition = transitionOrAnimatorState;
|
|
28403
|
+
}
|
|
28404
|
+
this._anyStateTransitions.push(transition);
|
|
28405
|
+
return transition;
|
|
28406
|
+
};
|
|
28407
|
+
/**
|
|
28408
|
+
* Remove an any transition.
|
|
28409
|
+
* @param transition - The transition
|
|
28410
|
+
*/ _proto.removeAnyStateTransition = function removeAnyStateTransition(transition) {
|
|
28411
|
+
var index = this._anyStateTransitions.indexOf(transition);
|
|
28412
|
+
index !== -1 && this._anyStateTransitions.splice(index, 1);
|
|
28413
|
+
};
|
|
28414
|
+
_create_class(AnimatorStateMachine, [
|
|
28415
|
+
{
|
|
28416
|
+
key: "entryTransitions",
|
|
28417
|
+
get: /**
|
|
28418
|
+
* The list of entry transitions in the state machine.
|
|
28419
|
+
*/ function get() {
|
|
28420
|
+
return this._entryTransitions;
|
|
28421
|
+
}
|
|
28422
|
+
},
|
|
28423
|
+
{
|
|
28424
|
+
key: "anyStateTransitions",
|
|
28425
|
+
get: /**
|
|
28426
|
+
* The list of AnyState transitions.
|
|
28427
|
+
*/ function get() {
|
|
28428
|
+
return this._anyStateTransitions;
|
|
28429
|
+
}
|
|
28430
|
+
}
|
|
28431
|
+
]);
|
|
28093
28432
|
return AnimatorStateMachine;
|
|
28094
28433
|
}();
|
|
28095
28434
|
|
|
28096
|
-
exports.AnimatorConditionMode = void 0;
|
|
28097
|
-
(function(AnimatorConditionMode) {
|
|
28098
|
-
AnimatorConditionMode[AnimatorConditionMode["If"] = 0] = "If";
|
|
28099
|
-
AnimatorConditionMode[AnimatorConditionMode["IfNot"] = 1] = "IfNot";
|
|
28100
|
-
AnimatorConditionMode[AnimatorConditionMode["Greater"] = 2] = "Greater";
|
|
28101
|
-
AnimatorConditionMode[AnimatorConditionMode["Less"] = 3] = "Less";
|
|
28102
|
-
AnimatorConditionMode[AnimatorConditionMode["Equals"] = 4] = "Equals";
|
|
28103
|
-
AnimatorConditionMode[AnimatorConditionMode["NotEquals"] = 5] = "NotEquals";
|
|
28104
|
-
})(exports.AnimatorConditionMode || (exports.AnimatorConditionMode = {}));
|
|
28105
|
-
|
|
28106
28435
|
/**
|
|
28107
28436
|
* Keyframe.
|
|
28108
28437
|
* @typeParam V - Type of Keyframe value
|