summaryrefslogtreecommitdiff
path: root/rust/crates/commands/src/scene/create_scene.rs
diff options
context:
space:
mode:
authorcashmere <cashmere@autistici.org>2026-07-28 19:41:16 +0200
committercashmere <cashmere@autistici.org>2026-07-28 19:41:16 +0200
commitf5a82152394fde4d8f740f664ab7737b82861618 (patch)
tree5a51b181abead1ce03d2dbfc12b77918d3be0e1b /rust/crates/commands/src/scene/create_scene.rs
parente837e7504379e100ff3b56282577ec67bb88bec9 (diff)
downloadopencut-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/create_scene.rs')
-rw-r--r--rust/crates/commands/src/scene/create_scene.rs46
1 files changed, 46 insertions, 0 deletions
diff --git a/rust/crates/commands/src/scene/create_scene.rs b/rust/crates/commands/src/scene/create_scene.rs
new file mode 100644
index 00000000..1f2de02b
--- /dev/null
+++ b/rust/crates/commands/src/scene/create_scene.rs
@@ -0,0 +1,46 @@
+use scene::{Project, Scene};
+
+use crate::command::{Command, CommandError, CommandResult};
+
+pub struct CreateSceneCommand {
+ name: String,
+ is_main: bool,
+ saved_scenes: Option<Vec<Scene>>,
+ created_scene_id: Option<String>,
+}
+
+impl CreateSceneCommand {
+ pub fn new(name: impl Into<String>, is_main: bool) -> Self {
+ Self {
+ name: name.into(),
+ is_main,
+ saved_scenes: None,
+ created_scene_id: None,
+ }
+ }
+
+ pub fn scene_id(&self) -> Option<&str> {
+ self.created_scene_id.as_deref()
+ }
+}
+
+impl Command for CreateSceneCommand {
+ fn execute(
+ &mut self,
+ project: &mut Project,
+ ) -> Result<Option<CommandResult>, CommandError> {
+ self.saved_scenes = Some(project.scenes.clone());
+
+ let created = timeline::scenes::build_default_scene(&self.name, self.is_main);
+ self.created_scene_id = Some(created.id.clone());
+ project.scenes.push(created);
+ Ok(None)
+ }
+
+ fn undo(&mut self, project: &mut Project) {
+ let Some(saved) = &self.saved_scenes else {
+ return;
+ };
+ project.scenes = saved.clone();
+ }
+}