mirror of
https://github.com/cocos/cocos-engine.git
synced 2026-09-07 08:09:13 +08:00
* NewGenAnim * Fix/Optimize simple directional blending * Class transition by type (#29) * Transition & Gradient transition (#30) * The default ExitCondition should be 1.0 * Do correct graph eval * Fix PoseSubgraph connect() signature order (#31) * Graph defaults test (#32) * Conditions (#33) * Trigger (#34) * Transition should only be considered when satemachine exited (#35) * Add layer.name (#36) * Fix some behaviours; add API to query poses and transition (#37) Fix single frame exit condition behaviours; Fix pose -> subgraph behaviours * Support self transition; refactor sub state machine implementation (#38) * Temp * Flat whole layer statemachine * Add test for test reset triggers * Allow self transition * Self transition test * Fix deserialize (#39) * update animgraph template (#40) * The inheritance of any state (#41) * StateMachine events (#42) * Fix state machine events; Allow multiple transitions between two nodes (#43) * Transition priority test (#44) * Optimize variable bind (#45) * Fix variable bind errors (#46) * Expose blend algorithm to editor (#47) * Cont (#48) * update animgraph template (#49) * update animgraph template * update animgraph template * Pose speed (#50) * blend tree add EditorExtendable data (#51) * Correct pose blend duration (#52) * Export some types (#53) * animation pose EditorExtendable (#54) (cherry picked from commit d5dd5f32c9dbacb68c016ff8ba56d383c781a021) * Implement clone() (#55) * Fix trigger condition serialization (#56) * Add variable type: integer (#57) * Optimize 0 weight case (#58) * Relative duration (#59) * update_hdr_skybox (#9230) * Rename.. (#60) * Optimize animation blend item export (#61) * Fix Type (#62) * modify aniamtion graph template data (#63) * modify aniamtion graph template data * add animation graph component template * Fix serialize issue (#64) * Optimize (#65) * Remove MotionState.startRatio, loop (#66) * Update (#67) * Fix circular reference (#68) * CR (#69) * Fix exit time greater than 1 (#70) Co-authored-by: 黄森斌 <arsen2010@126.com> Co-authored-by: linshunjun <49218738+linshunjun@users.noreply.github.com>
53 lines
2.1 KiB
TypeScript
53 lines
2.1 KiB
TypeScript
/*
|
|
Copyright (c) 2020 Xiamen Yaji Software Co., Ltd.
|
|
|
|
http://www.cocos.com
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated engine source code (the "Software"), a limited,
|
|
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
|
to use Cocos Creator solely to develop games on your target platforms. You shall
|
|
not use Cocos Creator software for developing other software or tools that's
|
|
used for developing games. You are not granted to publish, distribute,
|
|
sublicense, and/or sell copies of Cocos Creator.
|
|
|
|
The software or tools in this License Agreement are licensed, not sold.
|
|
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
THE SOFTWARE.
|
|
*/
|
|
|
|
import { DEBUG } from 'internal:constants';
|
|
|
|
/**
|
|
* Asserts that the expression is non-nullable, i.e. is neither `null` nor `undefined`.
|
|
* @param expr Testing expression.
|
|
* @param message Optional message.
|
|
*/
|
|
export function assertIsNonNullable<T> (expr: T, message?: string): asserts expr is NonNullable<T> {
|
|
assertIsTrue(!(expr === null || expr === undefined), message);
|
|
}
|
|
|
|
/**
|
|
* Asserts that the expression evaluated to `true`.
|
|
* @param expr Testing expression.
|
|
* @param message Optional message.
|
|
*/
|
|
export function assertIsTrue (expr: unknown, message?: string): asserts expr {
|
|
if (DEBUG && !expr) {
|
|
// eslint-disable-next-line no-debugger
|
|
// debugger;
|
|
throw new Error(`Assertion failed: ${message ?? '<no-message>'}`);
|
|
}
|
|
}
|
|
|
|
export function assertsArrayIndex<T> (array: T[], index: number) {
|
|
assertIsTrue(index >= 0 && index < array.length, `Array index ${index} out of bounds: [0, ${array.length})`);
|
|
}
|