Export: Skip Existing keeps a frame already in the overflow folder

This commit is contained in:
Dylan M. Taylor committed 2026-11-11 16:37:21 +00:00
1 parent b03ebc4b83
commit d6cfc1bfa4
4 files changed
+47 -1

No files matched your search

Generated
+1
View File
@@ -1592,6 +1592,7 @@ dependencies = [
"image",
"log",
"rayon",
"tempfile",
"thiserror 2.0.21",
"web-time",
]
+1
View File
@@ -31,6 +31,7 @@ thiserror = { workspace = true }
log = { workspace = true }
[dev-dependencies]
tempfile = { workspace = true }
effectcraft-media = { workspace = true }
effectcraft-effects = { workspace = true }
effectcraft-color = { workspace = true }
+6 -1
View File
@@ -329,7 +329,12 @@ async fn sequence(cx: &Cx<'_>, comp: &Comp, w: u32, h: u32, st: &mut State<'_>)
let mut buf = std::io::Cursor::new(Vec::new());
write_still(cx, &mut buf, &img, comp, StillOutput { format: fmt, channels, size: (w, h), quality: cx.output.quality })?;
let data = buf.into_inner();
let path = cx.place(&path, data.len() as u64);
let primary = path;
let path = cx.place(&primary, data.len() as u64);
// Skip Existing also protects a frame already in the overflow folder.
if cx.settings.skip_existing && path != primary && out::exists(cx.sink, &path) {
return Ok(0);
}
let mut f = cx.create(&path)?;
std::io::Write::write_all(&mut f, &data).map_err(io)?;
f.finish()
+39
View File
@@ -444,6 +444,45 @@ fn cancelled_export_removes_only_files_it_opened() {
std::fs::remove_dir_all(dir).unwrap();
}
/// Skip Existing keeps a frame that is already in the overflow folder the frame is placed in
/// (it checked only the primary destination, then truncated the overflow file).
#[test]
fn skip_existing_keeps_a_frame_in_the_overflow_folder() {
struct Overflow;
impl StorageQuota for Overflow {
fn has_room(&self, path: &str, _: u64) -> bool {
path.contains("overflow")
}
}
let guard = tempfile::tempdir().unwrap();
let (dir, over) = (guard.path().to_path_buf(), guard.path().join("overflow"));
std::fs::create_dir_all(&over).unwrap();
std::fs::write(over.join("clip_00000.png"), b"keep").unwrap();
let (p, cid) = project(FrameRate::new(25, 1), |_, _| {});
let settings = RenderSettings { skip_existing: true, storage_overflow: true, ..Default::default() };
let om = OutputModule::for_format(OutputFormat::PngSequence);
let path = dir.join("clip_[#####].png");
let result = export(
&Job {
project: &p,
footage: &NoFootage,
expr: None,
accel: None,
comp: cid,
settings: &settings,
output: &om,
path: path.to_str().unwrap(),
sink: None,
nested_switches: true,
options: JobOptions { storage: Some(&Overflow), overflow: vec![over.to_string_lossy().into_owned()], ..Default::default() },
},
&mut |_| true,
);
assert!(result.is_ok(), "{result:?}");
assert_eq!(std::fs::read(over.join("clip_00000.png")).unwrap(), b"keep");
assert!(over.join("clip_00001.png").exists(), "the other frames are still written");
}
/// A GPU compositor stand-in that renders every frame solid green (the CPU draws the bar and the
/// block on black) and keeps Auto's timing history.
#[derive(Default)]