pub trait Node: Send + Sync {
Show 28 methods
// Required methods
fn uuid(&self) -> Uuid;
fn name(&self) -> &str;
fn node_type(&self) -> &'static str;
fn attrs(&self) -> &Attrs;
fn attrs_mut(&mut self) -> &mut Attrs;
fn inputs(&self) -> Vec<Uuid>;
fn compute(&self, frame: i32, ctx: &ComputeContext<'_>) -> Option<Frame>;
fn is_dirty(&self, ctx: Option<&ComputeContext<'_>>) -> bool;
fn mark_dirty(&self);
fn clear_dirty(&self);
// Provided methods
fn preload(&self, _center: i32, _radius: i32, _ctx: &ComputeContext<'_>) { ... }
fn get_attr(&self, key: &str) -> Option<&AttrValue> { ... }
fn set_attr(&mut self, key: &str, value: AttrValue) { ... }
fn get_i32(&self, key: &str) -> Option<i32> { ... }
fn get_float(&self, key: &str) -> Option<f32> { ... }
fn get_str(&self, key: &str) -> Option<&str> { ... }
fn get_uuid_attr(&self, key: &str) -> Option<Uuid> { ... }
fn play_range(&self, _use_work_area: bool) -> (i32, i32) { ... }
fn bounds(
&self,
use_trim: bool,
_selection_only: bool,
_media: &HashMap<Uuid, Arc<NodeKind>>,
) -> (i32, i32) { ... }
fn _in(&self) -> i32 { ... }
fn _out(&self) -> i32 { ... }
fn fps(&self) -> f32 { ... }
fn frame(&self) -> i32 { ... }
fn work_area(&self) -> (i32, i32) { ... }
fn frame_count(&self) -> i32 { ... }
fn play_frame_count(&self) -> i32 { ... }
fn dim(&self) -> (usize, usize) { ... }
fn placeholder_frame(&self) -> Frame { ... }
}Expand description
Base trait for all node types. Provides common interface for identification, attributes, and computation.
Required Methods§
Sourcefn inputs(&self) -> Vec<Uuid>
fn inputs(&self) -> Vec<Uuid>
Source nodes that this node depends on (via layers). Empty for leaf nodes like FileNode.
Sourcefn compute(&self, frame: i32, ctx: &ComputeContext<'_>) -> Option<Frame>
fn compute(&self, frame: i32, ctx: &ComputeContext<'_>) -> Option<Frame>
Compute output frame at given frame index. Result should be cached in global_cache[uuid][frame]. Returns None if computation fails or no frame available.
Sourcefn is_dirty(&self, ctx: Option<&ComputeContext<'_>>) -> bool
fn is_dirty(&self, ctx: Option<&ComputeContext<'_>>) -> bool
Check if node needs recomputation (attrs changed).
§Arguments
ctx: If Some, also checks source nodes recursively. If None, checks only self.
Sourcefn mark_dirty(&self)
fn mark_dirty(&self)
Mark node as needing recomputation
Sourcefn clear_dirty(&self)
fn clear_dirty(&self)
Clear dirty flag after successful computation
Provided Methods§
Sourcefn preload(&self, _center: i32, _radius: i32, _ctx: &ComputeContext<'_>)
fn preload(&self, _center: i32, _radius: i32, _ctx: &ComputeContext<'_>)
Preload frames around center position for background loading.
Default implementation is no-op (for nodes without preload support).
FileNode/CompNode override this to enqueue frame loading via workers.
radius - max number of frames to preload around center
Sourcefn get_uuid_attr(&self, key: &str) -> Option<Uuid>
fn get_uuid_attr(&self, key: &str) -> Option<Uuid>
Get uuid attribute
Sourcefn play_range(&self, _use_work_area: bool) -> (i32, i32)
fn play_range(&self, _use_work_area: bool) -> (i32, i32)
Play range: (start_frame, end_frame) for playback. Default uses attrs.layer_start()/layer_end() which respects in/trim/speed.
Sourcefn bounds(
&self,
use_trim: bool,
_selection_only: bool,
_media: &HashMap<Uuid, Arc<NodeKind>>,
) -> (i32, i32)
fn bounds( &self, use_trim: bool, _selection_only: bool, _media: &HashMap<Uuid, Arc<NodeKind>>, ) -> (i32, i32)
Content bounds for zoom-to-fit. Default delegates to play_range. CompNode overrides to calculate from layers with dynamic src_len from media.
Sourcefn work_area(&self) -> (i32, i32)
fn work_area(&self) -> (i32, i32)
Work area (trimmed range) in absolute frames. Returns (in + trim_in, out - trim_out)
Sourcefn frame_count(&self) -> i32
fn frame_count(&self) -> i32
Total source frames: out - in + 1 (inclusive range)
Sourcefn play_frame_count(&self) -> i32
fn play_frame_count(&self) -> i32
Play frame count (respects trims): work_area duration
Sourcefn placeholder_frame(&self) -> Frame
fn placeholder_frame(&self) -> Frame
Placeholder frame with node dimensions