timeline: adjustment layers and first-class transitions
Adjustment layers (docs/zh/plans/adjustment-layers-and-transitions.md): a new timeline block type whose effect chain grades the composite of every video track below it, over its own range (spanning clips or a slice of one). The graph path flushes the lower tracks at the block's track boundary and sweeps the composite through the chain via a transient texture-source node; the montage path mirrors it with AdjustmentSpan tickets (wire-compatible), so worker previews and exports agree. An empty-area context menu creates one; the block trims/moves/deletes like a clip, with undo everywhere. Transitions: seam blocks come alive - cross dissolve/fade/wipe/slide evaluate both neighbors through the graph path with progress from the transition's own range (never the whole clip). Ctrl+Shift+D or the clip menu inserts a default transition; the gpui wedges render and drag to resize offsets undoably, and TransitionRemoveCommand now restores offsets and edges on undo. The transitionfx node form runs the same shaders on an adjustment layer with progress_in auto-filled from the layer's span (explicit value wins). Also: every built-in effect name and parameter name is now translatable (360 node.* keys per locale, zh-CN fully translated, two coverage tests guard future gaps); the new nodes register in nodes/mod.rs with the factory smoke table updated; textfootage and adjustment-layer i18n keys included.
This commit is contained in:
@@ -31,7 +31,10 @@ use std::sync::{Arc, Mutex, MutexGuard};
|
||||
|
||||
use oak_core::videoparams::VideoParams as CommonVideoParams;
|
||||
use oak_core::Rational;
|
||||
use oak_node::block::{BlockCore, ClipBlockBehavior, GapBlockBehavior, TransitionBlockBehavior};
|
||||
use oak_node::block::{
|
||||
AdjustmentBlockBehavior, BlockCore, ClipBlockBehavior, GapBlockBehavior,
|
||||
TransitionBlockBehavior,
|
||||
};
|
||||
use oak_node::folder::FolderBehavior;
|
||||
use oak_node::footage::{FootageBehavior, StreamInfo};
|
||||
use oak_node::graph::Graph;
|
||||
@@ -108,6 +111,9 @@ pub fn block_core_of(graph: &Graph, block: NodeId) -> Option<BlockCore> {
|
||||
if let Some(b) = any.downcast_ref::<TransitionBlockBehavior>() {
|
||||
return Some(b.core.clone());
|
||||
}
|
||||
if let Some(b) = any.downcast_ref::<AdjustmentBlockBehavior>() {
|
||||
return Some(b.core.clone());
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
@@ -132,6 +138,10 @@ fn set_block_core(graph: &mut Graph, block: NodeId, f: impl FnOnce(&mut BlockCor
|
||||
f(&mut b.core);
|
||||
return true;
|
||||
}
|
||||
if let Some(b) = any.downcast_mut::<AdjustmentBlockBehavior>() {
|
||||
f(&mut b.core);
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
@@ -728,6 +738,18 @@ pub fn block_kind(project: &ProjectRef, block: NodeId) -> BlockKind {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the block is an adjustment layer (neither `BlockKind` covers
|
||||
/// it: the enum mirrors the deleted C ABI's block types).
|
||||
pub fn block_is_adjustment(project: &ProjectRef, block: NodeId) -> bool {
|
||||
let guard = lock_project(project);
|
||||
guard
|
||||
.graph
|
||||
.get(block)
|
||||
.and_then(|e| e.behavior.as_any())
|
||||
.map(|a| a.downcast_ref::<AdjustmentBlockBehavior>().is_some())
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
/// The block's timeline in point (`oaknode_block_get_in`).
|
||||
pub fn block_in(project: &ProjectRef, block: NodeId) -> Rational {
|
||||
let guard = lock_project(project);
|
||||
|
||||
Reference in New Issue
Block a user