Struct Project

Source
pub struct Project {
Show 29 fields pub version: u32, pub name: String, pub width: u32, pub height: u32, pub fps: f64, pub assets: Vec<Asset>, pub folders: Vec<String>, pub linked_folders: Vec<String>, pub tracks: Vec<Track>, pub in_point: Option<f64>, pub out_point: Option<f64>, pub source_video: Option<String>, pub subtitles: Vec<Cue>, pub subtitle_style: TextStyle, pub subtitle_margin: f32, pub show_subtitles: bool, pub subtitle_cont_prefix: String, pub subtitle_cont_suffix: String, pub scaler: Scaler, pub labels: Vec<Label>, pub markers: Vec<Marker>, pub buses: Vec<Bus>, pub sequences: Vec<Sequence>, pub editing: Option<u64>, pub main_stash: Option<Stash>, pub plan: Vec<PlanItem>, pub notes: String, pub paths: Vec<PathAsset>, next_id: u64,
}

Fields§

§version: u32§name: String§width: u32§height: u32§fps: f64§assets: Vec<Asset>§folders: Vec<String>

Library folders that exist even while empty (“A/B” nesting by ‘/’).

§linked_folders: Vec<String>

Folders on disk browsed directly from the library (files are imported on drop).

§tracks: Vec<Track>

Order: all video tracks (V1, V2, …) then all audio tracks (A1, A2, …). While editing is Some(seq), these are that sequence’s tracks (the main timeline is in main_stash).

§in_point: Option<f64>§out_point: Option<f64>§source_video: Option<String>

Set when the project was created by opening a video file directly; enables “Save” (overwrite).

§subtitles: Vec<Cue>

Subtitle cues (kept sorted by start). Rendered bottom-centre by the compositor when show_subtitles.

§subtitle_style: TextStyle§subtitle_margin: f32

Distance from the bottom edge in project pixels.

§show_subtitles: bool§subtitle_cont_prefix: String

Prepended/appended to a generated cue where a sentence continues across the cue split (e.g. “…” / “ —“). Applied by “Regenerate cues”, not retroactively.

§subtitle_cont_suffix: String§scaler: Scaler

Compositor resampling quality.

§labels: Vec<Label>

Colour labels (name + colour), editable by the user.

§markers: Vec<Marker>

Timeline markers (sorted by time).

§buses: Vec<Bus>

Mixer buses; buses[0] is Main and always exists.

§sequences: Vec<Sequence>

Nested timelines (usable as footage via ClipKind::Sequence).

§editing: Option<u64>

The sequence currently swapped into tracks for editing (None = main timeline).

§main_stash: Option<Stash>§plan: Vec<PlanItem>

Planner (nested tasks with moodboards) and free-form notes (process / ideas / style).

§notes: String§paths: Vec<PathAsset>

Saved drawing / polygon outlines, reusable as motion paths (see PathAsset).

§next_id: u64

Implementations§

Source§

impl Project

Source

pub fn new() -> Self

Source

pub fn from_media(asset: Asset) -> Self

New project sized from a media asset, with the asset laid out at t=0 (video + one audio track per stream).

Source

pub fn new_id(&mut self) -> u64

Source

pub fn asset(&self, id: u64) -> Option<&Asset>

Source

pub fn asset_mut(&mut self, id: u64) -> Option<&mut Asset>

Source

pub fn asset_by_path(&self, path: &str) -> Option<&Asset>

Source

pub fn add_asset(&mut self, a: Asset) -> u64

Adds an asset (de-duplicated by path) and returns its id.

Source

pub fn remove_asset(&mut self, id: u64)

Removes an asset and every clip using it. Removes an asset and every clip using it — in the live timeline, the stashed main timeline and every nested sequence (a leftover clip would render black / silent).

Source

pub fn folder_names(&self) -> Vec<String>

All folder names (explicit + used by assets), sorted.

Source

pub fn add_folder(&mut self, name: &str) -> bool

Create (or ensure) a folder; returns false if the name is empty.

