pub struct NodeGraph {
pub nodes: Vec<Node>,
pub edges: Vec<Edge>,
}Expand description
A clip’s effect chain as a DAG. When present it replaces Clip.effects (kept as the simple linear
stack for clips that never opened the node editor). Always contains exactly one Output.
Fields§
§nodes: Vec<Node>§edges: Vec<Edge>Implementations§
Source§impl NodeGraph
impl NodeGraph
Sourcepub fn new(next_id: &mut impl FnMut() -> u64) -> Self
pub fn new(next_id: &mut impl FnMut() -> u64) -> Self
Input -> Output, ready to have effects dropped in between.
Sourcepub fn from_effects(
effects: &[Effect],
next_id: &mut impl FnMut() -> u64,
) -> Self
pub fn from_effects( effects: &[Effect], next_id: &mut impl FnMut() -> u64, ) -> Self
A graph equivalent to a linear effect stack (used when a clip’s stack is converted).
Sourcepub fn to_effects(&self) -> Result<Vec<Effect>, String>
pub fn to_effects(&self) -> Result<Vec<Effect>, String>
The inverse of from_effects: the port-0 chain from Output back to Input as a linear stack.
Err (with a reason for the toast) when the graph is not that shape — anything the output does
not read is not part of the picture and is dropped without complaint.
pub fn node(&self, id: u64) -> Option<&Node>
pub fn node_mut(&mut self, id: u64) -> Option<&mut Node>
pub fn output(&self) -> Option<u64>
Sourcepub fn connect(&mut self, from: u64, to: u64, port: usize) -> bool
pub fn connect(&mut self, from: u64, to: u64, port: usize) -> bool
Connect (replacing whatever fed that port). Refused when it would create a cycle.
pub fn disconnect(&mut self, to: u64, port: usize)
Sourcepub fn remove_node(&mut self, id: u64)
pub fn remove_node(&mut self, id: u64)
Remove a node (the Output can never be removed) and re-link its first input to its consumers.
Sourcepub fn has_cycle(&self) -> bool
pub fn has_cycle(&self) -> bool
Depth-first cycle check (the editor refuses connections that would loop).
Sourcepub fn eval_order(&self) -> Vec<u64>
pub fn eval_order(&self) -> Vec<u64>
Nodes reachable from the output, inputs before consumers.
Sourcepub fn eval_values(&self, lt: f64, fps: f64) -> HashMap<u64, f64>
pub fn eval_values(&self, lt: f64, fps: f64) -> HashMap<u64, f64>
The scalar half of the graph at clip-local time lt: one number per node, in evaluation
order, so a Math/Compare/Select chain resolves in a single pass. Picture-only nodes
evaluate to 0. GL-free on purpose — the renderer calls it once per frame and it is what the
tests exercise.
Sourcepub fn animated_mut(&mut self) -> Vec<&mut Animated>
pub fn animated_mut(&mut self) -> Vec<&mut Animated>
Every animated property in the graph (effect params, blend opacity, numbers, mask properties).
pub fn animated(&self) -> Vec<&Animated>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for NodeGraph
impl<'de> Deserialize<'de> for NodeGraph
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for NodeGraph
Auto Trait Implementations§
impl Freeze for NodeGraph
impl RefUnwindSafe for NodeGraph
impl Send for NodeGraph
impl Sync for NodeGraph
impl Unpin for NodeGraph
impl UnwindSafe for NodeGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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