diff options
| author | cashmere <cashmere@autistici.org> | 2026-07-28 19:41:16 +0200 |
|---|---|---|
| committer | cashmere <cashmere@autistici.org> | 2026-07-28 19:41:16 +0200 |
| commit | f5a82152394fde4d8f740f664ab7737b82861618 (patch) | |
| tree | 5a51b181abead1ce03d2dbfc12b77918d3be0e1b /rust/crates/commands/src/scene/update_bookmark.rs | |
| parent | e837e7504379e100ff3b56282577ec67bb88bec9 (diff) | |
| download | opencut-f5a82152394fde4d8f740f664ab7737b82861618.tar.gz | |
feat: GPUI desktop port foundation
- scene crate: full project/scene/element model, serde round-trip
proven against the web SerializedProject shape
- transfer crate: .ocp zip container, cross-compat with web fflate
archives proven in both directions
- storage crate: filesystem project store replacing IndexedDB,
.ocp import/export
- media crate: ffmpeg-next 8 decoder (frames, audio, thumbnails,
waveform summaries)
- playback crate: wall-clock anchored, frame-rounded playback clock
- gpu crate: native texture readback; compositor renders headless
offscreen on Vulkan (spike test)
- flake devshell: rust toolchain, GPUI native deps, ffmpeg dev,
bindgen clang args; GPUI hello-world builds
- port plan in notes/gpui-port.md
Diffstat (limited to 'rust/crates/commands/src/scene/update_bookmark.rs')
| -rw-r--r-- | rust/crates/commands/src/scene/update_bookmark.rs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/rust/crates/commands/src/scene/update_bookmark.rs b/rust/crates/commands/src/scene/update_bookmark.rs new file mode 100644 index 00000000..f2c9b94e --- /dev/null +++ b/rust/crates/commands/src/scene/update_bookmark.rs @@ -0,0 +1,49 @@ +use scene::Project; +use time::MediaTime; + +use crate::bookmarks::{BookmarkPatch, get_frame_time, update_bookmark_in_array}; +use crate::command::{Command, CommandError, CommandResult}; +use crate::project_ext::active_scene_mut; + +pub struct UpdateBookmarkCommand { + time: MediaTime, + updates: BookmarkPatch, + saved_bookmarks: Option<Vec<scene::Bookmark>>, +} + +impl UpdateBookmarkCommand { + pub fn new(time: MediaTime, updates: BookmarkPatch) -> Self { + Self { + time, + updates, + saved_bookmarks: None, + } + } +} + +impl Command for UpdateBookmarkCommand { + fn execute( + &mut self, + project: &mut Project, + ) -> Result<Option<CommandResult>, CommandError> { + let fps = project.settings.fps; + let Some(scene) = active_scene_mut(project) else { + return Ok(None); + }; + + self.saved_bookmarks = Some(scene.bookmarks.clone()); + let frame_time = get_frame_time(self.time, fps); + scene.bookmarks = + update_bookmark_in_array(&scene.bookmarks, frame_time, &self.updates); + Ok(None) + } + + fn undo(&mut self, project: &mut Project) { + let Some(saved) = &self.saved_bookmarks else { + return; + }; + if let Some(scene) = active_scene_mut(project) { + scene.bookmarks = saved.clone(); + } + } +} |