Source

pub fn remove_folder(&mut self, name: &str)

Remove a folder (and sub-folders); assets inside move to the root.

Source

pub fn duration(&self) -> f64

Source

pub fn is_empty(&self) -> bool

Source

pub fn frame_dur(&self) -> f64

Source

pub fn snap_frame(&self, t: f64) -> f64

Source

pub fn find(&self, id: u64) -> Option<(usize, usize)>

(track index, clip index) of a clip.

Source

pub fn clip(&self, id: u64) -> Option<&Clip>

Source

pub fn clip_mut(&mut self, id: u64) -> Option<&mut Clip>

Source

pub fn track_of(&self, clip: u64) -> Option<usize>

Source

pub fn all_clips(&self) -> impl Iterator<Item = (usize, &Clip)>

Source

pub fn linked(&self, id: u64) -> Vec<u64>

All clip ids linked with id (including itself).

Expand a selection to include linked clips.

Source

pub fn video_tracks(&self) -> Vec<usize>

Source

pub fn audio_tracks(&self) -> Vec<usize>

Source

pub fn cut_points(&self) -> Vec<f64>

Sorted distinct clip boundaries (plus 0) for prev/next-cut navigation.

Source

pub fn active(&self, tidx: usize) -> bool

Mute/solo resolution: a track is audible/visible if (no solo among its kind && !muted) || solo.

Source

pub fn head_room(&self, clip: &Clip) -> f64

Source seconds available before the clip’s left edge (for Clip::trim_start).

Source

pub fn max_clip_duration(&self, clip: &Clip) -> f64

Longest duration the clip may have (right edge), given its source window, speed and direction.

Source

pub fn add_track(&mut self, kind: TrackKind) -> usize

Adds a track of kind (video tracks stay before audio tracks) and returns its index.

Source

pub fn remove_track(&mut self, idx: usize)

Source

fn rename_tracks(&mut self)

Source

pub fn find_free_track( &mut self, kind: TrackKind, start: f64, dur: f64, prefer: Option<usize>, ) -> usize

First track of kind (preferring prefer) where [start,start+dur) is free; adds one if needed.

Source

pub fn tidy(&mut self)

Re-sort clips and drop transitions whose cuts no longer exist. Call after any layout change.

Source

pub fn insert_asset_clips( &mut self, asset_id: u64, at: f64, video_track: Option<usize>, ) -> Vec<u64>

Place an asset on the timeline at at: video/image clip on a video track (preferring video_track) plus one linked audio clip per audio stream (stream N preferring track A(N+1)). Returns new clip ids.

Source

pub fn add_text_clip(&mut self, at: f64, dur: f64) -> u64

Add a text clip on the topmost video track that has room (or a new one).

Source

pub fn split_at(&mut self, t: f64, only: Option<&[u64]>) -> Vec<u64>

Split every clip crossing t (or only the given ids). Right halves of a linked group stay linked to each other under a fresh link id. Returns the new (right-half) ids.

Source

pub fn freeze_at(&mut self, t: f64, ids: &[u64]) -> Vec<u64>

Freeze-frame the clips at timeline time t: each clip is split at t and its right part becomes a still of the frame at t (linked clips of the same time too). Returns the frozen clip ids.

Source

pub fn delete_clips(&mut self, ids: &[u64], ripple: bool)

Delete clips. With ripple, later clips close the gap (per track, only where no other clip overlaps the gap).

Source

fn close_gap(&mut self, a: f64, b: f64)

Shift clips starting at/after b left by (b-a) on every track where [a,b) is free.

Source

pub fn ripple_delete_range(&mut self, a: f64, b: f64)

Remove everything in [a,b) on all tracks and close the gap.

Source

pub fn ripple_open(&mut self, at: f64, span: f64)

Open a gap of span seconds at at: split anything crossing it, then slide every clip from there on to the right. The inverse of ripple_delete_range, used by Paste Insert.

Source

pub fn trim_to_range(&mut self, a: f64, b: f64)

