Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

Merge M3.2/M3.11 (Trim Monitor, dynamic trimming, keyboard shortcuts) into M10.1–2; project schema v3 for graphic clips so older builds refuse them cleanly

Brandon Thomas07c584f1a2c4
diff --cc crates/engine/src/commands.rs
index 565c5d06b,11b631850..e562753b3
--- a/crates/engine/src/commands.rs
+++ b/crates/engine/src/commands.rs
@@@ -1817,7 -1849,7 +1852,8 @@@ fn build() -> Vec<CommandSpec>
)),
];
v.extend(crate::captions::commands());
+ v.extend(crate::graphics::commands());
+ v.extend(crate::shortcuts::commands());
// Labels as individual commands (Edit ▸ Label ▸ <name>)
for l in Label::ALL {
let _ = l;
diff --cc crates/format/src/lib.rs
index 29a955473,29a955473..d81da80e6
--- a/crates/format/src/lib.rs
+++ b/crates/format/src/lib.rs
@@@ -19,6 -19,6 +19,9 @@@
//! Schema history:
//! - **v1** (M0–M11): the bare serialized `Project` object with a `"version": 1` field.
//! - **v2** (M11.1): the envelope above; `Project.version` dropped (the envelope carries it).
++//! - **v3** (M10.2): graphic clips (`ItemKind::Graphic`, text/shape layers). The shape of older
++//! data is unchanged (no-op step); the bump makes builds without graphics refuse such files
++//! cleanly instead of failing to parse them.
pub mod atomic;
pub mod autosave;
@@@ -37,7 -37,7 +40,7 @@@ pub type Migration = fn(Value) -> Resul
/// `MIGRATIONS[i]` upgrades schema `i + 1` to `i + 2`. Append one function per schema bump; never
/// edit a shipped one.
--pub const MIGRATIONS: &[Migration] = &[v1_to_v2];
++pub const MIGRATIONS: &[Migration] = &[v1_to_v2, v2_to_v3];
/// The schema version this build writes (and the newest it reads).
pub const SCHEMA_VERSION: u32 = MIGRATIONS.len() as u32 + 1;
@@@ -211,13 -211,13 +214,18 @@@ fn v1_to_v2(doc: Value) -> Result<Value
}))
}
++/// v2 → v3: graphic clips added; existing data needs no change.
++fn v2_to_v3(doc: Value) -> Result<Value, String> {
++ Ok(doc)
++}
++
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn schema_version_matches_table() {
-- assert_eq!(SCHEMA_VERSION, 2);
++ assert_eq!(SCHEMA_VERSION, 3);
}
#[test]
diff --cc docs/project-files.md
index 91e64a286,91e64a286..9b6dfc6ae
--- a/docs/project-files.md
+++ b/docs/project-files.md
@@@ -8,7 -8,7 +8,7 @@@ writing them is `crates/format` (`filmc
```json
{
"format": "filmcraft.project",
-- "schema_version": 2,
++ "schema_version": 3,
"generator": "FilmCraft 0.1.0",
"project": { "name": "…", "settings": { … }, "root": { … }, "items": { … }, "next_id": 48 }
}
@@@ -26,6 -26,6 +26,7 @@@
|---|---|---|
| 1 | M0 | the bare `Project` object with a `"version": 1` field |
| 2 | M11.1 | the envelope above; the project's own `version` field is gone |
++| 3 | M10.2 | graphic clips (`ItemKind::Graphic` with text/shape layers); a no-op step for older data |
### Migrations
@@@ -40,6 -40,6 +41,9 @@@ document; after the last one the resul
3. never edit a migration that has shipped.
Fields added with `#[serde(default)]` don't need a migration: missing values take their defaults.
++But when new data would make the file unreadable to an older build (a new enum variant such as
++`ItemKind::Graphic`, a new required shape), bump the schema with a no-op step so older builds refuse
++the file with the message below instead of failing with a parse error.
When you open an older file FilmCraft says so ("Upgraded project from schema v1 to v2"). The file
on disk is unchanged until you save. The **first save over it** keeps the original next to it as
@@@ -49,8 -49,8 +53,8 @@@
A file with a `schema_version` newer than the build supports is **refused**, not half-read:
--> this project was saved by a newer version of FilmCraft (project schema v3); this build reads up to
--> v2. Update FilmCraft to open it.
++> this project was saved by a newer version of FilmCraft (project schema v4); this build reads up to
++> v3. Update FilmCraft to open it.
Reading it partially and saving it back would silently drop whatever the newer version added.