Node

Trait Node 

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

Source

fn uuid(&self) -> Uuid

Unique identifier for this node

Source

fn name(&self) -> &str

Display name of the node

Source

fn node_type(&self) -> &'static str

Type identifier string (“File”, “Comp”, etc.)

Source

fn attrs(&self) -> &Attrs

Access to node’s persistent attributes

Source

fn attrs_mut(&mut self) -> &mut Attrs

Mutable access to node’s attributes

Source

fn inputs(&self) -> Vec<Uuid>

Source nodes that this node depends on (via layers). Empty for leaf nodes like FileNode.

Source

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.

Source

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

fn mark_dirty(&self)

Mark node as needing recomputation

Source

fn clear_dirty(&self)

Clear dirty flag after successful computation

Provided Methods§

Source

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

Source

fn get_attr(&self, key: &str) -> Option<&AttrValue>

Get attribute value by key

Source

fn set_attr(&mut self, key: &str, value: AttrValue)

Set attribute value

Source

fn get_i32(&self, key: &str) -> Option<i32>

Get i32 attribute

Source

fn get_float(&self, key: &str) -> Option<f32>

Get f32 attribute

Source

fn get_str(&self, key: &str) -> Option<&str>

Get string attribute

Source

fn get_uuid_attr(&self, key: &str) -> Option<Uuid>

Get uuid attribute

Source

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.

Source

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.

Source

fn _in(&self) -> i32

Start frame (in point). Default: 0

Source

fn _out(&self) -> i32

End frame (out point). Default: src_len or DEFAULT_SRC_LEN

Source

fn fps(&self) -> f32

Frames per second. Default: DEFAULT_FPS (24.0)

Source

fn frame(&self) -> i32

Current playhead frame. Default: _in()

Source

fn work_area(&self) -> (i32, i32)

Work area (trimmed range) in absolute frames. Returns (in + trim_in, out - trim_out)

Source

fn frame_count(&self) -> i32

Total source frames: out - in + 1 (inclusive range)

Source

fn play_frame_count(&self) -> i32

Play frame count (respects trims): work_area duration

Source

fn dim(&self) -> (usize, usize)

Dimensions (width, height). Default: DEFAULT_DIM (1920x1080)

Source

fn placeholder_frame(&self) -> Frame

Placeholder frame with node dimensions

Implementors§