Keep only [a,b), moving it to start at 0. Clears in/out points.

Source

pub fn move_clips( &mut self, ids: &[u64], dt: f64, dtrack: i32, track_kind: Option<TrackKind>, ) -> bool

Move clips by dt seconds; clips on tracks of track_kind also move by dtrack tracks within their kind. All-or-nothing: returns false (and changes nothing) if any destination is blocked or out of range.

Source

pub fn set_enabled(&mut self, ids: &[u64], enabled: bool)

Set enabled on the clips (linked clips too).

Unlink the clips if any is linked; otherwise link them together.

Source

pub fn set_speed(&mut self, ids: &[u64], speed: f64, reverse: bool) -> bool

Apply speed/reverse to the clips and their linked clips (keeps source windows; durations follow). Returns false if the new lengths would collide with neighbours (nothing changed).

Source

pub fn add_transition( &mut self, right: u64, kind: TransitionKind, duration: f64, ) -> Option<u64>

Add (or replace) a transition at the cut on the left of clip right. Linked audio clips whose left neighbour is linked with the video’s left neighbour get an audio CrossFade of the same length. Returns the new transition id, or None if right has no abutting left neighbour.

Source

pub fn add_edge_transition( &mut self, clip: u64, kind: TransitionKind, duration: f64, out: bool, ) -> Option<u64>

Add (or replace) an edge transition at the start (out false) or end (out true) of clip: the clip blends from/to nothing, no neighbour needed. Mirrors on linked clips like add_transition.

Source

fn add_transition_at( &mut self, right: u64, kind: TransitionKind, duration: f64, edge: TransitionEdge, ) -> Option<u64>

Source

fn clear_transition_slot(track: &mut Track, c: &Clip, edge: TransitionEdge)

Remove whatever transition already occupies the spot a new one is going to: a Cut or In at the start of c share the start slot (plus the previous clip’s Out); an Out at the end of c shares the end slot with the next clip’s Cut / In.

Source

pub fn remove_transition(&mut self, id: u64)

Source

pub fn transition_mut(&mut self, id: u64) -> Option<&mut Transition>

Source

pub fn transitions_of(&self, clip: u64) -> Vec<(usize, &Transition)>

Transitions touching a clip (as left or right side): (track index, transition).

Source

pub fn cue_at(&self, t: f64) -> Option<&Cue>

Source

pub fn add_cue(&mut self, start: f64, end: f64, text: impl Into<String>) -> u64

Source

pub fn remove_cue(&mut self, id: u64)

Source

pub fn split_cue(&mut self, id: u64, t: f64) -> Option<u64>

Split cue id at t (both halves keep the text, like splitting a clip); the new right-half id, or None when t is outside the cue or too close to an edge for two readable halves.

Source

pub fn cues_to_text_clips(&mut self, only: Option<&[u64]>) -> usize

Convert cues into editable Text clips on a topmost “Subtitles” video track, styled and placed like the burn-in. only limits it to those cue ids; converted cues are removed. Returns how many.

Source

pub fn sort_cues(&mut self)

Source

pub fn sequence(&self, id: u64) -> Option<&Sequence>

Source

pub fn sequence_mut(&mut self, id: u64) -> Option<&mut Sequence>

Source

pub fn new_sequence( &mut self, name: impl Into<String>, width: u32, height: u32, fps: f64, ) -> u64

New empty sequence (V1 + A1) with the given format; returns its id.

Source

pub fn sequence_duration(&self, id: u64) -> f64

Duration of a sequence (the live tracks when it is the one being edited).

Source

pub fn sequence_tracks(&self, id: u64) -> Option<&[Track]>

Tracks of a sequence for rendering (its own, or the live tracks while it is being edited).

Source

pub fn sequence_contains(&self, outer: u64, inner: u64) -> bool

True if sequence outer contains inner directly or through nested sequence clips.

Source

pub fn open_sequence(&mut self, id: u64) -> bool

Swap sequence id into tracks for editing (closing any other open sequence first).

Source

