structure: move jobs out of nodes/

This commit is contained in:
2026-09-03 17:44:46 +08:00
parent 4babbf5de8
commit cde4dddf32
34 changed files with 207 additions and 208 deletions
+6 -6
View File
@@ -18,8 +18,8 @@
//! `olive::BlurFilterNode`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, Gizmo, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -580,12 +580,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn tex() -> NodeValue {
fn tex() -> NodeValue {
NodeValue::Texture(crate::handle::CHandle::null())
}
+5 -5
View File
@@ -18,8 +18,8 @@
//! `olive::ChromaKeyNode`, derived from `olive::OCIOBaseNode`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Key color input id (C++ `k_color_input`). Type: color; default
/// `Color(0.0, 1.0, 0.0, 1.0)` (opaque green).
@@ -441,11 +441,11 @@ pub fn register(meta: &mut Vec<NodeMeta>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
#[test]
#[test]
fn input_names() {
let n = ChromaKeyNode;
assert_eq!(n.input_name(crate::nodes::ociobase::TEXTURE_INPUT), "Input");
@@ -19,8 +19,8 @@
//! `olive::ColorDifferenceKeyNode`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -307,11 +307,11 @@ pub fn register(meta: &mut Vec<NodeMeta>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
#[test]
#[test]
fn input_names() {
let n = ColorDifferenceKeyNode;
assert_eq!(n.input_name(TEXTURE_INPUT), "Input");
@@ -19,8 +19,8 @@
//! `olive::CornerPinDistortNode`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, Gizmo, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -515,12 +515,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn tex() -> NodeValue {
fn tex() -> NodeValue {
NodeValue::Texture(crate::handle::CHandle::null())
}
@@ -600,7 +600,7 @@ mod tests {
let NodeValue::Texture(handle) = table.get(ValueType::Texture).unwrap() else {
unreachable!()
};
let payload = unsafe { crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle) }
let payload = unsafe { crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle) }
.expect("cornerpin output boxes a ShaderJobPayload");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.cornerpin");
assert_eq!(payload.shader_id, "");
+7 -7
View File
@@ -19,8 +19,8 @@
//! `olive::CropDistortNode`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, Gizmo, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -412,12 +412,12 @@ fn create_crop_side_input(core: &mut NodeCore, id: &str) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn tex() -> NodeValue {
fn tex() -> NodeValue {
NodeValue::Texture(crate::handle::CHandle::null())
}
@@ -503,7 +503,7 @@ mod tests {
NodeValue::Texture(h) => *h,
_ => panic!("texture expected"),
};
let payload = unsafe { crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(&handle) }
let payload = unsafe { crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(&handle) }
.expect("shader job payload expected");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.crop");
assert_eq!(payload.shader_id, "");
+6 -6
View File
@@ -18,8 +18,8 @@
//! `olive::DespillNode`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -288,11 +288,11 @@ pub fn register(meta: &mut Vec<NodeMeta>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
#[test]
#[test]
fn input_names() {
let n = DespillNode;
assert_eq!(n.input_name(TEXTURE_INPUT), "Input");
@@ -358,7 +358,7 @@ mod tests {
panic!("expected a texture-typed value");
};
let payload =
unsafe { crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle) }
unsafe { crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle) }
.expect("payload boxed behind the handle");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.despill");
assert_eq!(payload.shader_id, "");
@@ -19,8 +19,8 @@
//! `olive::DropShadowFilter`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -369,12 +369,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn tex() -> NodeValue {
fn tex() -> NodeValue {
NodeValue::Texture(crate::handle::CHandle::null())
}
+8 -8
View File
@@ -19,8 +19,8 @@
//! `olive::FlipDistortNode`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -201,12 +201,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn tex() -> NodeValue {
fn tex() -> NodeValue {
NodeValue::Texture(crate::handle::CHandle::null())
}
@@ -271,7 +271,7 @@ mod tests {
NodeValue::Texture(h) => *h,
_ => panic!("texture expected"),
};
let payload = unsafe { crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(&handle) }
let payload = unsafe { crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(&handle) }
.expect("shader job payload expected");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.flip");
assert_eq!(payload.shader_id, "");
@@ -294,7 +294,7 @@ mod tests {
NodeValue::Texture(h) => *h,
_ => panic!("texture expected"),
};
let payload = unsafe { crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(&handle) }
let payload = unsafe { crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(&handle) }
.expect("shader job payload expected");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.flip");
assert_eq!(payload.iterations, 1);
+10 -10
View File
@@ -22,7 +22,7 @@
//! base texture. Not instantiable, so this is a helper module, not a
//! [`NodeBehavior`] implementation.
use crate::nodes::jobs::ShaderJobPayload;
use crate::jobs::ShaderJobPayload;
use crate::value::NodeValue;
/// Base texture input id (C++ `k_base_input`). Type: texture; flags:
@@ -162,13 +162,13 @@ impl GeneratorWithMerge {
#[cfg(test)]
mod tests {
use super::*;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
#[test]
#[test]
fn push_job_without_base_pushes_job_unchanged() {
let job = crate::handle::make_owned(crate::nodes::jobs::ShaderJobPayload {
let job = crate::handle::make_owned(crate::jobs::ShaderJobPayload {
type_id: "org.olivevideoeditor.Olive.solidgenerator".to_string(),
time: Rational::new(2, 1),
shader_id: "1".to_string(),
@@ -185,7 +185,7 @@ mod tests {
_ => panic!("texture expected"),
};
let payload = unsafe {
crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(&handle)
crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(&handle)
}
.expect("job payload boxed");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.solidgenerator");
@@ -210,7 +210,7 @@ mod tests {
#[test]
fn push_job_with_base_boxes_merge_payload() {
let gen_job = crate::handle::make_owned(crate::nodes::jobs::ShaderJobPayload {
let gen_job = crate::handle::make_owned(crate::jobs::ShaderJobPayload {
type_id: "org.olivevideoeditor.Olive.solidgenerator".to_string(),
time: Rational::new(2, 1),
shader_id: "1".to_string(),
@@ -226,7 +226,7 @@ mod tests {
_ => panic!("texture expected"),
};
let merge = unsafe {
crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(&handle)
crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(&handle)
}
.expect("merge job payload boxed");
assert_eq!(merge.shader_id, "mrg");
@@ -240,7 +240,7 @@ mod tests {
_ => panic!("texture expected"),
};
let blend_job = unsafe {
crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(&blend)
crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(&blend)
}
.expect("blend job payload boxed");
assert_eq!(blend_job.type_id, "org.olivevideoeditor.Olive.solidgenerator");
-108
View File
@@ -1,108 +0,0 @@
// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! Render-job payloads (C++ `app/render/job/footagejob.h`,
//! `app/render/job/shaderjob.h`): boxed inside `Texture` values during
//! graph evaluation, then resolved to real textures by the render hooks
//! ([`crate::traverser::RenderHooks::resolve`]).
//! `// CPP-PARITY: app/render/job/footagejob.h, shaderjob.h`.
use oak_core::color::ColorProcessor;
use oak_core::Rational;
use crate::id::NodeId;
use crate::nodes::plugin::PluginJobPayload;
use crate::value::NodeValueRow;
/// Job types
pub enum Job{
FootageJob(FootageJobPayload),
ShaderJob(ShaderJobPayload),
PluginJob(PluginJobPayload),
ColorTransformJob
}
/// C++ `FootageJob` payload: the decode request a footage node emits at
/// its output instead of a texture. The render hooks decode it at the
/// request time and replace it with the resulting frame.
#[derive(Clone, Debug)]
pub struct FootageJobPayload {
/// Footage file path.
pub filename: String,
/// Container stream index.
pub stream_index: i32,
/// Request time in media seconds.
pub time: Rational,
}
/// C++ `ShaderJob` payload: the GPU shader pass a node emits at its
/// output. The fragment shader is looked up by `type_id`/`shader_id` in
/// the node behavior; the param row carries the uniforms (including the
/// effect input texture, keyed by `effect_input`).
#[derive(Clone, Debug)]
pub struct ShaderJobPayload {
/// Emitting node identity (for diagnostics).
pub node_id: NodeId,
/// Request time in media seconds.
pub time: Rational,
/// Pass iterations (C++ `ShaderJob::iterations`).
pub iterations: i32,
/// Node behavior type id — the pipeline cache key and the lookup key
/// for the emitting node (C++ `job.node`).
pub type_id: String,
/// Shader variant id passed to the behavior's `shader_code()` (C++
/// `ShaderJob::shader_id`); empty for the default variant.
pub shader_id: String,
/// Effect input id: the param row key carrying the main input texture
/// (C++ `node->GetEffectInput()`).
pub effect_input: String,
/// The param row at evaluation time (C++ `ShaderJob::params`): uniform
/// values keyed by input id, the effect input texture among them.
pub params: NodeValueRow,
/// The texture the iterative passes feed back into (C++ `ShaderJob::
/// iterative_input`; empty = the effect input).
pub iterative_input: String,
}
pub struct ColorTransformJobPayload{
pub color_processor: ColorProcessor,
}
impl Default for FootageJobPayload {
fn default() -> Self {
FootageJobPayload {
filename: String::new(),
stream_index: 0,
time: Rational::new(0, 1),
}
}
}
impl Default for ShaderJobPayload {
fn default() -> Self {
ShaderJobPayload {
node_id: NodeId::INVALID,
time: Rational::new(0, 1),
iterations: 1,
type_id: String::new(),
shader_id: String::new(),
effect_input: String::new(),
params: NodeValueRow::new(),
iterative_input: String::new(),
}
}
}
+6 -6
View File
@@ -424,7 +424,7 @@ impl NodeBehavior for MaskDistortNode {
params.insert(id.to_string(), core.value_at_time(id, -1, time));
}
}
let job = crate::handle::make_owned(crate::nodes::jobs::ShaderJobPayload {
let job = crate::handle::make_owned(crate::jobs::ShaderJobPayload {
node_id: crate::id::NodeId::INVALID,
time,
iterations: 1,
@@ -562,11 +562,11 @@ pub fn register(meta: &mut Vec<NodeMeta>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
#[test]
#[test]
fn input_names() {
let n = MaskDistortNode {
polygon: crate::nodes::polygon::PolygonGenerator,
@@ -643,7 +643,7 @@ mod tests {
panic!("pushed value is not a texture handle");
};
let job = unsafe {
crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle)
crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle)
}
.expect("real shader job");
assert_eq!(job.shader_id, "mask");
+7 -7
View File
@@ -281,12 +281,12 @@ pub fn register(meta: &mut Vec<NodeMeta>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn row(values: &[(&str, NodeValue)]) -> crate::value::NodeValueRow {
fn row(values: &[(&str, NodeValue)]) -> crate::value::NodeValueRow {
values
.iter()
.map(|(k, v)| (k.to_string(), v.clone()))
@@ -417,7 +417,7 @@ mod tests {
_ => panic!("texture expected"),
};
let payload = unsafe {
crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(&handle)
crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(&handle)
}
.expect("shader job payload boxed in the pushed texture");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.math");
@@ -453,7 +453,7 @@ mod tests {
_ => panic!("texture expected"),
};
let payload = unsafe {
crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(&handle)
crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(&handle)
};
assert!(payload.is_none(), "no shader job for a null texture");
}
+8 -8
View File
@@ -21,8 +21,8 @@
//! the pairing heuristic, and the static eval/shader helpers shared
//! by `MathNode` (and conceptually other binary math nodes).
use crate::jobs::ShaderJobPayload;
use crate::node::NodeCore;
use crate::nodes::jobs::ShaderJobPayload;
use crate::value::{NodeValue, NodeValueRow, NodeValueTable, ValueType};
/// Binary operation (C++ `MathNodeBase::Operation`).
@@ -980,11 +980,11 @@ impl ValueType {
#[cfg(test)]
mod tests {
use super::*;
use crate::value::{NodeValueTable, SampleBuffer};
use oak_core::{Rational, SampleFormat};
use super::*;
use crate::value::{NodeValueTable, SampleBuffer};
use oak_core::{Rational, SampleFormat};
fn table(values: Vec<NodeValue>) -> NodeValueTable {
fn table(values: Vec<NodeValue>) -> NodeValueTable {
let mut t = NodeValueTable::default();
for v in values {
let ty = v.value_type();
@@ -1487,7 +1487,7 @@ mod tests {
_ => panic!("texture expected"),
};
let payload = unsafe {
crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(&handle)
crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(&handle)
}
.expect("shader job payload boxed in the pushed texture");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.math");
@@ -1632,8 +1632,8 @@ mod tests {
#[test]
fn value_rational_arithmetic_all_ops() {
use oak_core::Rational;
for (op, a, b, expect) in [
use oak_core::Rational;
for (op, a, b, expect) in [
(
Operation::Add,
Rational::new(1, 2),
+6 -6
View File
@@ -18,8 +18,8 @@
//! `olive::MergeNode`): alpha-over composites two textures.
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Base (background) texture input id (C++ `k_base_in`). Type:
/// texture; flags: not-keyframable.
@@ -217,12 +217,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn tex() -> NodeValue {
fn tex() -> NodeValue {
NodeValue::Texture(crate::handle::CHandle::null())
}
-2
View File
@@ -30,7 +30,6 @@ mod dropshadowfilter;
mod flipdistortnode;
mod generatorwithmerge;
pub mod group;
pub mod jobs;
mod mask;
mod math;
mod mathbase;
@@ -70,7 +69,6 @@ mod volume;
mod wavedistortnode;
mod whitebalance;
use crate::factory::NodeMeta;
use crate::node::{NodeBehavior, NodeCore};
/// A no-op behavior for vacant arena slots (graph internal; never
@@ -19,8 +19,8 @@
//! `olive::MosaicFilterNode`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -216,12 +216,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn tex() -> NodeValue {
fn tex() -> NodeValue {
NodeValue::Texture(crate::handle::CHandle::null())
}
@@ -279,7 +279,7 @@ mod tests {
panic!("expected a texture-typed value");
};
let payload =
unsafe { crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle) }
unsafe { crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle) }
.expect("payload boxed behind the handle");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.mosaicfilter");
assert_eq!(payload.shader_id, "");
+8 -8
View File
@@ -18,8 +18,8 @@
//! `olive::NoiseGeneratorNode`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Base texture input id (C++ `k_base_in`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -221,12 +221,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
#[test]
#[test]
fn input_names() {
let n = NoiseGeneratorNode;
assert_eq!(n.input_name(BASE_INPUT), "Base");
@@ -264,7 +264,7 @@ mod tests {
unreachable!()
};
let job =
unsafe { crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle) }
unsafe { crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle) }
.expect("noise output boxes a ShaderJobPayload");
assert_eq!(job.type_id, "org.olivevideoeditor.Olive.noise");
assert_eq!(job.shader_id, "");
@@ -288,7 +288,7 @@ mod tests {
unreachable!()
};
let job =
unsafe { crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle) }
unsafe { crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle) }
.expect("noise output boxes a ShaderJobPayload");
assert_eq!(job.type_id, "org.olivevideoeditor.Olive.noise");
assert!(job.params.contains_key(BASE_INPUT));
@@ -439,7 +439,7 @@ impl NodeBehavior for OCIOGradingTransformLinearNode {
crate::value::NodeValue::Boolean(false),
);
let job = crate::handle::make_owned(crate::nodes::jobs::ShaderJobPayload {
let job = crate::handle::make_owned(crate::jobs::ShaderJobPayload {
node_id: crate::id::NodeId::INVALID,
time,
iterations: 1,
@@ -656,12 +656,12 @@ pub fn register(meta: &mut Vec<NodeMeta>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::keyframe::{Interpolation, Keyframe};
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::keyframe::{Interpolation, Keyframe};
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn node() -> OCIOGradingTransformLinearNode {
fn node() -> OCIOGradingTransformLinearNode {
OCIOGradingTransformLinearNode {
base: OcioBase::new(),
}
@@ -916,7 +916,7 @@ mod tests {
panic!("pushed value is not a texture handle");
};
let job = unsafe {
crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle)
crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle)
}
.expect("real shader job");
assert_eq!(job.shader_id, "rgb");
@@ -986,7 +986,7 @@ mod tests {
panic!("pushed value is not a texture handle");
};
let job = unsafe {
crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle)
crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle)
}
.expect("real shader job");
// White <= black is raised to black + 0.000001.
@@ -470,7 +470,7 @@ impl NodeBehavior for OCIOGradingTransformLogNode {
crate::value::NodeValue::Boolean(false),
);
let job = crate::handle::make_owned(crate::nodes::jobs::ShaderJobPayload {
let job = crate::handle::make_owned(crate::jobs::ShaderJobPayload {
node_id: crate::id::NodeId::INVALID,
time,
iterations: 1,
@@ -680,12 +680,12 @@ pub fn register(meta: &mut Vec<NodeMeta>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::keyframe::{Interpolation, Keyframe};
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::keyframe::{Interpolation, Keyframe};
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn node() -> OCIOGradingTransformLogNode {
fn node() -> OCIOGradingTransformLogNode {
OCIOGradingTransformLogNode {
base: OcioBase::new(),
}
@@ -903,7 +903,7 @@ mod tests {
panic!("pushed value is not a texture handle");
};
let job = unsafe {
crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle)
crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle)
}
.expect("real shader job");
assert_eq!(job.shader_id, "rgb");
+6 -6
View File
@@ -18,8 +18,8 @@
//! `olive::OpacityEffect`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -257,12 +257,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
#[test]
#[test]
fn input_names() {
let n = OpacityEffect {
math: super::super::math::MathNode::new(),
+7 -7
View File
@@ -232,7 +232,7 @@ impl NodeBehavior for PolygonGenerator {
core.value_at_time(COLOR_INPUT, -1, time),
);
}
let job = crate::handle::make_owned(crate::nodes::jobs::ShaderJobPayload {
let job = crate::handle::make_owned(crate::jobs::ShaderJobPayload {
node_id: crate::id::NodeId::INVALID,
time,
iterations: 1,
@@ -382,12 +382,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
#[test]
#[test]
fn input_names() {
let n = PolygonGenerator;
assert_eq!(
@@ -440,7 +440,7 @@ mod tests {
panic!("pushed value is not a texture handle");
};
let job = unsafe {
crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle)
crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle)
}
.expect("real shader job");
assert_eq!(job.shader_id, "rgb");
@@ -19,8 +19,8 @@
//! `olive::RippleDistortNode`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, Gizmo, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -297,12 +297,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn tex() -> NodeValue {
fn tex() -> NodeValue {
NodeValue::Texture(crate::handle::CHandle::null())
}
@@ -377,7 +377,7 @@ mod tests {
let NodeValue::Texture(handle) = table.get(ValueType::Texture).unwrap() else {
unreachable!()
};
let payload = unsafe { crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle) }
let payload = unsafe { crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle) }
.expect("ripple output boxes a ShaderJobPayload");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.ripple");
assert_eq!(payload.shader_id, "");
+6 -6
View File
@@ -20,8 +20,8 @@
//! [`super::generatorwithmerge`]).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Shape type input id (C++ `k_type_input`). Type: combo; prepended
/// ahead of the base inputs; combo strings (matching the C++ `Type`
@@ -371,12 +371,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
#[test]
#[test]
fn input_names() {
let n = ShapeNode;
assert_eq!(n.input_name(TYPE_INPUT), "Type");
+7 -7
View File
@@ -18,8 +18,8 @@
//! `olive::SolidGenerator`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Color input id (C++ `k_color_input`). Type: color; default
/// `(1.0, 0.0, 0.0, 1.0)` (red — "a color that isn't black").
@@ -141,12 +141,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
#[test]
#[test]
fn input_names() {
let n = SolidGenerator;
assert_eq!(n.input_name(COLOR_INPUT), "Color");
@@ -179,7 +179,7 @@ mod tests {
unreachable!()
};
let job = unsafe {
crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle)
crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle)
}
.expect("solid output boxes a ShaderJobPayload");
assert_eq!(
+6 -6
View File
@@ -18,8 +18,8 @@
//! `olive::StrokeFilterNode`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -297,12 +297,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn tex() -> NodeValue {
fn tex() -> NodeValue {
NodeValue::Texture(crate::handle::CHandle::null())
}
@@ -19,8 +19,8 @@
//! `olive::SwirlDistortNode`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, Gizmo, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -271,12 +271,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn tex() -> NodeValue {
fn tex() -> NodeValue {
NodeValue::Texture(crate::handle::CHandle::null())
}
@@ -362,7 +362,7 @@ mod tests {
let NodeValue::Texture(handle) = table.get(ValueType::Texture).unwrap() else {
unreachable!()
};
let payload = unsafe { crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle) }
let payload = unsafe { crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle) }
.expect("swirl output boxes a ShaderJobPayload");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.swirl");
assert_eq!(payload.shader_id, "");
+6 -6
View File
@@ -19,8 +19,8 @@
//! `olive::ThreeWayColorNode`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -289,11 +289,11 @@ pub fn register(meta: &mut Vec<NodeMeta>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
#[test]
#[test]
fn input_names() {
let n = ThreeWayColorNode;
assert_eq!(n.input_name(TEXTURE_INPUT), "Input");
@@ -375,7 +375,7 @@ mod tests {
panic!("expected a texture-typed value");
};
let payload =
unsafe { crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle) }
unsafe { crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle) }
.expect("payload boxed behind the handle");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.threewaycolor");
assert_eq!(payload.shader_id, "");
+7 -7
View File
@@ -19,8 +19,8 @@
//! `olive::TileDistortNode`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, Gizmo, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -379,12 +379,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn tex() -> NodeValue {
fn tex() -> NodeValue {
NodeValue::Texture(crate::handle::CHandle::null())
}
@@ -456,7 +456,7 @@ mod tests {
let NodeValue::Texture(handle) = table.get(ValueType::Texture).unwrap() else {
unreachable!()
};
let payload = unsafe { crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle) }
let payload = unsafe { crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle) }
.expect("tile output boxes a ShaderJobPayload");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.tile");
assert_eq!(payload.shader_id, "");
@@ -22,8 +22,8 @@
//! and the `generate_matrix` helper.
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, Gizmo, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Parent matrix input id (C++ `k_parent_input`). Type: matrix; no
/// default (identity when unconnected).
@@ -615,12 +615,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn tex() -> NodeValue {
fn tex() -> NodeValue {
NodeValue::Texture(crate::handle::CHandle::null())
}
@@ -726,7 +726,7 @@ mod tests {
NodeValue::Texture(h) => *h,
_ => panic!("texture expected"),
};
let payload = unsafe { crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(&handle) }
let payload = unsafe { crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(&handle) }
.expect("shader job payload expected");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.transform");
assert_eq!(payload.shader_id, "");
+7 -7
View File
@@ -19,8 +19,8 @@
//! `olive::WaveDistortNode`).
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -240,12 +240,12 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::node::NodeBehavior;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
fn tex() -> NodeValue {
fn tex() -> NodeValue {
NodeValue::Texture(crate::handle::CHandle::null())
}
@@ -315,7 +315,7 @@ mod tests {
let NodeValue::Texture(handle) = table.get(ValueType::Texture).unwrap() else {
unreachable!()
};
let payload = unsafe { crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle) }
let payload = unsafe { crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle) }
.expect("wave output boxes a ShaderJobPayload");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.wave");
assert_eq!(payload.shader_id, "");
+6 -6
View File
@@ -25,8 +25,8 @@
//! the green-magenta axis.
use crate::factory::NodeMeta;
use crate::jobs::ShaderJobPayload;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::nodes::jobs::ShaderJobPayload;
/// Texture input id (C++ `k_texture_input`). Type: texture; flags:
/// not-keyframable; this is the node's effect input.
@@ -276,11 +276,11 @@ pub fn register(meta: &mut Vec<NodeMeta>) {
#[cfg(test)]
mod tests {
use super::*;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
use super::*;
use crate::value::{NodeValue, NodeValueTable, ValueType};
use oak_core::Rational;
#[test]
#[test]
fn input_names() {
let n = WhiteBalanceNode;
assert_eq!(n.input_name(TEXTURE_INPUT), "Input");
@@ -397,7 +397,7 @@ mod tests {
panic!("expected a texture-typed value");
};
let payload =
unsafe { crate::handle::get_checked::<crate::nodes::jobs::ShaderJobPayload>(handle) }
unsafe { crate::handle::get_checked::<crate::jobs::ShaderJobPayload>(handle) }
.expect("payload boxed behind the handle");
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.whitebalance");
assert_eq!(payload.shader_id, "");