Struct NodeGraph

Source
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

Source

pub fn new(next_id: &mut impl FnMut() -> u64) -> Self

Input -> Output, ready to have effects dropped in between.

Source

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).

Source

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.

Source

pub fn node(&self, id: u64) -> Option<&Node>

Source

pub fn node_mut(&mut self, id: u64) -> Option<&mut Node>

Source

pub fn output(&self) -> Option<u64>

Source

pub fn input_of(&self, to: u64, port: usize) -> Option<u64>

The node feeding to’s input port.

Source

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.

Source

pub fn disconnect(&mut self, to: u64, port: usize)

Source

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.

Source

pub fn has_cycle(&self) -> bool

Depth-first cycle check (the editor refuses connections that would loop).

Source

pub fn eval_order(&self) -> Vec<u64>

Nodes reachable from the output, inputs before consumers.

Source

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.

Source

pub fn animated_mut(&mut self) -> Vec<&mut Animated>

Every animated property in the graph (effect params, blend opacity, numbers, mask properties).

Source

pub fn animated(&self) -> Vec<&Animated>

Trait Implementations§

Source§

impl Clone for NodeGraph

Source§

fn clone(&self) -> NodeGraph

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 NodeGraph

Source§

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

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

impl Default for NodeGraph

Source§

fn default() -> NodeGraph

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

impl<'de> Deserialize<'de> for NodeGraph

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 PartialEq for NodeGraph

Source§

fn eq(&self, other: &NodeGraph) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for NodeGraph

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
Source§

impl StructuralPartialEq for NodeGraph

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,