pub fn close_sequence(&mut self)

Put the edited sequence back and restore the main timeline.

Source

pub fn insert_sequence_clip( &mut self, seq: u64, at: f64, video_track: Option<usize>, ) -> Option<u64>

Place a sequence as a clip at at (video track video_track preferred). None on cycles / unknown id.

Source

pub fn nest_selection( &mut self, ids: &[u64], name: impl Into<String>, ) -> Option<u64>

Move the selected clips (+ linked) into a new sequence and replace them with one Sequence clip. Returns the new sequence id.

Source

pub fn clip_label(&self, clip: &Clip) -> u8

Effective colour label of a clip (its own, else its asset’s). 0 = none.

Source

fn plan_find_in(items: &mut [PlanItem], id: u64) -> Option<&mut PlanItem>

Source

pub fn plan_item_mut(&mut self, id: u64) -> Option<&mut PlanItem>

Source

pub fn plan_add(&mut self, parent: Option<u64>, title: impl Into<String>) -> u64

Add an item (under parent or at the top level); returns its id.

Source

pub fn plan_remove(&mut self, id: u64)

Source

pub fn plan_assets(&self) -> HashSet<u64>

All asset ids referenced by moodboards (never counted as “unused”).

Source

pub fn used_assets(&self) -> HashSet<u64>

Asset ids referenced by any clip (main timeline, stash, every sequence).

Source

pub fn remove_unused_assets(&mut self) -> usize

Remove assets no clip uses (planner moodboard assets are kept). Returns how many were removed.

Source

pub fn auto_cut( &mut self, ids: &[u64], cuts: &[f64], remove: &[(f64, f64)], ripple: bool, ) -> usize

Split the clips (+ linked) at every time in cuts, then delete the pieces lying inside any of the remove ranges (timeline times, half-open), optionally closing the gaps (ripple). Returns the number of pieces removed.

Source

pub fn place_clips( &mut self, clips: Vec<Clip>, assets: Vec<Asset>, at: f64, ) -> Vec<u64>

Place a saved group of clips (times relative to the group start) at at. Assets are re-added by path (ids remapped); clip/link ids are fresh; tracks chosen by kind in order (new ones when blocked).

Source

pub fn flow_clips(&mut self, a: u64, b: u64) -> bool

Make two abutting clips “flow”: for every visual property animated on either clip, the outgoing value/velocity of a continues into b (a gets an ease-in to the cut, b an ease-out from it, and both meet at the same value at the cut). Returns false if the clips don’t abut.

Source

pub fn label_color(&self, idx: u8) -> Option<[u8; 3]>

Colour of label index idx (1-based; 0 or unknown = None).

Source

pub fn label_name(&self, idx: u8) -> &str

Source

pub fn add_label(&mut self, name: impl Into<String>, color: [u8; 3]) -> u8

Add a label; returns its 1-based index.

Source

pub fn remove_label(&mut self, idx: u8)

Remove a label; clips/assets/markers using it fall back to “none”, higher indices shift down.

Source

pub fn add_marker(&mut self, t: f64, name: impl Into<String>) -> u64

Source

pub fn remove_marker(&mut self, id: u64)

Source

pub fn marker_mut(&mut self, id: u64) -> Option<&mut Marker>

Source

pub fn sort_markers(&mut self)

Source

pub fn add_clip_marker( &mut self, clip: u64, local_t: f64, name: impl Into<String>, ) -> Option<u64>

Add a marker on a clip (time is clip-local).

Source

pub fn markers_in_timeline(&self) -> Vec<(u64, f64, f64, String, u8)>

Every marker in timeline time: project markers plus clip markers offset by their clip.

Source

pub fn main_bus(&mut self) -> u64

The Main bus id, creating the default bus set on first use.

Source

pub fn bus(&self, id: u64) -> Option<&Bus>

Source

pub fn bus_mut(&mut self, id: u64) -> Option<&mut Bus>

Source

pub fn add_bus(&mut self, name: impl Into<String>) -> u64

