Repository navigation
feat(cursor): per-section cursor motion lane on the timeline #1652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6a20551
093c5a3
975a248
ce79f04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -350,6 +350,8 @@ unsafe fn walk_timeline( | |
| let cursor_enabled = scene.is_some(); | ||
| let cursor_smoothing = scene.as_ref().map(|s| s.cursor.smoothing).unwrap_or(0.0); | ||
| let mut cursor_tracks: HashMap<String, CursorTrack> = HashMap::new(); | ||
| // `None`: the file has no readable telemetry, so it is not read again for the next clip. | ||
| let mut raw_cursor_tracks: HashMap<String, Option<CursorTrack>> = HashMap::new(); | ||
| let mut cursor_active_path: Option<String> = None; | ||
|
|
||
| let mut frames: u64 = 0; | ||
|
|
@@ -506,13 +508,33 @@ unsafe fn walk_timeline( | |
| } | ||
|
|
||
| if cursor_enabled { | ||
| // Keyed by file AND turn: the same file turned is another track. | ||
| let key = cursor_key(&clip.screen, turned); | ||
| // Keyed by file AND turn: the same file turned is another track. The raw file is read | ||
| // once; the shaped track is also keyed by where this clip's spring restarts | ||
| // (`Scene::cursor_break_for_clip`, as in preview), so one clip's start never resets | ||
| // the cursor inside another clip on the same file. The editor's cursor-motion | ||
| // sections reshape it too (`CursorTrack::shaped`); they are the file's, the same for | ||
| // every clip on it. | ||
| let raw_key = cursor_key(&clip.screen, turned); | ||
| let clip_break = scene.as_ref().and_then(|s| s.cursor_break_for_clip(clip_index)); | ||
| let key = match clip_break { | ||
| Some(at) => format!("{raw_key}#{}", at.to_bits()), | ||
|
Comment on lines
+519
to
+520
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bound the cache of full-recording shaped tracks. Each distinct restart time now creates a cache entry for the entire recording. Entries remain until For a one-hour recording, each 240 Hz track retains about 20.7 MB in Bound or evict shaped variants after use. Keep the separate raw cache so eviction does not cause repeated telemetry reads.
|
||
| None => raw_key.clone(), | ||
| }; | ||
| if !cursor_tracks.contains_key(&key) { | ||
| let path = format!("{}.cursor.json", clip.screen); | ||
| if let Ok(raw) = CursorTrack::load(&path, 0.0, 24.0 * 3600.0) { | ||
| let raw = if turned { raw.turned() } else { raw }; | ||
| cursor_tracks.insert(key.clone(), raw.smoothed(cursor_smoothing)); | ||
| if !raw_cursor_tracks.contains_key(&raw_key) { | ||
| let path = format!("{}.cursor.json", clip.screen); | ||
| let raw = CursorTrack::load(&path, 0.0, 24.0 * 3600.0) | ||
| .ok() | ||
| .map(|raw| if turned { raw.turned() } else { raw }); | ||
| raw_cursor_tracks.insert(raw_key.clone(), raw); | ||
| } | ||
| if let Some(Some(raw)) = raw_cursor_tracks.get(&raw_key) { | ||
| let breaks: Vec<f32> = clip_break.into_iter().collect(); | ||
| let motion = scene | ||
| .as_ref() | ||
| .map(|s| s.cursor.motion_for(&clip.screen)) | ||
| .unwrap_or_default(); | ||
| cursor_tracks.insert(key.clone(), raw.shaped(cursor_smoothing, &breaks, &motion)); | ||
| } | ||
| // absente/illisible → pas d'entrée : ce clip s'exporte sans curseur (visible, | ||
| // pas masqué en un curseur fantôme d'un autre clip). | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve the preceding restart across contiguous splits.
For clips
[0,1],[2,2.0333], and[2.0333,3]on one recording, the second clip restarts its spring at 2 seconds. The third clip returnsNone, so preview and export rebuild its path without that restart. With a moving pointer, the third clip returns to the globally lagging path and introduces a jump at the plain split.Carry the restart from the start of the contiguous source chain. A removed interval must start a new chain; a plain split must preserve that chain's restart. Add a test that compares the shaped positions across this sequence.