mirror of
https://github.com/cocos/cocos-engine.git
synced 2026-09-07 00:02:53 +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>
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
|
|
import { property } from '../../cocos/core/data/class-decorator';
|
|
import { ccclass } from '../../cocos/core/data/decorators';
|
|
import { deserialize } from '../../cocos/core/data/deserialize';
|
|
|
|
describe('Deserialize', () => {
|
|
test('Object array element', () => {
|
|
@ccclass('Foo') class Foo { @property name: string = ''; }
|
|
|
|
@ccclass('Bar') class Bar { @property array: Foo[] = []; @property mainFoo: Foo; }
|
|
|
|
const classMap = {
|
|
'Foo': Foo,
|
|
'Bar': Bar,
|
|
};
|
|
|
|
const serialized = [
|
|
{ __type__: 'Bar', array: [{ __id__: 1 }, {__id__: 2 }], mainFoo: { __id__: 1 } },
|
|
{ __type__: 'Foo', name: 'foo1' },
|
|
{ __type__: 'Foo', name: 'foo2'},
|
|
];
|
|
|
|
const deserialized: Bar = deserialize(serialized, undefined, {
|
|
classFinder: (id: string) => {
|
|
return classMap[id];
|
|
},
|
|
});
|
|
|
|
expect(deserialized.array).toHaveLength(2);
|
|
expect(deserialized.array[0]).toBeInstanceOf(Foo);
|
|
expect(deserialized.array[0].name).toBe('foo1');
|
|
expect(deserialized.array[1]).toBeInstanceOf(Foo);
|
|
expect(deserialized.array[1].name).toBe('foo2');
|
|
});
|
|
});
|