Import: image sequences with a Sequence option, ranges, folders and missing frames (#297)
Image sequences were found only by the desktop media prober: one picked numbered still brought its whole run, with no way to import just that frame, picking every frame made one sequence item per frame, the browser couldn't make sequences at all, and a gap in the numbering closed up silently. The engine now groups numbered stills itself (engine/src/sequence.rs): one picked file brings its run from its folder, several picked files of one run import as that range, a picked or dropped folder imports its files with each run as a sequence, and Force Alphabetical Order takes every image of that type in the folder by name. `file.import` takes `sequence` (default on), `alphabetical` and `frameRate`; Replace Footage, Reload, proxies and render outputs probe the same way. The media layer probes one file; the browser lists its file table for the run and registers every frame with its media pool. File > Import > File... asks, like After Effects' "PNG Sequence" checkbox, whether picked numbered stills import as a sequence, with Force Alphabetical Order and the frame rate. Sequences are named `shot_[0001-0250].png`. Interpret Footage gains Missing Frames (Show Placeholder, colour bars as in After Effects, the new default; Hold Previous Frame; Skip) and Start Frame (the frame number at the footage's first frame: trims or pads the head). Saved projects keep Skip, so their sequences play as before. Form notes keep a readable width and the form fits its rows, so OK stays in view. docs/footage.md explains importing footage and sequences. Test: tests_sequence (engine: run, picked range, every frame, Sequence off, folder, alphabetical, Interpret Footage Missing Frames / Start Frame, Replace Footage and Reload), project sequence unit tests, sequence_gaps_show_placeholders_hold_or_close_up (media), import_dialog_offers_the_image_sequence_option and dropped_frames_import_as_one_sequence_with_sequence_interpretation (UI). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4aaadd0ed3
commit
50c9549529
@@ -37,6 +37,7 @@ pub mod remote;
|
||||
pub mod render_queue;
|
||||
pub mod roto;
|
||||
pub mod scriptui;
|
||||
pub mod sequence;
|
||||
mod session_settings;
|
||||
pub mod shortcuts;
|
||||
pub mod storage;
|
||||
@@ -110,6 +111,19 @@ pub trait Services: Send + Sync {
|
||||
}
|
||||
self.write_file(path, data)
|
||||
}
|
||||
/// The files in folder `dir` (full paths; no folders, no hidden files), for image-sequence
|
||||
/// detection on import. Empty when it can't be read.
|
||||
fn list_dir(&self, dir: &str) -> Vec<String> {
|
||||
let Ok(rd) = std::fs::read_dir(if dir.is_empty() { "." } else { dir }) else { return vec![] };
|
||||
rd.filter_map(|e| e.ok())
|
||||
.filter(|e| e.file_type().is_ok_and(|t| t.is_file()) && !e.file_name().to_string_lossy().starts_with('.'))
|
||||
.map(|e| e.path().to_string_lossy().to_string())
|
||||
.collect()
|
||||
}
|
||||
/// Whether `path` is a folder (dropped or picked folders import their files).
|
||||
fn is_dir(&self, path: &str) -> bool {
|
||||
std::path::Path::new(path).is_dir()
|
||||
}
|
||||
}
|
||||
|
||||
/// Native filesystem.
|
||||
@@ -125,11 +139,15 @@ impl Services for FsServices {
|
||||
|
||||
/// Imports media files into the project (implemented by the media layer).
|
||||
pub trait Importer: Send + Sync {
|
||||
/// Probe a file and return footage metadata.
|
||||
/// Probe one file and return footage metadata. Image sequences are the engine's
|
||||
/// ([`sequence`]): it groups numbered stills and probes their first file here.
|
||||
fn probe(&self, path: &str) -> std::result::Result<effectcraft_project::Footage, String>;
|
||||
/// A footage file's bytes are now at `path` (extracted from a template): hosts whose media
|
||||
/// layer reads from memory (the browser) register them; file-based ones need nothing.
|
||||
fn register(&self, _path: &str, _data: &[u8]) {}
|
||||
/// An image sequence's other frames (its first was probed) are footage now: hosts whose
|
||||
/// media layer reads from memory (the browser) register them; file-based ones need nothing.
|
||||
fn add_frames(&self, _paths: &[String]) {}
|
||||
}
|
||||
|
||||
/// A keyframe reference: layer, property uid, key time (layer time).
|
||||
@@ -1013,6 +1031,8 @@ mod tests_proxy;
|
||||
#[cfg(test)]
|
||||
mod tests_rig3d;
|
||||
#[cfg(test)]
|
||||
mod tests_sequence;
|
||||
#[cfg(test)]
|
||||
mod tests_settings;
|
||||
#[cfg(test)]
|
||||
mod tests_stubs;
|
||||
|
||||
Reference in New Issue
Block a user