From f5a82152394fde4d8f740f664ab7737b82861618 Mon Sep 17 00:00:00 2001 From: cashmere Date: Tue, 28 Jul 2026 19:41:16 +0200 Subject: 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 --- rust/crates/commands/src/scene/rename_scene.rs | 58 ++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 rust/crates/commands/src/scene/rename_scene.rs (limited to 'rust/crates/commands/src/scene/rename_scene.rs') diff --git a/rust/crates/commands/src/scene/rename_scene.rs b/rust/crates/commands/src/scene/rename_scene.rs new file mode 100644 index 00000000..4876fb9b --- /dev/null +++ b/rust/crates/commands/src/scene/rename_scene.rs @@ -0,0 +1,58 @@ +use scene::Project; + +use crate::command::{Command, CommandError, CommandResult}; + +pub struct RenameSceneCommand { + scene_id: String, + new_name: String, + saved_name: Option, + saved_updated_at: Option>, +} + +impl RenameSceneCommand { + pub fn new(scene_id: impl Into, new_name: impl Into) -> Self { + Self { + scene_id: scene_id.into(), + new_name: new_name.into(), + saved_name: None, + saved_updated_at: None, + } + } +} + +impl Command for RenameSceneCommand { + fn execute( + &mut self, + project: &mut Project, + ) -> Result, CommandError> { + let Some(scene) = project + .scenes + .iter_mut() + .find(|scene| scene.id == self.scene_id) + else { + return Ok(None); + }; + + self.saved_name = Some(scene.name.clone()); + self.saved_updated_at = Some(scene.updated_at); + scene.name = self.new_name.clone(); + scene.updated_at = chrono::Utc::now(); + Ok(None) + } + + fn undo(&mut self, project: &mut Project) { + let (Some(saved_name), Some(saved_updated_at)) = + (&self.saved_name, self.saved_updated_at) + else { + return; + }; + if let Some(scene) = project + .scenes + .iter_mut() + .find(|scene| scene.id == self.scene_id) + { + scene.name = saved_name.clone(); + scene.updated_at = saved_updated_at; + } + } +} -- cgit v1.3.1