Source

pub fn remove_bus(&mut self, id: u64)

Remove a bus (never Main); tracks/clips and sends fall back to Main.

Source

pub fn bus_of(&self, track: usize, clip: &Clip) -> u64

Which bus a clip feeds: its own override, else its track’s, else Main.

Source

pub fn add_shape_clip(&mut self, kind: ShapeKind, at: f64, dur: f64) -> u64

Add a shape clip on the topmost video track that has room.

Source

pub fn add_adjustment_clip(&mut self, at: f64, dur: f64) -> u64

Add an adjustment (automation) layer above everything at at.

Source

pub fn add_container_clip(&mut self, at: f64, dur: f64) -> (u64, u64)

Add a container clip pair (video slot + audio slot linked together) at at.

Source

pub fn add_container_from_asset( &mut self, asset_id: u64, at: f64, video_track: Option<usize>, ) -> Vec<u64>

Insert asset clips marked as containers (slots).

Source

pub fn replace_container_media( &mut self, clip_id: u64, new_asset_id: u64, ) -> bool

Replace the media of a container clip. Effects, transforms, keyframes, transitions and timeline duration are kept.

Source

pub fn replace_container_pair( &mut self, video_id: u64, new_asset_id: u64, ) -> bool

Replace a video container clip and any linked audio container clips with the new asset.

Source

pub fn make_container(&mut self, clip_ids: &[u64])

Convert clips to containers (slots). Linked clips are included.

Source

pub fn unmake_container(&mut self, clip_ids: &[u64])

Remove container flag from clips. Linked clips are included.

Source

pub fn path(&self, id: u64) -> Option<&PathAsset>

Source

pub fn add_path(&mut self, name: String, points: Vec<(f32, f32, f32)>) -> u64

Keep a path on the project. An empty name gets a numbered one.

Source

pub fn path_from_clip(&self, clip: u64) -> Vec<(f32, f32, f32)>

A clip’s drawing / polygon outline in canvas coordinates — the clip’s own position is folded in, so the path lands where the sketch is on screen.

Source

pub fn apply_path(&mut self, clip: u64, points: &[(f32, f32, f32)]) -> bool

Drive a clip’s X/Y along a path over the clip’s own length. False when the path is too short to animate anything.

Source

pub fn ensure_graph(&mut self, clip: u64) -> bool

Give the clip a node graph built from its current effect stack (idempotent).

Drop a clip’s node graph back onto its linear effect stack; returns how many effects landed. Err when the graph is more than a chain (the caller toasts it) — nothing is touched then. Drop a clip’s node graph entirely, keeping whatever of it can be expressed as an effect chain. A graph that will not linearise (a branch, a cycle) still goes: “unlink” means the graph is gone and the clip is back on its effect list, so leaving the nodes in place would be the one outcome the user did not ask for. Err only when there was no graph to begin with.

Source

pub fn add_node( &mut self, clip: u64, kind: NodeKind, x: f32, y: f32, ) -> Option<u64>

Add a node to a clip’s graph at editor position (x, y); returns its id.

Source

pub fn copy_attributes(&self, clip: u64) -> Option<Clip>

Snapshot of a clip to paste attributes from (Ctrl+Alt+C).

Source

pub fn paste_attributes( &mut self, src: &Clip, ids: &[u64], set: AttrSet, ) -> usize

Apply the selected attributes of src onto ids (timing and media are never touched). Returns how many clips changed.

Source

pub fn to_json(&self) -> String

Source

pub fn from_json(s: &str) -> Result<Self, String>

Source

pub fn save(&self, path: &Path) -> Result<()>

Writes beside the target then renames, so a failed write can’t destroy the previous save.

Source

pub fn load(path: &Path) -> Result<Self, String>

Trait Implementations§

Source§

impl Clone for Project

Source§

fn clone(&self) -> Project

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Project

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Project

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Project

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Project

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

§

impl<T> MaybeSend for T

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + Serialize + for<'a> Deserialize<'a> + Send + Sync,