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