Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

engine: treat null sequence options as unspecified in Replace Footage

Madhav Agarwal9fd14225eb2e
diff --git a/crates/engine/src/cmd/file_more.rs b/crates/engine/src/cmd/file_more.rs
index f03096657..11b79ff9d 100644
--- a/crates/engine/src/cmd/file_more.rs
+++ b/crates/engine/src/cmd/file_more.rs
@@ -885,7 +885,7 @@ fn replace_footage(s: &mut Session, p: &Value) -> Result<Value> {
_ => (false, false, false),
};
let mut opts = SequenceOptions::from_params(p);
- if p.get("sequence").is_none() && p.get("alphabetical").is_none() {
+ if b_p(p, "sequence").is_none() && b_p(p, "alphabetical").is_none() {
(opts.sequence, opts.folders, opts.alphabetical) = previous;
}
let src = crate::sequence::source_of(s.services.as_ref(), &path, opts);
diff --git a/crates/engine/src/tests/sequence.rs b/crates/engine/src/tests/sequence.rs
index d99a600d3..91bf0a399 100644
--- a/crates/engine/src/tests/sequence.rs
+++ b/crates/engine/src/tests/sequence.rs
@@ -190,6 +190,10 @@ fn replace_footage_keeps_a_still_a_still() {
s.execute("file.replaceFootage", json!({"path": at(&dir, "shot_0004.png")})).unwrap();
let (name, f) = footage(&s, &item);
assert_eq!((name.as_str(), f.kind), ("shot_0004.png", FootageKind::Still));
+ // JSON null is unspecified, not "on": the still stays a still.
+ s.execute("file.replaceFootage", json!({"path": at(&dir, "shot_0004.png"), "sequence": null})).unwrap();
+ let (name, f) = footage(&s, &item);
+ assert_eq!((name.as_str(), f.kind), ("shot_0004.png", FootageKind::Still));
// Asking for the run still brings it.
s.execute("file.replaceFootage", json!({"path": at(&dir, "shot_0004.png"), "sequence": true})).unwrap();
let (name, f) = footage(&s, &item);