A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
feat(timeline): camera and sequence tracks play shots and nested timelines
yhh0e96e7cb1a3f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1b02909b5..effc68ae2 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -14,6 +14,10 @@ published separately; it ships inside the editor.## [Unreleased]+### Added++- **Camera shots and nested sequences on the timeline.** Timelines have camera and sequence tracks. A camera track is a row of shots: each bar is the camera that is the view for its span, bars that touch cut, and a bar dragged over the previous one blends across the overlap with its own curve. A sequence track plays another timeline in a window of this one, on its own clock, with a speed, a loop, and a node to bind to so one sequence can play on different characters. A timeline cannot play itself, directly or through another, and nesting stops at four levels. The Sequencer shows both as bars above the object tracks, with the shot or clip in Details, and the viewport's camera preview follows the shot while you scrub. Which shot and which nested frame show is a function of time alone, so scrubbing, jumping and playing backwards agree.+### Changed- **Long audio streams on the Web.** Long clips on the Web play from their compressed file instead of being decoded to memory. A clip's import settings have a Load Type: Auto streams clips of 30 seconds or longer and decodes shorter ones, Decompress On Load always decodes, Streaming always streams. A streamed clip takes almost no memory (a three-minute stereo track is about 69 MB decoded), goes through the same bus, volume and fades, and gives up two things the import setting says: a sample-accurate loop point, and a second simultaneous voice of the same clip. The profiler's memory section shows the decoded audio and, when clips stream, how many and the memory they saved (an estimate from their length). The choice rides in the exported game's audio settings, so an exported game and a playable ad stream the same clips Play does.diff --git a/desktop b/desktopindex 6cba127f3..b38b65aa0 160000--- a/desktop+++ b/desktop@@ -1 +1 @@-Subproject commit 6cba127f3b6d131c1a259124bfb9e3e8fcc3005b+Subproject commit b38b65aa056c0c88e1f2a3dd4bf4e21fc4e52860diff --git a/docs/astro/src/content/docs/animation/timeline.mdx b/docs/astro/src/content/docs/animation/timeline.mdxindex 66484f6ec..809070aeb 100644--- a/docs/astro/src/content/docs/animation/timeline.mdx+++ b/docs/astro/src/content/docs/animation/timeline.mdx@@ -94,6 +94,8 @@ A timeline is a set of tracks evaluated together each frame:| Spine | `Spine` | Play Spine animations as clips. || Marker | `Marker` | Named time markers. || Custom event | `CustomEvent` | Named events with a payload, for your own systems. |+| Camera | `Camera` | Which camera is the view, shot by shot (see [below](#cameras-and-sequences)). |+| Sequence | `Sequence` | Another timeline, played inside a window of this one. |### Activation ranges@@ -130,6 +132,25 @@ curves and their tangent handles for eases the dope sheet can't express:*The curve editor: each keyframed channel becomes an editable curve (here `position.x` easing in, `position.y` bobbing), with per-key tangent handles.*+### Cameras and sequences++A **camera track** holds shots: each bar is one camera that is the view for its span.+Bars that touch cut; drag a bar so it overlaps the previous one and the overlap becomes a+blend, shaped by the later shot's blend curve. A span with no shot gives the view back to+the scene's own camera. There is one camera track per timeline, and its cameras must sit+below the timeline's root (every track finds its target by name path from that root).++A **sequence track** plays another `.estimeline` inside a window of this one, on its own+clock: `speed` scales it, and `loop` repeats it to fill the bar instead of holding its last+frame. **Bind to** picks the node the nested timeline's name paths start from, so one+greeting sequence can play on different characters. A timeline cannot play itself, directly+or through another, and nesting stops at four levels; the editor refuses those picks, and a+loaded game skips them with a warning.++Scrubbing shows the cut in the viewport's camera preview window. Dragging, jumping or+playing backwards is safe: which shot and which nested frame are showing is a function of+time alone. Events inside a nested timeline fire only while it plays forward, like any other.+### What the preview animatesScrubbing or playing in the Sequencer animates the **live viewport**, not a separatediff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.mdindex b569e23b8..43a46520c 100644--- a/sdk/etc/index.api.md+++ b/sdk/etc/index.api.md@@ -1,7 +1,7 @@# API surface — esengine/index<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 115 public · 152 beta · 1621 experimental · 3 deprecated+Symbols: 115 public · 152 beta · 1636 experimental · 3 deprecated## ABI_LAYOUT_HASH — const @experimental```@@ -88,6 +88,14 @@ ranges: ActivationRange[]type: "activation"```+## ActiveShot — interface @experimental+```+curve: number+from: number | null+to: number+weight: number+```+## AdProvider — interface @experimental```createInterstitialAd: (adUnitId: string) => PlatformInterstitialAd@@ -1863,6 +1871,14 @@ minX: numberminY: number```+## CameraClip — interface @experimental+```+camera: string+curve: number | undefined+duration: number+start: number+```+## CameraCommit — const @beta```ResourceDef<CameraCommitData>@@ -1922,6 +1938,8 @@ shakeSeq: numbershakes: ActiveShake[]startTime: numbertarget: number+timelineOwner: number+timelineShot: TimelineShot | null```## CameraExtents — interface @experimental@@ -1996,6 +2014,14 @@ viewportPixels: ViewportworldHeight: number | undefined```+## CameraTrack — interface @experimental+```+childPath: string+clips: CameraClip[]+name: string+type: "camera"+```+## CameraTransformFields — interface @beta```worldPosition: { x: number; y: number; z: number; }@@ -5116,6 +5142,11 @@ Restart = 18```+## MAX_SEQUENCE_DEPTH — const @experimental+```+4+```+## MESH_MAX_BONES — const @experimental```64@@ -7997,6 +8028,39 @@ sensorEntity: numbervisitorEntity: number```+## SequenceClip — interface @experimental+```+duration: number+loop: boolean+root: string+speed: number+start: number+timeline: string+```++## SequenceLayer — interface @experimental+```+asset: TimelineAsset+clip: SequenceClip+key: string+ref: string+root: number+time: number+```++## SequenceLookup — type @experimental+```+(ref: string) => TimelineAsset | undefined+```++## SequenceTrack — interface @experimental+```+childPath: string+clips: SequenceClip[]+name: string+type: "sequence"+```+## ServicesPlugin — class @experimental```build: (app: App) => void@@ -8093,6 +8157,14 @@ pageWidth: numberspacing: number```+## ShotState — interface @experimental+```+curve: number+from: string | null+to: string+weight: number+```+## SideModuleDescriptor — interface @experimental```file: string@@ -9003,7 +9075,7 @@ readonly (keyof ThemeColors)[]## TIMELINE_FORMAT_VERSION — const @experimental```-"1.2"+"1.3"```## TIMELINE_MOTION — const @experimental@@ -9465,6 +9537,14 @@ static new (): TimelinePluginstatic prototype: TimelinePlugin```+## TimelineShot — interface @experimental+```+curve: number+from: number | null+to: number+weight: number+```+## TimerHandle — class @experimental```cancel: () => void@@ -9552,7 +9632,7 @@ y: number## Track — type @experimental```-PropertyTrack | SpineTrack | SpriteAnimTrack | AudioTrack | ActivationTrack | MarkerTrack | CustomEventTrack | AnimFramesTrack+PropertyTrack | SpineTrack | SpriteAnimTrack | AudioTrack | ActivationTrack | MarkerTrack | CustomEventTrack | AnimFramesTrack | CameraTrack | SequenceTrack```## TrackType — type @experimental@@ -11488,6 +11568,11 @@ MotionDriver<AnimatorBlend2DMotion>(prefab: PrefabData, loadPrefab: (path: string) => PrefabData | null, visited?: Set<string>): string[]```+## collectSequenceLayers — function @experimental+```+(asset: TimelineAsset, time: number, root: Entity, resolveChild: ChildResolver, lookup: SequenceLookup, chain?: readonly string[], keyPrefix?: string, depth?: number): SequenceLayer[]+```+## collider2DOutline — function @experimental```(shape: Collider2DShape, center: Vec2, angle: number, ppu: number): Collider2DOutline@@ -13398,6 +13483,11 @@ PrefabsPlugin(world: World, sceneData: SceneData): Map<number, Entity>```+## resolveActiveShot — function @experimental+```+(asset: TimelineAsset, time: number, root: Entity, resolveChild: ChildResolver, lookup: SequenceLookup): ActiveShot | null+```+## resolveAssetGroup — function @experimental```(projectRelPath: string, config: AssetGroupsConfig | null | undefined): ResolvedAssetGroup@@ -13433,6 +13523,11 @@ PrefabsPlugin(scene: SceneData, read: (ref: string) => Promise<unknown | null>): Promise<(ref: string) => PrefabRoot | null>```+## resolveShot — function @experimental+```+(clips: readonly CameraClip[], time: number): ShotState | null+```+## resolveThemeTokens — function @experimental```(base: "dark" | "light", overrides?: ThemeOverrides): ThemeTokens@@ -13708,6 +13803,11 @@ ServicesPlugin(tokens: ThemeTokens): void```+## setTimelineShot — function @experimental+```+(host: CameraDirectorHost, owner: number, shot: TimelineShot | null): void+```+## setTreeViewData — function @beta```<T>(world: World, entity: Entity, data: TreeDataSource<T>, options?: Pick<TreeViewOptions<T>, "item" | "dragHandle" | "canDrop" | "onDrop">): () => void@@ -14228,6 +14328,11 @@ SystemDef(app: App, selectedId: number | null, withTree: boolean, opts?: WorldSnapshotOptions): WorldSnapshot```+## wouldNestCycle — function @experimental+```+(host: string, ref: string, lookup: SequenceLookup): boolean+```+## wrapSceneSystem — function @experimental```(app: App, sceneName: string, system: SystemDef): SystemDefdiff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.mdindex f8dde197b..81fa8e944 100644--- a/sdk/etc/index.native.api.md+++ b/sdk/etc/index.native.api.md@@ -1,7 +1,7 @@# API surface — esengine/index.native<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 115 public · 157 beta · 1640 experimental · 3 deprecated+Symbols: 115 public · 157 beta · 1655 experimental · 3 deprecated## ABI_LAYOUT_HASH — const @experimental```@@ -88,6 +88,14 @@ ranges: ActivationRange[]type: "activation"```+## ActiveShot — interface @experimental+```+curve: number+from: number | null+to: number+weight: number+```+## AdProvider — interface @experimental```createInterstitialAd: (adUnitId: string) => PlatformInterstitialAd@@ -1863,6 +1871,14 @@ minX: numberminY: number```+## CameraClip — interface @experimental+```+camera: string+curve: number | undefined+duration: number+start: number+```+## CameraCommit — const @beta```ResourceDef<CameraCommitData>@@ -1922,6 +1938,8 @@ shakeSeq: numbershakes: ActiveShake[]startTime: numbertarget: number+timelineOwner: number+timelineShot: TimelineShot | null```## CameraExtents — interface @experimental@@ -1996,6 +2014,14 @@ viewportPixels: ViewportworldHeight: number | undefined```+## CameraTrack — interface @experimental+```+childPath: string+clips: CameraClip[]+name: string+type: "camera"+```+## CameraTransformFields — interface @beta```worldPosition: { x: number; y: number; z: number; }@@ -5124,6 +5150,11 @@ Restart = 18```+## MAX_SEQUENCE_DEPTH — const @experimental+```+4+```+## MESH_MAX_BONES — const @experimental```64@@ -8210,6 +8241,39 @@ sensorEntity: numbervisitorEntity: number```+## SequenceClip — interface @experimental+```+duration: number+loop: boolean+root: string+speed: number+start: number+timeline: string+```++## SequenceLayer — interface @experimental+```+asset: TimelineAsset+clip: SequenceClip+key: string+ref: string+root: number+time: number+```++## SequenceLookup — type @experimental+```+(ref: string) => TimelineAsset | undefined+```++## SequenceTrack — interface @experimental+```+childPath: string+clips: SequenceClip[]+name: string+type: "sequence"+```+## ServicesPlugin — class @experimental```build: (app: App) => void@@ -8306,6 +8370,14 @@ pageWidth: numberspacing: number```+## ShotState — interface @experimental+```+curve: number+from: string | null+to: string+weight: number+```+## SideModuleDescriptor — interface @experimental```file: string@@ -9216,7 +9288,7 @@ readonly (keyof ThemeColors)[]## TIMELINE_FORMAT_VERSION — const @experimental```-"1.2"+"1.3"```## TIMELINE_MOTION — const @experimental@@ -9678,6 +9750,14 @@ static new (): TimelinePluginstatic prototype: TimelinePlugin```+## TimelineShot — interface @experimental+```+curve: number+from: number | null+to: number+weight: number+```+## TimerHandle — class @experimental```cancel: () => void@@ -9765,7 +9845,7 @@ y: number## Track — type @experimental```-PropertyTrack | SpineTrack | SpriteAnimTrack | AudioTrack | ActivationTrack | MarkerTrack | CustomEventTrack | AnimFramesTrack+PropertyTrack | SpineTrack | SpriteAnimTrack | AudioTrack | ActivationTrack | MarkerTrack | CustomEventTrack | AnimFramesTrack | CameraTrack | SequenceTrack```## TrackType — type @experimental@@ -11716,6 +11796,11 @@ MotionDriver<AnimatorBlend2DMotion>(prefab: PrefabData, loadPrefab: (path: string) => PrefabData | null, visited?: Set<string>): string[]```+## collectSequenceLayers — function @experimental+```+(asset: TimelineAsset, time: number, root: Entity, resolveChild: ChildResolver, lookup: SequenceLookup, chain?: readonly string[], keyPrefix?: string, depth?: number): SequenceLayer[]+```+## collider2DOutline — function @experimental```(shape: Collider2DShape, center: Vec2, angle: number, ppu: number): Collider2DOutline@@ -13661,6 +13746,11 @@ PrefabsPlugin(world: World, sceneData: SceneData): Map<number, Entity>```+## resolveActiveShot — function @experimental+```+(asset: TimelineAsset, time: number, root: Entity, resolveChild: ChildResolver, lookup: SequenceLookup): ActiveShot | null+```+## resolveAssetGroup — function @experimental```(projectRelPath: string, config: AssetGroupsConfig | null | undefined): ResolvedAssetGroup@@ -13696,6 +13786,11 @@ PrefabsPlugin(scene: SceneData, read: (ref: string) => Promise<unknown | null>): Promise<(ref: string) => PrefabRoot | null>```+## resolveShot — function @experimental+```+(clips: readonly CameraClip[], time: number): ShotState | null+```+## resolveThemeTokens — function @experimental```(base: "dark" | "light", overrides?: ThemeOverrides): ThemeTokens@@ -13971,6 +14066,11 @@ ServicesPlugin(tokens: ThemeTokens): void```+## setTimelineShot — function @experimental+```+(host: CameraDirectorHost, owner: number, shot: TimelineShot | null): void+```+## setTreeViewData — function @beta```<T>(world: World, entity: Entity, data: TreeDataSource<T>, options?: Pick<TreeViewOptions<T>, "item" | "dragHandle" | "canDrop" | "onDrop">): () => void@@ -14491,6 +14591,11 @@ SystemDef(app: App, selectedId: number | null, withTree: boolean, opts?: WorldSnapshotOptions): WorldSnapshot```+## wouldNestCycle — function @experimental+```+(host: string, ref: string, lookup: SequenceLookup): boolean+```+## wrapSceneSystem — function @experimental```(app: App, sceneName: string, system: SystemDef): SystemDefdiff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.mdindex bdf396380..04f0a969b 100644--- a/sdk/etc/index.node.api.md+++ b/sdk/etc/index.node.api.md@@ -1,7 +1,7 @@# API surface — esengine/index.node<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 115 public · 154 beta · 1620 experimental · 3 deprecated+Symbols: 115 public · 154 beta · 1635 experimental · 3 deprecated## ANCHOR_AXES — const @experimental```@@ -83,6 +83,14 @@ ranges: ActivationRange[]type: "activation"```+## ActiveShot — interface @experimental+```+curve: number+from: number | null+to: number+weight: number+```+## AdProvider — interface @experimental```createInterstitialAd: (adUnitId: string) => PlatformInterstitialAd@@ -1858,6 +1866,14 @@ minX: numberminY: number```+## CameraClip — interface @experimental+```+camera: string+curve: number | undefined+duration: number+start: number+```+## CameraCommit — const @beta```ResourceDef<CameraCommitData>@@ -1917,6 +1933,8 @@ shakeSeq: numbershakes: ActiveShake[]startTime: numbertarget: number+timelineOwner: number+timelineShot: TimelineShot | null```## CameraExtents — interface @experimental@@ -1991,6 +2009,14 @@ viewportPixels: ViewportworldHeight: number | undefined```+## CameraTrack — interface @experimental+```+childPath: string+clips: CameraClip[]+name: string+type: "camera"+```+## CameraTransformFields — interface @beta```worldPosition: { x: number; y: number; z: number; }@@ -5111,6 +5137,11 @@ Restart = 18```+## MAX_SEQUENCE_DEPTH — const @experimental+```+4+```+## MESH_MAX_BONES — const @experimental```64@@ -7992,6 +8023,39 @@ sensorEntity: numbervisitorEntity: number```+## SequenceClip — interface @experimental+```+duration: number+loop: boolean+root: string+speed: number+start: number+timeline: string+```++## SequenceLayer — interface @experimental+```+asset: TimelineAsset+clip: SequenceClip+key: string+ref: string+root: number+time: number+```++## SequenceLookup — type @experimental+```+(ref: string) => TimelineAsset | undefined+```++## SequenceTrack — interface @experimental+```+childPath: string+clips: SequenceClip[]+name: string+type: "sequence"+```+## ServicesPlugin — class @experimental```build: (app: App) => void@@ -8088,6 +8152,14 @@ pageWidth: numberspacing: number```+## ShotState — interface @experimental+```+curve: number+from: string | null+to: string+weight: number+```+## SideModuleDescriptor — interface @experimental```file: string@@ -8998,7 +9070,7 @@ readonly (keyof ThemeColors)[]## TIMELINE_FORMAT_VERSION — const @experimental```-"1.2"+"1.3"```## TIMELINE_MOTION — const @experimental@@ -9460,6 +9532,14 @@ static new (): TimelinePluginstatic prototype: TimelinePlugin```+## TimelineShot — interface @experimental+```+curve: number+from: number | null+to: number+weight: number+```+## TimerHandle — class @experimental```cancel: () => void@@ -9547,7 +9627,7 @@ y: number## Track — type @experimental```-PropertyTrack | SpineTrack | SpriteAnimTrack | AudioTrack | ActivationTrack | MarkerTrack | CustomEventTrack | AnimFramesTrack+PropertyTrack | SpineTrack | SpriteAnimTrack | AudioTrack | ActivationTrack | MarkerTrack | CustomEventTrack | AnimFramesTrack | CameraTrack | SequenceTrack```## TrackType — type @experimental@@ -11483,6 +11563,11 @@ MotionDriver<AnimatorBlend2DMotion>(prefab: PrefabData, loadPrefab: (path: string) => PrefabData | null, visited?: Set<string>): string[]```+## collectSequenceLayers — function @experimental+```+(asset: TimelineAsset, time: number, root: Entity, resolveChild: ChildResolver, lookup: SequenceLookup, chain?: readonly string[], keyPrefix?: string, depth?: number): SequenceLayer[]+```+## collider2DOutline — function @experimental```(shape: Collider2DShape, center: Vec2, angle: number, ppu: number): Collider2DOutline@@ -13403,6 +13488,11 @@ PrefabsPlugin(world: World, sceneData: SceneData): Map<number, Entity>```+## resolveActiveShot — function @experimental+```+(asset: TimelineAsset, time: number, root: Entity, resolveChild: ChildResolver, lookup: SequenceLookup): ActiveShot | null+```+## resolveAssetGroup — function @experimental```(projectRelPath: string, config: AssetGroupsConfig | null | undefined): ResolvedAssetGroup@@ -13438,6 +13528,11 @@ PrefabsPlugin(scene: SceneData, read: (ref: string) => Promise<unknown | null>): Promise<(ref: string) => PrefabRoot | null>```+## resolveShot — function @experimental+```+(clips: readonly CameraClip[], time: number): ShotState | null+```+## resolveThemeTokens — function @experimental```(base: "dark" | "light", overrides?: ThemeOverrides): ThemeTokens@@ -13713,6 +13808,11 @@ ServicesPlugin(tokens: ThemeTokens): void```+## setTimelineShot — function @experimental+```+(host: CameraDirectorHost, owner: number, shot: TimelineShot | null): void+```+## setTreeViewData — function @beta```<T>(world: World, entity: Entity, data: TreeDataSource<T>, options?: Pick<TreeViewOptions<T>, "item" | "dragHandle" | "canDrop" | "onDrop">): () => void@@ -14233,6 +14333,11 @@ SystemDef(app: App, selectedId: number | null, withTree: boolean, opts?: WorldSnapshotOptions): WorldSnapshot```+## wouldNestCycle — function @experimental+```+(host: string, ref: string, lookup: SequenceLookup): boolean+```+## wrapSceneSystem — function @experimental```(app: App, sceneName: string, system: SystemDef): SystemDefdiff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.mdindex 55fcee75b..a1a6fa9cb 100644--- a/sdk/etc/minigame.api.md+++ b/sdk/etc/minigame.api.md@@ -1,7 +1,7 @@# API surface — esengine/minigame<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 115 public · 152 beta · 1642 experimental · 3 deprecated+Symbols: 115 public · 152 beta · 1657 experimental · 3 deprecated## ANCHOR_AXES — const @experimental```@@ -83,6 +83,14 @@ ranges: ActivationRange[]type: "activation"```+## ActiveShot — interface @experimental+```+curve: number+from: number | null+to: number+weight: number+```+## AdProvider — interface @experimental```createInterstitialAd: (adUnitId: string) => PlatformInterstitialAd@@ -1858,6 +1866,14 @@ minX: numberminY: number```+## CameraClip — interface @experimental+```+camera: string+curve: number | undefined+duration: number+start: number+```+## CameraCommit — const @beta```ResourceDef<CameraCommitData>@@ -1917,6 +1933,8 @@ shakeSeq: numbershakes: ActiveShake[]startTime: numbertarget: number+timelineOwner: number+timelineShot: TimelineShot | null```## CameraExtents — interface @experimental@@ -1991,6 +2009,14 @@ viewportPixels: ViewportworldHeight: number | undefined```+## CameraTrack — interface @experimental+```+childPath: string+clips: CameraClip[]+name: string+type: "camera"+```+## CameraTransformFields — interface @beta```worldPosition: { x: number; y: number; z: number; }@@ -5111,6 +5137,11 @@ Restart = 18```+## MAX_SEQUENCE_DEPTH — const @experimental+```+4+```+## MESH_MAX_BONES — const @experimental```64@@ -8285,6 +8316,39 @@ sensorEntity: numbervisitorEntity: number```+## SequenceClip — interface @experimental+```+duration: number+loop: boolean+root: string+speed: number+start: number+timeline: string+```++## SequenceLayer — interface @experimental+```+asset: TimelineAsset+clip: SequenceClip+key: string+ref: string+root: number+time: number+```++## SequenceLookup — type @experimental+```+(ref: string) => TimelineAsset | undefined+```++## SequenceTrack — interface @experimental+```+childPath: string+clips: SequenceClip[]+name: string+type: "sequence"+```+## ServicesPlugin — class @experimental```build: (app: App) => void@@ -8381,6 +8445,14 @@ pageWidth: numberspacing: number```+## ShotState — interface @experimental+```+curve: number+from: string | null+to: string+weight: number+```+## SideModuleDescriptor — interface @experimental```file: string@@ -9291,7 +9363,7 @@ readonly (keyof ThemeColors)[]## TIMELINE_FORMAT_VERSION — const @experimental```-"1.2"+"1.3"```## TIMELINE_MOTION — const @experimental@@ -9753,6 +9825,14 @@ static new (): TimelinePluginstatic prototype: TimelinePlugin```+## TimelineShot — interface @experimental+```+curve: number+from: number | null+to: number+weight: number+```+## TimerHandle — class @experimental```cancel: () => void@@ -9840,7 +9920,7 @@ y: number## Track — type @experimental```-PropertyTrack | SpineTrack | SpriteAnimTrack | AudioTrack | ActivationTrack | MarkerTrack | CustomEventTrack | AnimFramesTrack+PropertyTrack | SpineTrack | SpriteAnimTrack | AudioTrack | ActivationTrack | MarkerTrack | CustomEventTrack | AnimFramesTrack | CameraTrack | SequenceTrack```## TrackType — type @experimental@@ -11782,6 +11862,11 @@ MotionDriver<AnimatorBlend2DMotion>(prefab: PrefabData, loadPrefab: (path: string) => PrefabData | null, visited?: Set<string>): string[]```+## collectSequenceLayers — function @experimental+```+(asset: TimelineAsset, time: number, root: Entity, resolveChild: ChildResolver, lookup: SequenceLookup, chain?: readonly string[], keyPrefix?: string, depth?: number): SequenceLayer[]+```+## collider2DOutline — function @experimental```(shape: Collider2DShape, center: Vec2, angle: number, ppu: number): Collider2DOutline@@ -13707,6 +13792,11 @@ PrefabsPlugin(world: World, sceneData: SceneData): Map<number, Entity>```+## resolveActiveShot — function @experimental+```+(asset: TimelineAsset, time: number, root: Entity, resolveChild: ChildResolver, lookup: SequenceLookup): ActiveShot | null+```+## resolveAssetGroup — function @experimental```(projectRelPath: string, config: AssetGroupsConfig | null | undefined): ResolvedAssetGroup@@ -13742,6 +13832,11 @@ PrefabsPlugin(scene: SceneData, read: (ref: string) => Promise<unknown | null>): Promise<(ref: string) => PrefabRoot | null>```+## resolveShot — function @experimental+```+(clips: readonly CameraClip[], time: number): ShotState | null+```+## resolveThemeTokens — function @experimental```(base: "dark" | "light", overrides?: ThemeOverrides): ThemeTokens@@ -14017,6 +14112,11 @@ ServicesPlugin(tokens: ThemeTokens): void```+## setTimelineShot — function @experimental+```+(host: CameraDirectorHost, owner: number, shot: TimelineShot | null): void+```+## setTreeViewData — function @beta```<T>(world: World, entity: Entity, data: TreeDataSource<T>, options?: Pick<TreeViewOptions<T>, "item" | "dragHandle" | "canDrop" | "onDrop">): () => void@@ -14537,6 +14637,11 @@ SystemDef(app: App, selectedId: number | null, withTree: boolean, opts?: WorldSnapshotOptions): WorldSnapshot```+## wouldNestCycle — function @experimental+```+(host: string, ref: string, lookup: SequenceLookup): boolean+```+## wrapSceneSystem — function @experimental```(app: App, sceneName: string, system: SystemDef): SystemDefdiff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.mdindex e476cab26..30ffa3f7f 100644--- a/sdk/etc/wechat.api.md+++ b/sdk/etc/wechat.api.md@@ -1,7 +1,7 @@# API surface — esengine/wechat<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 115 public · 152 beta · 1633 experimental · 3 deprecated+Symbols: 115 public · 152 beta · 1648 experimental · 3 deprecated## ANCHOR_AXES — const @experimental```@@ -83,6 +83,14 @@ ranges: ActivationRange[]type: "activation"```+## ActiveShot — interface @experimental+```+curve: number+from: number | null+to: number+weight: number+```+## AdProvider — interface @experimental```createInterstitialAd: (adUnitId: string) => PlatformInterstitialAd@@ -1858,6 +1866,14 @@ minX: numberminY: number```+## CameraClip — interface @experimental+```+camera: string+curve: number | undefined+duration: number+start: number+```+## CameraCommit — const @beta```ResourceDef<CameraCommitData>@@ -1917,6 +1933,8 @@ shakeSeq: numbershakes: ActiveShake[]startTime: numbertarget: number+timelineOwner: number+timelineShot: TimelineShot | null```## CameraExtents — interface @experimental@@ -1991,6 +2009,14 @@ viewportPixels: ViewportworldHeight: number | undefined```+## CameraTrack — interface @experimental+```+childPath: string+clips: CameraClip[]+name: string+type: "camera"+```+## CameraTransformFields — interface @beta```worldPosition: { x: number; y: number; z: number; }@@ -5118,6 +5144,11 @@ Restart = 18```+## MAX_SEQUENCE_DEPTH — const @experimental+```+4+```+## MESH_MAX_BONES — const @experimental```64@@ -7999,6 +8030,39 @@ sensorEntity: numbervisitorEntity: number```+## SequenceClip — interface @experimental+```+duration: number+loop: boolean+root: string+speed: number+start: number+timeline: string+```++## SequenceLayer — interface @experimental+```+asset: TimelineAsset+clip: SequenceClip+key: string+ref: string+root: number+time: number+```++## SequenceLookup — type @experimental+```+(ref: string) => TimelineAsset | undefined+```++## SequenceTrack — interface @experimental+```+childPath: string+clips: SequenceClip[]+name: string+type: "sequence"+```+## ServicesPlugin — class @experimental```build: (app: App) => void@@ -8095,6 +8159,14 @@ pageWidth: numberspacing: number```+## ShotState — interface @experimental+```+curve: number+from: string | null+to: string+weight: number+```+## SideModuleDescriptor — interface @experimental```file: string@@ -9005,7 +9077,7 @@ readonly (keyof ThemeColors)[]## TIMELINE_FORMAT_VERSION — const @experimental```-"1.2"+"1.3"```## TIMELINE_MOTION — const @experimental@@ -9467,6 +9539,14 @@ static new (): TimelinePluginstatic prototype: TimelinePlugin```+## TimelineShot — interface @experimental+```+curve: number+from: number | null+to: number+weight: number+```+## TimerHandle — class @experimental```cancel: () => void@@ -9554,7 +9634,7 @@ y: number## Track — type @experimental```-PropertyTrack | SpineTrack | SpriteAnimTrack | AudioTrack | ActivationTrack | MarkerTrack | CustomEventTrack | AnimFramesTrack+PropertyTrack | SpineTrack | SpriteAnimTrack | AudioTrack | ActivationTrack | MarkerTrack | CustomEventTrack | AnimFramesTrack | CameraTrack | SequenceTrack```## TrackType — type @experimental@@ -11514,6 +11594,11 @@ MotionDriver<AnimatorBlend2DMotion>(prefab: PrefabData, loadPrefab: (path: string) => PrefabData | null, visited?: Set<string>): string[]```+## collectSequenceLayers — function @experimental+```+(asset: TimelineAsset, time: number, root: Entity, resolveChild: ChildResolver, lookup: SequenceLookup, chain?: readonly string[], keyPrefix?: string, depth?: number): SequenceLayer[]+```+## collider2DOutline — function @experimental```(shape: Collider2DShape, center: Vec2, angle: number, ppu: number): Collider2DOutline@@ -13434,6 +13519,11 @@ PrefabsPlugin(world: World, sceneData: SceneData): Map<number, Entity>```+## resolveActiveShot — function @experimental+```+(asset: TimelineAsset, time: number, root: Entity, resolveChild: ChildResolver, lookup: SequenceLookup): ActiveShot | null+```+## resolveAssetGroup — function @experimental```(projectRelPath: string, config: AssetGroupsConfig | null | undefined): ResolvedAssetGroup@@ -13469,6 +13559,11 @@ PrefabsPlugin(scene: SceneData, read: (ref: string) => Promise<unknown | null>): Promise<(ref: string) => PrefabRoot | null>```+## resolveShot — function @experimental+```+(clips: readonly CameraClip[], time: number): ShotState | null+```+## resolveThemeTokens — function @experimental```(base: "dark" | "light", overrides?: ThemeOverrides): ThemeTokens@@ -13744,6 +13839,11 @@ ServicesPlugin(tokens: ThemeTokens): void```+## setTimelineShot — function @experimental+```+(host: CameraDirectorHost, owner: number, shot: TimelineShot | null): void+```+## setTreeViewData — function @beta```<T>(world: World, entity: Entity, data: TreeDataSource<T>, options?: Pick<TreeViewOptions<T>, "item" | "dragHandle" | "canDrop" | "onDrop">): () => void@@ -14269,6 +14369,11 @@ SystemDef(app: App, selectedId: number | null, withTree: boolean, opts?: WorldSnapshotOptions): WorldSnapshot```+## wouldNestCycle — function @experimental+```+(host: string, ref: string, lookup: SequenceLookup): boolean+```+## wrapSceneSystem — function @experimental```(app: App, sceneName: string, system: SystemDef): SystemDefdiff --git a/sdk/src/asset/AssetLoader.ts b/sdk/src/asset/AssetLoader.tsindex f3614487f..1cd028d96 100644--- a/sdk/src/asset/AssetLoader.ts+++ b/sdk/src/asset/AssetLoader.ts@@ -128,6 +128,11 @@ export interface LoadContext {* one specialization, for the flip variants a texture has.*/acquireAsset<T>(type: string, ref: string): Promise<AssetLease<T>>;+ /**+ * The path an asset ref names, or null when it names nothing known. Optional: a loader that wants to+ * compare two spellings of one asset (a timeline deciding whether a clip plays itself) asks it.+ */+ resolveRef?(ref: string): string | null;/*** A prefab loaded, flattened and resolved, so it can be spawned in one* frame. Optional: a context built for a loader that never spawns has nodiff --git a/sdk/src/asset/Assets.ts b/sdk/src/asset/Assets.tsindex 4528209fc..2054ff08a 100644--- a/sdk/src/asset/Assets.ts+++ b/sdk/src/asset/Assets.ts@@ -2901,6 +2901,7 @@ export class Assets {acquireTexture: async (path, flipY) =>take(path, () => base.acquireTexture(path, flipY), 'texture'),acquireAsset: async (type, ref) => take(ref, () => this.acquireTypedLease_(type, ref), type),+ resolveRef: ref => this.resolveRef(ref),preparePrefab: async (ref) => take(ref, () => this.preparePrefabLease_(ref), 'prepared-prefab'),createOwnedTexture: async (width, height, pixels, flipY) => {this.assertLoading_(epoch);diff --git a/sdk/src/asset/loaders/TimelineAssetLoader.ts b/sdk/src/asset/loaders/TimelineAssetLoader.tsindex b7c4fa091..806e33a15 100644--- a/sdk/src/asset/loaders/TimelineAssetLoader.ts+++ b/sdk/src/asset/loaders/TimelineAssetLoader.ts@@ -12,6 +12,9 @@ import { parseTimelineAsset, extractTimelineAssetPaths } from '../../timeline/Tiimport type { PublishedTimeline } from '../../timeline/TimelineTypes';import { log } from '../../util/logger';+/** Timelines being prepared right now: a clip that names one of them is a cycle, and waiting on it would never end. */+const preparing = new Set<string>();+export class TimelineAssetLoader implements AssetLoader<TimelineResult> {readonly type = 'timeline';readonly extensions = ['.estimeline'];@@ -22,6 +25,25 @@ export class TimelineAssetLoader implements AssetLoader<TimelineResult> {const asset = parseTimelineAsset(JSON.parse(text));const textureHandles = new Map<string, number>();+ // The timelines its sequence clips play must be resolvable when it runs. One that is already being+ // prepared further up is a cycle: left out, and the player skips it the same way.+ preparing.add(path);+ try {+ for (const ref of extractTimelineAssetPaths(asset).timelines) {+ if (preparing.has(ctx.resolveRef?.(ref) ?? ref)) {+ log.warn('asset', `${path}: a sequence clip plays ${ref}, which is already playing this timeline — skipped`);+ continue;+ }+ try {+ await ctx.acquireAsset('timeline', ref);+ } catch (e) {+ log.warn('asset', `${path}: failed to load the sequence ${ref}`, e);+ }+ }+ } finally {+ preparing.delete(path);+ }+for (const texPath of extractTimelineAssetPaths(asset).textures) {try {const lease = await ctx.acquireTexture(texPath, true);diff --git a/sdk/src/camera/CameraDirector.ts b/sdk/src/camera/CameraDirector.tsindex 7c5e331cd..919277ec7 100644--- a/sdk/src/camera/CameraDirector.ts+++ b/sdk/src/camera/CameraDirector.ts@@ -97,6 +97,22 @@ export interface CameraDirectorState {/** Active transient shakes (applied to the rendered POV, never to the Transform). */shakes: ActiveShake[];shakeSeq: number;+ /**+ * The view a playing timeline's camera track asks for, set every step it has one. While present it+ * is the view and `setViewTarget` waits; when the track has nothing to say the scene's own camera is+ * the view again.+ */+ timelineShot: TimelineShot | null;+ /** The timeline player that set `timelineShot`, so only it can take it back. */+ timelineOwner: number;+}++/** A shot between two cameras, `weight` of the way from `from` (or none) to `to`. */+export interface TimelineShot {+ from: number | null;+ to: number;+ weight: number;+ curve: number;}export const DEFAULT_DIRECTOR: CameraDirectorState = {@@ -113,6 +129,8 @@ export const DEFAULT_DIRECTOR: CameraDirectorState = {currentMain: null,shakes: [],shakeSeq: 0,+ timelineShot: null,+ timelineOwner: -1,};/** A fresh director state (own arrays) — use per App, not the shared default. */@@ -156,6 +174,21 @@ export function setViewTarget(dir.pendingCurve = opts?.curve ?? BlendCurve.EaseInOut;}+/**+ * A playing timeline's camera track says which camera is the view (and, across an overlap, how far one is+ * blended into the next). Pass `null` to give the view back: only the player that set a shot can clear it.+ */+export function setTimelineShot(host: CameraDirectorHost, owner: number, shot: TimelineShot | null): void {+ const dir = directorOf(host);+ if (shot) {+ dir.timelineShot = shot;+ dir.timelineOwner = owner;+ } else if (dir.timelineOwner === owner) {+ dir.timelineShot = null;+ dir.timelineOwner = -1;+ }+}+/*** Trigger a transient camera shake on the active view — a decaying perturbation* applied to the rendered POV only (never to a camera's Transform, so it always@@ -254,6 +287,17 @@ export function resolveMainPOV(dir.target = dir.pendingTarget;}+ const shot = dir.timelineShot;+ const shotTo = shot ? candidates.find((c) => c.entity === shot.to) : undefined;+ if (shot && shotTo) {+ const shotFrom = shot.from === null ? undefined : candidates.find((c) => c.entity === shot.from);+ const cut = shotFrom ? lerpPOV(shotFrom, shotTo, applyCurve(shot.curve, shot.weight)) : shotTo;+ dir.blending = false;+ dir.from = null;+ dir.currentMain = cut;+ return applyShakes(dir, cut, now);+ }+const targetPOV =(dir.target >= 0 ? candidates.find((c) => c.entity === dir.target) : undefined) ??pickActive(candidates);diff --git a/sdk/src/core-content.ts b/sdk/src/core-content.tsindex 043e9bdbe..76274ee84 100644--- a/sdk/src/core-content.ts+++ b/sdk/src/core-content.ts@@ -870,6 +870,9 @@ export {type SampleWorld, type SampleDeps, type SampleOptions,type TimelineAsset, type Track, type PropertyTrack, type PropertyChannel, type Keyframe,type SpriteAnimTrack, type AudioTrack, type ActivationTrack, type SpineTrack, type AnimFramesTrack,+ type CameraClip, type CameraTrack, type SequenceClip, type SequenceTrack,+ MAX_SEQUENCE_DEPTH, collectSequenceLayers, wouldNestCycle, resolveShot, resolveActiveShot,+ type SequenceLayer, type SequenceLookup, type ShotState, type ActiveShot,} from './timeline';// =============================================================================diff --git a/sdk/src/core-render.ts b/sdk/src/core-render.tsindex e9ae00f75..003007cdb 100644--- a/sdk/src/core-render.ts+++ b/sdk/src/core-render.ts@@ -56,12 +56,12 @@ export type { ScreenScalingData } from './camera/ScreenScaling';export { EditorGrid, DEFAULT_EDITOR_GRID } from './camera/EditorGrid';export type { EditorGridData, GridColor } from './camera/EditorGrid';export { installEditorGrid } from './camera/editorGridRenderer';-export { CameraDirector, setViewTarget, shakeCamera, BlendCurve } from './camera/CameraDirector';+export { CameraDirector, setViewTarget, setTimelineShot, shakeCamera, BlendCurve } from './camera/CameraDirector';export { FollowTarget } from './camera/FollowTarget';export type { FollowTargetData } from './camera/FollowTarget';export { CameraBounds } from './camera/CameraBounds';export type { CameraBoundsData } from './camera/CameraBounds';-export type { CameraDirectorState } from './camera/CameraDirector';+export type { CameraDirectorState, TimelineShot } from './camera/CameraDirector';export type { CameraPOV } from './camera/CameraPlugin';export { cameraFrustumCorners, renderCameraFrame } from './camera/CameraPlugin';export type { CameraFields, CameraTransformFields } from './camera/CameraPlugin';diff --git a/sdk/src/timeline/TimelineDrive.ts b/sdk/src/timeline/TimelineDrive.tsindex a56ec56da..af34f1365 100644--- a/sdk/src/timeline/TimelineDrive.ts+++ b/sdk/src/timeline/TimelineDrive.ts@@ -16,6 +16,7 @@import { applyWrapMode, sampleTimeline, type SampleDeps, type SampleOptions } from './TimelineEvaluator';import { applyTimelineEvent, TimelineEventType } from './TimelineRuntime';import { TrackType, WrapMode, type TimelineAsset } from './TimelineTypes';+import { collectSequenceLayers, resolveActiveShot, type ActiveShot, type SequenceLookup } from './timelineSequences';import type { AudioAPI } from '../audio/Audio';import type { Entity } from '../types';@@ -28,10 +29,12 @@ export interface TimelineState {wrapMode: WrapMode;/** Per spine event-track (keyed by track index in asset.tracks): current clip, or -1. */spineClipIndices: Record<number, number>;+ /** The timelines playing inside this one, by `SequenceLayer.key`: where each was last step, for edge detection. */+ nested: Record<string, { time: number; spineClipIndices: Record<number, number> }>;}export function createTimelineState(wrapMode: WrapMode = WrapMode.Once, speed = 1): TimelineState {- return { time: 0, prevTime: 0, playing: false, speed, wrapMode, spineClipIndices: {} };+ return { time: 0, prevTime: 0, playing: false, speed, wrapMode, spineClipIndices: {}, nested: {} };}export interface FiredEvent {@@ -123,6 +126,10 @@ export interface AdvanceContext {sampleOpts?: SampleOptions;/** Side-effect hook after a property field is applied (e.g. UINode anim flags). */onPropertyApplied?: (entity: Entity, asset: TimelineAsset) => void;+ /** How a sequence clip finds the timeline it plays; without it nested clips are not played. */+ lookup?: SequenceLookup;+ /** The view this step asks for (null: none), for the camera director. */+ onShot?: (shot: ActiveShot | null) => void;}// ---------------------------------------------------------------------------@@ -153,6 +160,7 @@ export function applyPlayerFlags(flags: TimelinePlayerFlags, state: TimelineStatstate.time = 0;state.prevTime = 0;state.spineClipIndices = {};+ state.nested = {};flags.finished = false;changed = true;}@@ -207,6 +215,39 @@ export function advanceTimelineTS(applyTimelineEvent(ctx.deps.world, ctx.audio ?? null, e.kind, e.entity, e.intParam, e.floatParam, e.str);}+ const lookup = ctx.lookup ?? NO_TIMELINES;+ if (ctx.lookup) advanceNested(asset, root, state, ctx, ctx.lookup);+ ctx.onShot?.(resolveActiveShot(asset, state.time, root, ctx.deps.resolveChild, lookup));+if (wrapped.stopped) state.playing = false;return wrapped.stopped;}++const NO_TIMELINES: SequenceLookup = () => undefined;++/**+ * Play the timelines nested in `asset`: each runs on its own clock, samples its property tracks onto+ * its own root and fires its own events. A clip entered this step has no past (-1), so a trigger at its+ * start fires; one that has ended is forgotten, so entering it again starts it over.+ */+function advanceNested(asset: TimelineAsset, root: Entity, state: TimelineState, ctx: AdvanceContext, lookup: SequenceLookup): void {+ const live = new Set<string>();+ for (const layer of collectSequenceLayers(asset, state.time, root, ctx.deps.resolveChild, lookup)) {+ live.add(layer.key);+ sampleTimeline(layer.asset, layer.time, layer.root, ctx.deps, ctx.sampleOpts);+ ctx.onPropertyApplied?.(layer.root, layer.asset);+ const before = state.nested[layer.key];+ const prev = before ? before.time : -1;+ const child = createTimelineState(WrapMode.Once, 1);+ child.time = layer.time;+ child.prevTime = prev;+ child.spineClipIndices = before ? before.spineClipIndices : {};+ const segments: ReadonlyArray<readonly [number, number]> = layer.time < prev+ ? [[prev, layer.asset.duration], [0, layer.time]] : [[prev, layer.time]];+ for (const e of detectTimelineEvents(layer.asset, child, ctx.deps.resolveChild, layer.root, segments)) {+ applyTimelineEvent(ctx.deps.world, ctx.audio ?? null, e.kind, e.entity, e.intParam, e.floatParam, e.str);+ }+ state.nested[layer.key] = { time: layer.time, spineClipIndices: child.spineClipIndices };+ }+ for (const key of Object.keys(state.nested)) if (!live.has(key)) delete state.nested[key];+}diff --git a/sdk/src/timeline/TimelineLoader.ts b/sdk/src/timeline/TimelineLoader.tsindex 527831af6..912b4a9d0 100644--- a/sdk/src/timeline/TimelineLoader.ts+++ b/sdk/src/timeline/TimelineLoader.ts@@ -14,6 +14,8 @@ import {type MarkerTrack,type CustomEventTrack,type AnimFramesTrack,+ type CameraTrack,+ type SequenceTrack,} from './TimelineTypes';import { log } from '../util/logger';@@ -48,6 +50,8 @@ const MIGRATIONS: [string, string, MigrationFn][] = [}}}],+ // Camera and sequence tracks arrived without changing what an older document means.+ ['1.2', '1.3', () => undefined],];function migrateAsset(raw: any): void {@@ -63,6 +67,8 @@ function migrateAsset(raw: any): void {raw.version = TIMELINE_FORMAT_VERSION;}+const finite = (v: unknown, fallback: number): number => (typeof v === 'number' && Number.isFinite(v) ? v : fallback);+function parseTrack(raw: any): Track {const base = {name: raw.name ?? '',@@ -146,6 +152,34 @@ function parseTrack(raw: any): Track {})),} as AnimFramesTrack;+ case TrackType.Camera:+ return {+ ...base,+ childPath: '',+ type: TrackType.Camera,+ clips: (raw.clips ?? []).map((c: any) => ({+ start: finite(c.start, 0),+ duration: Math.max(0, finite(c.duration, 0)),+ camera: typeof c.camera === 'string' ? c.camera : '',+ ...(typeof c.curve === 'number' ? { curve: c.curve } : {}),+ })),+ } as CameraTrack;++ case TrackType.Sequence:+ return {+ ...base,+ childPath: '',+ type: TrackType.Sequence,+ clips: (raw.clips ?? []).map((c: any) => ({+ start: finite(c.start, 0),+ duration: Math.max(0, finite(c.duration, 0)),+ timeline: typeof c.timeline === 'string' ? c.timeline : '',+ root: typeof c.root === 'string' ? c.root : '',+ speed: finite(c.speed, 1) || 1,+ loop: c.loop === true,+ })),+ } as SequenceTrack;+default:log.warn('timeline', `Unknown track type: ${raw.type}, skipping`);return null as any;@@ -169,12 +203,15 @@ export interface TimelineAssetPaths {audio: string[];animClips: string[];textures: string[];+ /** The timelines its sequence clips play. */+ timelines: string[];}export function extractTimelineAssetPaths(asset: TimelineAsset): TimelineAssetPaths {const audio = new Set<string>();const animClips = new Set<string>();const textures = new Set<string>();+ const timelines = new Set<string>();for (const track of asset.tracks) {if (track.type === TrackType.Audio) {@@ -185,6 +222,8 @@ export function extractTimelineAssetPaths(asset: TimelineAsset): TimelineAssetPaif (track.clip) {animClips.add(track.clip);}+ } else if (track.type === TrackType.Sequence) {+ for (const clip of track.clips) if (clip.timeline) timelines.add(clip.timeline);} else if (track.type === TrackType.AnimFrames) {for (const frame of track.frames) {if (frame.texture) {@@ -198,5 +237,6 @@ export function extractTimelineAssetPaths(asset: TimelineAsset): TimelineAssetPaaudio: Array.from(audio),animClips: Array.from(animClips),textures: Array.from(textures),+ timelines: Array.from(timelines),};}diff --git a/sdk/src/timeline/TimelinePlugin.ts b/sdk/src/timeline/TimelinePlugin.tsindex 38aa17234..c91048c43 100644--- a/sdk/src/timeline/TimelinePlugin.ts+++ b/sdk/src/timeline/TimelinePlugin.ts@@ -16,6 +16,7 @@ import { AnimatorController } from '../animation/Animator';import { TIMELINE_MOTION, createTimelineMotionDriver } from './timelineMotion';import { resolveChildEntity } from './TimelineRuntime';import { advanceTimelineTS, applyPlayerFlags, latchPlayerFinish } from './TimelineDrive';+import { CameraDirector, setTimelineShot } from '../camera/CameraDirector';import type { SampleDeps } from './TimelineEvaluator';import type { Entity } from '../types';@@ -70,6 +71,7 @@ export class TimelinePlugin implements Plugin {this.offDespawn_ = world.onDespawn((entity: Entity) => {app.getResource(Timeline).removeState(entity);this.animFramesStates_.delete(entity);+ if (app.hasResource(CameraDirector)) setTimelineShot(app.getResource(CameraDirector), entity, null);});// The timeline runs entirely in TS: a per-entity@@ -82,6 +84,7 @@ export class TimelinePlugin implements Plugin {const tl = app.getResource(Timeline);const audio: AudioAPI | null = app.hasResource(Audio) ? app.getResource(Audio) : null;const assets = app.hasResource(Assets) ? app.getResource(Assets) : null;+ const director = app.hasResource(CameraDirector) ? app.getResource(CameraDirector) : null;const deps: SampleDeps = {world,getComponent,@@ -108,8 +111,14 @@ export class TimelinePlugin implements Plugin {this.ensureAnimFrames(entity, asset);- const justFinished = advanceTimelineTS(asset, entity, state, time.delta, { deps, audio });+ const justFinished = advanceTimelineTS(asset, entity, state, time.delta, {+ deps, audio,+ lookup: (ref) => tl.getAsset(ref),+ onShot: director ? (shot) => setTimelineShot(director, entity, shot) : undefined,+ });this.processAnimFrames(world, entity, state.time, published?.textureHandles);+ // A clip that ran out gives the view back; one that is only paused keeps it.+ if (justFinished && director) setTimelineShot(director, entity, null);if (latchPlayerFinish(player, state, justFinished) || rewound) {world.insert(entity, TimelinePlayer, player);diff --git a/sdk/src/timeline/TimelineSerializer.ts b/sdk/src/timeline/TimelineSerializer.tsindex 90464a320..fe2910d2f 100644--- a/sdk/src/timeline/TimelineSerializer.ts+++ b/sdk/src/timeline/TimelineSerializer.ts@@ -45,6 +45,10 @@ function serializeTrack(track: Track): Record<string, unknown> {return { ...base, markers: track.markers };case TrackType.CustomEvent:return { ...base, events: track.events };+ case TrackType.Camera:+ return { ...base, childPath: '', clips: track.clips };+ case TrackType.Sequence:+ return { ...base, childPath: '', clips: track.clips };case TrackType.AnimFrames:// On-disk key is `animFrames` (matches the loader's read path).return { ...base, animFrames: track.frames };diff --git a/sdk/src/timeline/TimelineTypes.ts b/sdk/src/timeline/TimelineTypes.tsindex dc6625c39..38e2ad213 100644--- a/sdk/src/timeline/TimelineTypes.ts+++ b/sdk/src/timeline/TimelineTypes.ts@@ -5,7 +5,7 @@* loader migrates up to: two constants would let a document be written at a* version its own reader thinks needs migrating.*/-export const TIMELINE_FORMAT_VERSION = '1.2';+export const TIMELINE_FORMAT_VERSION = '1.3';export const WrapMode = {Once: 0,@@ -55,6 +55,8 @@ export const TrackType = {Marker: 'marker',CustomEvent: 'customEvent',AnimFrames: 'animFrames',+ Camera: 'camera',+ Sequence: 'sequence',} as const;export type TrackType = (typeof TrackType)[keyof typeof TrackType];@@ -154,7 +156,44 @@ export interface AnimFramesTrack extends TrackBase {frames: AnimFrame[];}-export type Track = PropertyTrack | SpineTrack | SpriteAnimTrack | AudioTrack | ActivationTrack | MarkerTrack | CustomEventTrack | AnimFramesTrack;+/**+ * One shot: the camera that is the view for `duration` seconds from `start`.+ * Shots that touch cut; shots that overlap blend over the overlap, with this shot's `curve` (a+ * BlendCurve) shaping the later one's arrival.+ */+export interface CameraClip {+ start: number;+ duration: number;+ /** The camera entity, as a name path below the timeline's root, like every track's target. */+ camera: string;+ curve?: number;+}++/** The view over time. Not about any one object, so its `childPath` is always empty. */+export interface CameraTrack extends TrackBase {+ type: typeof TrackType.Camera;+ clips: CameraClip[];+}++/** Another timeline, played in a window of this one. */+export interface SequenceClip {+ start: number;+ duration: number;+ /** The `.estimeline` it plays, by asset ref. */+ timeline: string;+ /** Where the nested timeline's own name paths start, below this timeline's root ('' = the root itself). */+ root: string;+ speed: number;+ /** Repeat the nested timeline to fill `duration` instead of holding its last frame. */+ loop: boolean;+}++export interface SequenceTrack extends TrackBase {+ type: typeof TrackType.Sequence;+ clips: SequenceClip[];+}++export type Track = PropertyTrack | SpineTrack | SpriteAnimTrack | AudioTrack | ActivationTrack | MarkerTrack | CustomEventTrack | AnimFramesTrack | CameraTrack | SequenceTrack;export interface TimelineAsset {version: string;diff --git a/sdk/src/timeline/index.ts b/sdk/src/timeline/index.tsindex fcdbcf1a1..f37c05956 100644--- a/sdk/src/timeline/index.ts+++ b/sdk/src/timeline/index.ts@@ -19,6 +19,10 @@ export {type MarkerTrack,type CustomEvent,type CustomEventTrack,+ type CameraClip,+ type CameraTrack,+ type SequenceClip,+ type SequenceTrack,type AnimFrame,type AnimFramesTrack,type Track,@@ -65,6 +69,19 @@ export {type PlayheadRun,} from './timelineEvents';+export {+ MAX_SEQUENCE_DEPTH,+ sequenceLocalTime,+ collectSequenceLayers,+ wouldNestCycle,+ resolveShot,+ resolveActiveShot,+ type SequenceLayer,+ type SequenceLookup,+ type ShotState,+ type ActiveShot,+} from './timelineSequences';+export {serializeTimelineAsset,serializeTimelineToJson,diff --git a/sdk/src/timeline/timelineSequences.ts b/sdk/src/timeline/timelineSequences.tsnew file mode 100644index 000000000..019626f17--- /dev/null+++ b/sdk/src/timeline/timelineSequences.ts@@ -0,0 +1,148 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file timelineSequences.ts+ * @brief Which timelines play inside which, and which camera is the view when.+ *+ * Both are pure functions of (asset, time), so playback, scrubbing and a backwards run all ask the+ * same question and get the same answer: nothing here remembers the previous frame.+ */+import { TrackType, type CameraClip, type SequenceClip, type TimelineAsset } from './TimelineTypes';+import type { Entity } from '../types';++/** Timelines nested deeper than this are not played (and the editor refuses to build them). */+export const MAX_SEQUENCE_DEPTH = 4;++/** What a nested timeline sees: its own clock, and the entity its name paths start from. */+export interface SequenceLayer {+ /** Stable across frames while the clip plays: which track and clip, down the nesting. */+ key: string;+ asset: TimelineAsset;+ ref: string;+ /** The nested timeline's own time. */+ time: number;+ clip: SequenceClip;+ root: Entity;+}++export type SequenceLookup = (ref: string) => TimelineAsset | undefined;+export type ChildResolver = (root: Entity, childPath: string) => Entity | null;++/** The time a nested timeline is at when its parent is at `parentTime`, or null outside the clip. */+export function sequenceLocalTime(clip: SequenceClip, parentTime: number, childDuration: number): number | null {+ if (parentTime < clip.start || parentTime >= clip.start + clip.duration) return null;+ const raw = (parentTime - clip.start) * clip.speed;+ if (childDuration <= 0) return 0;+ if (clip.loop) return raw % childDuration;+ return raw >= childDuration ? childDuration : raw;+}++/**+ * The timelines playing inside `asset` at `time`, outermost first, with each one's own time and root.+ * A timeline already on the way down (a loop) or past the depth limit is skipped, not entered.+ */+export function collectSequenceLayers(+ asset: TimelineAsset, time: number, root: Entity, resolveChild: ChildResolver, lookup: SequenceLookup,+ chain: readonly string[] = [], keyPrefix = '', depth = 0,+): SequenceLayer[] {+ if (depth >= MAX_SEQUENCE_DEPTH) return [];+ const out: SequenceLayer[] = [];+ asset.tracks.forEach((track, ti) => {+ if (track.type !== TrackType.Sequence) return;+ track.clips.forEach((clip, ci) => {+ if (!clip.timeline || chain.includes(clip.timeline)) return;+ const child = lookup(clip.timeline);+ if (!child) return;+ const local = sequenceLocalTime(clip, time, child.duration);+ if (local === null) return;+ const childRoot = clip.root ? resolveChild(root, clip.root) : root;+ if (childRoot == null) return;+ const key = `${keyPrefix}${ti}.${ci}/`;+ out.push({ key, asset: child, ref: clip.timeline, time: local, clip, root: childRoot });+ out.push(...collectSequenceLayers(child, local, childRoot, resolveChild, lookup, [...chain, clip.timeline], key, depth + 1));+ });+ });+ return out;+}++/** Whether `ref` can be played inside `asset` without it ending up inside itself, by whatever route. */+export function wouldNestCycle(host: string, ref: string, lookup: SequenceLookup): boolean {+ if (host === ref) return true;+ const seen = new Set<string>();+ const reaches = (from: string): boolean => {+ if (from === host) return true;+ if (seen.has(from)) return false;+ seen.add(from);+ const asset = lookup(from);+ if (!asset) return false;+ for (const track of asset.tracks) {+ if (track.type !== TrackType.Sequence) continue;+ for (const clip of track.clips) if (clip.timeline && reaches(clip.timeline)) return true;+ }+ return false;+ };+ return reaches(ref);+}++/** The view at one moment: `to` is the camera now, `from` the one it is leaving, `weight` how far across. */+export interface ShotState {+ from: string | null;+ to: string;+ /** 0..1 along the overlap; 1 when there is nothing being left. */+ weight: number;+ curve: number;+}++/**+ * Which camera is the view at `time`. Clips that touch cut; clips that overlap blend over the overlap.+ * No clip over `time` is no answer (null): the scene's own camera takes over.+ */+export function resolveShot(clips: readonly CameraClip[], time: number): ShotState | null {+ const live = clips+ .filter((c) => c.camera && time >= c.start && (time < c.start + c.duration || (c.duration === 0 && time === c.start)))+ .sort((a, b) => a.start - b.start);+ if (live.length === 0) return null;+ const to = live[live.length - 1]!;+ const from = live.length > 1 ? live[live.length - 2]! : null;+ if (!from) return { from: null, to: to.camera, weight: 1, curve: to.curve ?? 3 };+ const overlap = from.start + from.duration - to.start;+ const weight = overlap > 0 ? Math.min(1, Math.max(0, (time - to.start) / overlap)) : 1;+ return { from: from.camera, to: to.camera, weight, curve: to.curve ?? 3 };+}++/** A shot with its cameras resolved to entities — what the camera director takes. */+export interface ActiveShot {+ from: Entity | null;+ to: Entity;+ weight: number;+ curve: number;+}++/**+ * The shot at `time` across a timeline and the ones nested in it: the outermost timeline that has a camera+ * answer wins, so a parent's cut is not overridden by what a child inside it was doing.+ */+export function resolveActiveShot(+ asset: TimelineAsset, time: number, root: Entity, resolveChild: ChildResolver, lookup: SequenceLookup,+): ActiveShot | null {+ const tryAsset = (a: TimelineAsset, t: number, r: Entity): ActiveShot | null => {+ for (const track of a.tracks) {+ if (track.type !== TrackType.Camera) continue;+ const shot = resolveShot(track.clips, t);+ if (!shot) continue;+ const to = resolveChild(r, shot.to);+ if (to == null) continue;+ const from = shot.from === null ? null : resolveChild(r, shot.from);+ return { from: from ?? null, to, weight: from == null ? 1 : shot.weight, curve: shot.curve };+ }+ return null;+ };+ const own = tryAsset(asset, time, root);+ if (own) return own;+ for (const layer of collectSequenceLayers(asset, time, root, resolveChild, lookup)) {+ const shot = tryAsset(layer.asset, layer.time, layer.root);+ if (shot) return shot;+ }+ return null;+}+diff --git a/sdk/tests/camera-director.test.ts b/sdk/tests/camera-director.test.tsindex d7ec1e491..c404c8926 100644--- a/sdk/tests/camera-director.test.ts+++ b/sdk/tests/camera-director.test.ts@@ -131,3 +131,30 @@ describe('resolveMainPOV', () => {expect(d.shakes.length).toBe(1);});});++describe('timeline shot override', () => {+ const A = mkPOV({ entity: 1, isActive: true, x: 0 });+ const B = mkPOV({ entity: 2, x: 100 });++ it('holds the shot camera over the active one, and blends across an overlap', () => {+ const d = dir();+ d.timelineShot = { from: null, to: 2, weight: 1, curve: BlendCurve.Linear };+ expect(resolveMainPOV(d, [A, B], 0, true)?.entity).toBe(2);+ d.timelineShot = { from: 1, to: 2, weight: 0.5, curve: BlendCurve.Linear };+ expect(resolveMainPOV(d, [A, B], 0, true)!.x).toBeCloseTo(50);+ });++ it('gives the view back to the scene camera once the shot is cleared', () => {+ const d = dir();+ d.timelineShot = { from: null, to: 2, weight: 1, curve: BlendCurve.Linear };+ resolveMainPOV(d, [A, B], 0, true);+ d.timelineShot = null;+ expect(resolveMainPOV(d, [A, B], 1, true)?.entity).toBe(1);+ });++ it('falls back to normal selection when the shot camera is gone', () => {+ const d = dir();+ d.timelineShot = { from: null, to: 9, weight: 1, curve: BlendCurve.Linear };+ expect(resolveMainPOV(d, [A, B], 0, true)?.entity).toBe(1);+ });+});diff --git a/sdk/tests/timeline-drive.test.ts b/sdk/tests/timeline-drive.test.tsindex bfb810e8c..4a79e64dd 100644--- a/sdk/tests/timeline-drive.test.ts+++ b/sdk/tests/timeline-drive.test.ts@@ -287,3 +287,40 @@ describe('whose wrap mode wins', () => {expect(resolveWrapMode('sideways', WrapMode.Loop)).toBe(WrapMode.Loop);});});++describe('nested sequences', () => {+ const deps: SampleDeps = { world: {} as SampleDeps['world'], getComponent: () => undefined, resolveChild: resolveRoot };+ const child: TimelineAsset = {+ version: '1.3', type: 'timeline', duration: 2, wrapMode: WrapMode.Once,+ tracks: [{ type: TrackType.CustomEvent, name: 'E', childPath: '', events: [{ time: 0, name: 'go', payload: {} }] }],+ };+ const parent: TimelineAsset = {+ version: '1.3', type: 'timeline', duration: 6, wrapMode: WrapMode.Once,+ tracks: [{ type: TrackType.Sequence, name: 'S', childPath: '', clips: [+ { start: 1, duration: 2, timeline: 'child', root: '', speed: 1, loop: false },+ ] }],+ };+ const lookup = (ref: string) => (ref === 'child' ? child : undefined);++ it('runs a nested clock, forgets it after the clip and starts it over on re-entry', () => {+ const s = createTimelineState(WrapMode.Once);+ s.playing = true;+ const shots: unknown[] = [];+ const step = (dt: number) => advanceTimelineTS(parent, ROOT, s, dt, { deps, lookup, onShot: (x) => shots.push(x) });+ step(0.5);+ expect(Object.keys(s.nested)).toHaveLength(0);+ step(1);+ expect(Object.keys(s.nested)).toEqual(['0.0/']);+ expect(s.nested['0.0/']!.time).toBeCloseTo(0.5);+ step(2);+ expect(Object.keys(s.nested)).toHaveLength(0);+ expect(shots.every((x) => x === null)).toBe(true);+ });++ it('does nothing for nested clips without a lookup', () => {+ const s = createTimelineState(WrapMode.Once);+ s.playing = true;+ advanceTimelineTS(parent, ROOT, s, 1.5, { deps });+ expect(Object.keys(s.nested)).toHaveLength(0);+ });+});diff --git a/sdk/tests/timeline-sequences.test.ts b/sdk/tests/timeline-sequences.test.tsnew file mode 100644index 000000000..94472ddbc--- /dev/null+++ b/sdk/tests/timeline-sequences.test.ts@@ -0,0 +1,142 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+import { describe, it, expect } from 'vitest';+import { parseTimelineAsset, extractTimelineAssetPaths } from '../src/timeline/TimelineLoader';+import { serializeTimelineAsset } from '../src/timeline/TimelineSerializer';+import {+ collectSequenceLayers, resolveShot, resolveActiveShot, wouldNestCycle, sequenceLocalTime, MAX_SEQUENCE_DEPTH,+} from '../src/timeline/timelineSequences';+import { TrackType, WrapMode, type CameraClip, type SequenceClip, type TimelineAsset } from '../src/timeline/TimelineTypes';+import type { Entity } from '../src/types';++const seq = (timeline: string, start: number, duration: number, extra: Partial<SequenceClip> = {}): SequenceClip =>+ ({ start, duration, timeline, root: '', speed: 1, loop: false, ...extra });++const host = (duration: number, ...tracks: TimelineAsset['tracks']): TimelineAsset =>+ ({ version: '1.3', type: 'timeline', duration, wrapMode: WrapMode.Once, tracks });++const seqTrack = (...clips: SequenceClip[]) => ({ type: TrackType.Sequence, name: 'S', childPath: '', clips }) as const;+const camTrack = (...clips: CameraClip[]) => ({ type: TrackType.Camera, name: 'C', childPath: '', clips }) as const;++const resolveChild = (root: Entity, path: string): Entity | null => (path === '' ? root : (path.length as Entity) + 100 as Entity);++describe('camera shots', () => {+ const a: CameraClip = { start: 0, duration: 2, camera: 'A' };+ const b: CameraClip = { start: 2, duration: 2, camera: 'B' };++ it('answers nothing outside every clip', () => {+ expect(resolveShot([a, b], 4.5)).toBeNull();+ expect(resolveShot([], 0)).toBeNull();+ });++ it('cuts where clips touch', () => {+ expect(resolveShot([a, b], 1.99)).toMatchObject({ from: null, to: 'A', weight: 1 });+ expect(resolveShot([a, b], 2)).toMatchObject({ from: null, to: 'B', weight: 1 });+ });++ it('blends across an overlap', () => {+ const over: CameraClip = { start: 1.5, duration: 2, camera: 'B', curve: 1 };+ const s = resolveShot([a, over], 1.75)!;+ expect(s.from).toBe('A');+ expect(s.to).toBe('B');+ expect(s.weight).toBeCloseTo(0.5);+ expect(s.curve).toBe(1);+ expect(resolveShot([a, over], 2.5)).toMatchObject({ to: 'B', weight: 1 });+ });++ it('is a pure function of time', () => {+ const over: CameraClip = { start: 1, duration: 2, camera: 'B' };+ const forward = [0.5, 1.2, 1.8].map((t) => resolveShot([a, over], t));+ const backward = [1.8, 1.2, 0.5].map((t) => resolveShot([a, over], t)).reverse();+ expect(backward).toEqual(forward);+ });++ it('the outermost timeline with an answer wins', () => {+ const child = host(2, camTrack({ start: 0, duration: 2, camera: 'Inner' }));+ const lookup = (ref: string) => (ref === 'child' ? child : undefined);+ const parentSilent = host(4, seqTrack(seq('child', 1, 2)));+ expect(resolveActiveShot(parentSilent, 1.5, 1 as Entity, resolveChild, lookup)?.to).toBe('Inner'.length + 100);+ const parentCut = host(4, camTrack({ start: 0, duration: 4, camera: 'Outer' }), seqTrack(seq('child', 1, 2)));+ expect(resolveActiveShot(parentCut, 1.5, 1 as Entity, resolveChild, lookup)?.to).toBe('Outer'.length + 100);+ expect(resolveActiveShot(parentSilent, 3.5, 1 as Entity, resolveChild, lookup)).toBeNull();+ });+});++describe('sequence layers', () => {+ const child = host(2);+ const lookup = (ref: string) => (ref === 'child' ? child : undefined);++ it('maps parent time to nested time with speed, hold and loop', () => {+ expect(sequenceLocalTime(seq('c', 1, 4), 0.5, 2)).toBeNull();+ expect(sequenceLocalTime(seq('c', 1, 4), 5, 2)).toBeNull();+ expect(sequenceLocalTime(seq('c', 1, 4), 2, 2)).toBeCloseTo(1);+ expect(sequenceLocalTime(seq('c', 1, 4), 4, 2)).toBe(2);+ expect(sequenceLocalTime(seq('c', 1, 4, { loop: true }), 4, 2)).toBeCloseTo(1);+ expect(sequenceLocalTime(seq('c', 0, 4, { speed: 2 }), 0.5, 2)).toBeCloseTo(1);+ });++ it('collects playing layers with a stable key and own root', () => {+ const parent = host(4, seqTrack(seq('child', 1, 2, { root: 'Rig' })));+ const layers = collectSequenceLayers(parent, 1.5, 1 as Entity, resolveChild, lookup);+ expect(layers).toHaveLength(1);+ expect(layers[0]!.time).toBeCloseTo(0.5);+ expect(layers[0]!.key).toBe('0.0/');+ expect(layers[0]!.root).toBe('Rig'.length + 100);+ expect(collectSequenceLayers(parent, 3.5, 1 as Entity, resolveChild, lookup)).toHaveLength(0);+ });++ it('skips a root it cannot find', () => {+ const parent = host(4, seqTrack(seq('child', 0, 2, { root: 'Gone' })));+ expect(collectSequenceLayers(parent, 1, 1 as Entity, () => null, lookup)).toHaveLength(0);+ });++ it('does not enter a timeline already on the way down', () => {+ const a = host(2, seqTrack(seq('b', 0, 2)));+ const b = host(2, seqTrack(seq('a', 0, 2)));+ const lk = (ref: string) => (ref === 'a' ? a : ref === 'b' ? b : undefined);+ const layers = collectSequenceLayers(a, 1, 1 as Entity, resolveChild, lk, ['a']);+ expect(layers.map((l) => l.ref)).toEqual(['b']);+ });++ it('stops at the depth limit', () => {+ const mk = (i: number) => host(2, seqTrack(seq(`t${i + 1}`, 0, 2)));+ const lk = (ref: string) => mk(Number(ref.slice(1)));+ const layers = collectSequenceLayers(mk(0), 1, 1 as Entity, resolveChild, lk);+ expect(layers.length).toBe(MAX_SEQUENCE_DEPTH);+ });++ it('detects nesting cycles by any route', () => {+ const a = host(2, seqTrack(seq('b', 0, 1)));+ const b = host(2, seqTrack(seq('c', 0, 1)));+ const c = host(2);+ const lk = (ref: string) => ({ a, b, c } as Record<string, TimelineAsset>)[ref];+ expect(wouldNestCycle('a', 'a', lk)).toBe(true);+ expect(wouldNestCycle('c', 'a', lk)).toBe(true);+ expect(wouldNestCycle('a', 'c', lk)).toBe(false);+ });+});++describe('format 1.3', () => {+ const raw = {+ version: '1.2', type: 'timeline', duration: 4, wrapMode: 'once',+ tracks: [+ { type: 'camera', name: 'Shots', clips: [{ start: 0, duration: 2, camera: 'Cam', curve: 2 }, { start: 'x', camera: 5 }] },+ { type: 'sequence', name: 'Subs', clips: [{ start: 1, duration: 2, timeline: 'sub.estimeline', speed: 0, loop: true }] },+ ],+ };++ it('reads, sanitises and round-trips camera and sequence tracks', () => {+ const asset = parseTimelineAsset(raw);+ expect(asset.version).toBe('1.3');+ const cam = asset.tracks[0]!;+ expect(cam.type === TrackType.Camera && cam.clips[1]).toEqual({ start: 0, duration: 0, camera: '' });+ const sub = asset.tracks[1]!;+ expect(sub.type === TrackType.Sequence && sub.clips[0]).toMatchObject({ speed: 1, loop: true, root: '' });+ const again = parseTimelineAsset(JSON.parse(JSON.stringify(serializeTimelineAsset(asset))));+ expect(again).toEqual(asset);+ });++ it('lists the timelines a sequence plays for preloading', () => {+ expect(extractTimelineAssetPaths(parseTimelineAsset(raw)).timelines).toEqual(['sub.estimeline']);+ });+});diff --git a/sdk/tests/timeline-serializer.test.ts b/sdk/tests/timeline-serializer.test.tsindex bc6b53875..1bafffc18 100644--- a/sdk/tests/timeline-serializer.test.ts+++ b/sdk/tests/timeline-serializer.test.ts@@ -6,7 +6,7 @@ import { parseTimelineAsset } from '../src/timeline/TimelineLoader';import { WrapMode, TrackType, InterpType, TIMELINE_FORMAT_VERSION, type TimelineAsset } from '../src/timeline/TimelineTypes';const ASSET: TimelineAsset = {- version: '1.2',+ version: TIMELINE_FORMAT_VERSION,type: 'timeline',duration: 5,wrapMode: WrapMode.Loop,@@ -36,6 +36,18 @@ const ASSET: TimelineAsset = {childPath: 'fx',frames: [{ texture: 't0' }, { texture: 't1', duration: 0.1 }],},+ {+ type: TrackType.Camera,+ name: 'Shots',+ childPath: '',+ clips: [{ start: 0, duration: 2, camera: 'CamWide' }, { start: 1.5, duration: 2, camera: 'CamHero', curve: 1 }],+ },+ {+ type: TrackType.Sequence,+ name: 'Subs',+ childPath: '',+ clips: [{ start: 1, duration: 2, timeline: 'sub.estimeline', root: 'Hero', speed: 2, loop: true }],+ },],};diff --git a/tools/goldenProjects.mjs b/tools/goldenProjects.mjsindex 76bc641ea..a2fe81a57 100644--- a/tools/goldenProjects.mjs+++ b/tools/goldenProjects.mjs@@ -92,6 +92,7 @@ export const CENSUS_FLOOR = '0.60.0';* that does not exist, and release notes are a different act. Theirs is ungated.*/export const SHIPPED = {+ "Camera shots and nested sequences on the timeline.": { notCertifiable: "Camera and sequence tracks are covered by the timeline-sequences, timeline-drive and camera-director SDK tests and the editor timeline-clips tests; no golden project plays a timeline with a camera or sequence track." },"Dynamic planar reflections.": { notCertifiable: "Planar reflection is covered by the planar-reflection and planar-reflection-off render-scene pixel gates, tools/tests/planar-reflection.e2e.mjs, test_planar_reflection and the planar-reflection editor authoring check; no golden project carries a reflecting surface." },"SUD OpenPaaS development export.": { notCertifiable: "The OpenPaaS export is covered by the pipeline export and package tests, the native SUD runtime end-to-end check and the packer verification; no golden project is packaged for OpenPaaS." },"Plugin filesystem operations.": { notCertifiable: "Editor plugin file access is covered by the plugin-filesystem editor authoring check and the editor tests; a packaged game loads no editor plugin." },diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex ac9dd1c46..3d812821c 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -2447,4 +2447,8 @@ export const NOTED = {{"internal":"Chooses the matching engine branch in editor CI; changes only contributor verification."},"feat: preview device quality and stabilize lighting workflows":{"note":"Device quality profiles can be previewed in the editor."},+ "feat(timeline): camera and sequence tracks play shots and nested timelines":+ {"note":"Timelines have camera and sequence tracks."},+ "feat(editor): the Sequencer edits camera shots and sequence clips":+ {"note":"Timelines have camera and sequence tracks."},};