clippy: clear the workspace errors and apply the machine fixes
- Mark the raw-pointer interop entry points unsafe with # Safety docs (oak-core upload/download/frame-from-pixels, oak-audio convert) and satisfy the existing callers (tests). - mut_from_ref: allow with the ABI contract documented (the handle get_mut helpers in oak-timeline/oak-render/oak-task take the shared reference the C ABI passes; exclusivity is the caller's unsafe contract). - Fix the eq_op in the white-balance normalization (green / green). - Apply cargo clippy --fix across the workspace (redundant closures and field names, field reassignment, items after test modules, ...). - Revert the replace_box fix in image_effect's clip_define: a redefinition must allocate a new box, otherwise the old clip handle stays valid and the HS-map replace contract (clip != clip2) breaks. - 283 warnings remain; they are all non-machine-applicable (chunks_exact -> as_chunks needs a manual iter_mut, too_many_arguments, complex types, missing Safety docs, ...) and are tracked as the follow-up.
This commit is contained in:
@@ -537,7 +537,7 @@ impl NodeBehavior for FootageBehavior {
|
||||
if let Some(v) = reader.attribute("ppreset") {
|
||||
if !v.is_empty() {
|
||||
let mut a = [0u8; 32];
|
||||
let n = v.as_bytes().len().min(31);
|
||||
let n = v.len().min(31);
|
||||
a[..n].copy_from_slice(&v.as_bytes()[..n]);
|
||||
custom.preset = a;
|
||||
}
|
||||
@@ -545,7 +545,7 @@ impl NodeBehavior for FootageBehavior {
|
||||
if let Some(v) = reader.attribute("pext") {
|
||||
if !v.is_empty() {
|
||||
let mut a = [0u8; 32];
|
||||
let n = v.as_bytes().len().min(31);
|
||||
let n = v.len().min(31);
|
||||
a[..n].copy_from_slice(&v.as_bytes()[..n]);
|
||||
custom.extension = a;
|
||||
}
|
||||
|
||||
@@ -130,12 +130,7 @@ impl KeyframeTrack {
|
||||
}
|
||||
}
|
||||
|
||||
let (b, a) = match before {
|
||||
Some(pair) => pair,
|
||||
// Unreachable given the front/back guards; C++ logs and falls
|
||||
// through to the standard value.
|
||||
None => return None,
|
||||
};
|
||||
let (b, a) = before?;
|
||||
let before_key = &keys[b];
|
||||
let after_key = &keys[a];
|
||||
|
||||
|
||||
@@ -364,12 +364,11 @@ impl NodeBehavior for BlurFilterNode {
|
||||
let mut can_push_job = true;
|
||||
if radius > 0.0 {
|
||||
// Method-specific considerations.
|
||||
if method == Method::Box as i64 || method == Method::Gaussian as i64 {
|
||||
if !horiz && !vert {
|
||||
if (method == Method::Box as i64 || method == Method::Gaussian as i64)
|
||||
&& !horiz && !vert {
|
||||
// Disable the job if both directions are unchecked.
|
||||
can_push_job = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
can_push_job = false;
|
||||
}
|
||||
@@ -378,11 +377,10 @@ impl NodeBehavior for BlurFilterNode {
|
||||
// all other methods are single-pass (C++ `iterations = 2` only for
|
||||
// the double-pass case).
|
||||
let mut iterations = 1;
|
||||
if method == Method::Box as i64 || method == Method::Gaussian as i64 {
|
||||
if horiz && vert {
|
||||
if (method == Method::Box as i64 || method == Method::Gaussian as i64)
|
||||
&& horiz && vert {
|
||||
iterations = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if can_push_job {
|
||||
// The shader-job box (C++ ShaderJob): the behavior's type id
|
||||
@@ -578,6 +576,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(BlurFilterNode))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_blur_filter` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.blur",
|
||||
name: "Blur",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -736,14 +745,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Blur");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_blur_filter` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.blur",
|
||||
name: "Blur",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -234,6 +234,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(CheckerBoardNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.checkerboard",
|
||||
name: "Checkerboard",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -398,13 +408,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Checkerboard");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.checkerboard",
|
||||
name: "Checkerboard",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -257,6 +257,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(ColorBarsNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.colorbars",
|
||||
name: "Color Bars",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -383,13 +393,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Color Bars");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.colorbars",
|
||||
name: "Color Bars",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -198,6 +198,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(ColorMatrixNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.colormatrix",
|
||||
name: "Color Matrix",
|
||||
categories: &[Category::Color],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -329,13 +339,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Color Matrix");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.colormatrix",
|
||||
name: "Color Matrix",
|
||||
categories: &[Category::Color],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -518,6 +518,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
)
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.cornerpin`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.cornerpin",
|
||||
name: "Corner Pin",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -675,14 +686,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Corner Pin");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.cornerpin`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.cornerpin",
|
||||
name: "Corner Pin",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -410,6 +410,17 @@ fn create_crop_side_input(core: &mut NodeCore, id: &str) {
|
||||
core.add_input(input);
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.crop`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.crop",
|
||||
name: "Crop",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -528,14 +539,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Crop");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.crop`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.crop",
|
||||
name: "Crop",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -196,6 +196,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(DilateNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.dilate",
|
||||
name: "Dilate",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -318,13 +328,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Dilate");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.dilate",
|
||||
name: "Dilate",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -244,6 +244,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(DirBlurNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.dirblur",
|
||||
name: "Directional Blur",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -394,13 +404,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Directional Blur");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.dirblur",
|
||||
name: "Directional Blur",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -243,6 +243,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(DissolveNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.dissolve",
|
||||
name: "Dissolve",
|
||||
categories: &[Category::Math],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -402,13 +412,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Dissolve");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.dissolve",
|
||||
name: "Dissolve",
|
||||
categories: &[Category::Math],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -367,6 +367,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(DropShadowFilter))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_drop_shadow_filter` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.dropshadow",
|
||||
name: "Drop Shadow",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -485,14 +496,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Drop Shadow");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_drop_shadow_filter` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.dropshadow",
|
||||
name: "Drop Shadow",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -190,6 +190,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(EdgeDetectNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.edgedetect",
|
||||
name: "Edge Detect",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -307,13 +317,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Edge Detect");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.edgedetect",
|
||||
name: "Edge Detect",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -196,6 +196,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(ErodeNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.erode",
|
||||
name: "Erode",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -318,13 +328,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Erode");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.erode",
|
||||
name: "Erode",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -199,6 +199,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(FlipDistortNode))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.flip`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.flip",
|
||||
name: "Flip",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -315,14 +326,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Flip");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.flip`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.flip",
|
||||
name: "Flip",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -219,6 +219,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(KeyMixNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.keymix",
|
||||
name: "KeyMix",
|
||||
categories: &[Category::Math],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -357,13 +367,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "KeyMix");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.keymix",
|
||||
name: "KeyMix",
|
||||
categories: &[Category::Math],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -406,6 +406,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(MatrixGenerator))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.ortho`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.ortho",
|
||||
name: "Orthographic Matrix",
|
||||
categories: &[Category::Generator, Category::Math],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -587,14 +598,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Orthographic Matrix");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.ortho`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.ortho",
|
||||
name: "Orthographic Matrix",
|
||||
categories: &[Category::Generator, Category::Math],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -208,6 +208,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(MergeNode))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_merge_node` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.merge",
|
||||
name: "Merge",
|
||||
categories: &[Category::Math],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -306,14 +317,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Merge");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_merge_node` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.merge",
|
||||
name: "Merge",
|
||||
categories: &[Category::Math],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -189,6 +189,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(MirrorNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.mirror",
|
||||
name: "Mirror",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -327,13 +337,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Mirror");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.mirror",
|
||||
name: "Mirror",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -214,6 +214,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(MosaicFilterNode))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_mosaic_filter` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.mosaicfilter",
|
||||
name: "Mosaic",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -312,14 +323,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Mosaic");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_mosaic_filter` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.mosaicfilter",
|
||||
name: "Mosaic",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -219,6 +219,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(NoiseGeneratorNode))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.noise`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.noise",
|
||||
name: "Noise",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -310,14 +321,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Noise");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.noise`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.noise",
|
||||
name: "Noise",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -244,6 +244,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
)
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_opacity_effect` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.opacity",
|
||||
name: "Opacity",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -396,14 +407,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Opacity");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_opacity_effect` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.opacity",
|
||||
name: "Opacity",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -196,6 +196,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(PanNode))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_audio_panning` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.pan",
|
||||
name: "Pan",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -338,14 +349,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Pan");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_audio_panning` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.pan",
|
||||
name: "Pan",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -546,7 +546,7 @@ mod tests {
|
||||
sample_count: 3,
|
||||
// Planar layout: channel 0 plane [1, 2, 3], channel 1 plane
|
||||
// [4, 5, 6].
|
||||
data: vec![1.0f32, 2.0, 3.0, 4.0, 5.0, 6.0]
|
||||
data: [1.0f32, 2.0, 3.0, 4.0, 5.0, 6.0]
|
||||
.iter()
|
||||
.flat_map(|f| f.to_le_bytes())
|
||||
.collect(),
|
||||
@@ -580,7 +580,7 @@ mod tests {
|
||||
format: oak_core::SampleFormat::F32,
|
||||
channels: 1,
|
||||
sample_count: 2,
|
||||
data: vec![1.0f32, 2.0]
|
||||
data: [1.0f32, 2.0]
|
||||
.iter()
|
||||
.flat_map(|f| f.to_le_bytes())
|
||||
.collect(),
|
||||
|
||||
@@ -112,7 +112,7 @@ pub fn point_array(core: &NodeCore, inputs: &crate::value::NodeValueRow, time: o
|
||||
.inputs
|
||||
.iter()
|
||||
.find(|i| i.id == POINTS_INPUT)
|
||||
.map(|i| (i.array_size as usize).min(64))
|
||||
.map(|i| i.array_size.min(64))
|
||||
.unwrap_or(5);
|
||||
let mut points: Vec<[f64; 4]> = Vec::new();
|
||||
for i in 0..size {
|
||||
@@ -380,6 +380,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(PolygonGenerator))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.polygon`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.polygon",
|
||||
name: "Polygon",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -507,14 +518,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Polygon");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.polygon`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.polygon",
|
||||
name: "Polygon",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -193,6 +193,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(PositionNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.position",
|
||||
name: "Position",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -307,13 +317,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Position");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.position",
|
||||
name: "Position",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -233,6 +233,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(PremultiplyNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.premult",
|
||||
name: "Premultiply",
|
||||
categories: &[Category::Math],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -372,13 +382,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Premultiply");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.premult",
|
||||
name: "Premultiply",
|
||||
categories: &[Category::Math],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -233,6 +233,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(RampNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.ramp",
|
||||
name: "Ramp",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -394,13 +404,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Ramp");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.ramp",
|
||||
name: "Ramp",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -299,6 +299,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(RippleDistortNode { gizmo }))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.ripple`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.ripple",
|
||||
name: "Ripple",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -404,14 +415,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Ripple");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.ripple`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.ripple",
|
||||
name: "Ripple",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -359,6 +359,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(ShapeNode))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.shape`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.shape",
|
||||
name: "Shape",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -516,14 +527,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Shape");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.shape`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.shape",
|
||||
name: "Shape",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -209,6 +209,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(SharpenNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.sharpen",
|
||||
name: "Sharpen",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -327,13 +337,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Sharpen");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.sharpen",
|
||||
name: "Sharpen",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -139,6 +139,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(SolidGenerator))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.solidgenerator`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.solidgenerator",
|
||||
name: "Solid",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -209,14 +220,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Solid");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.solidgenerator`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.solidgenerator",
|
||||
name: "Solid",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -295,6 +295,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(StrokeFilterNode))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_stroke_filter` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.stroke",
|
||||
name: "Stroke",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -413,14 +424,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Stroke");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_stroke_filter` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.stroke",
|
||||
name: "Stroke",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -274,6 +274,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(SwirlDistortNode { gizmo }))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.swirl`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.swirl",
|
||||
name: "Swirl",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -390,14 +401,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Swirl");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.swirl`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.swirl",
|
||||
name: "Swirl",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ impl TextGeneratorV1 {
|
||||
let text = row
|
||||
.get(TEXT_INPUT)
|
||||
.map(to_text)
|
||||
.unwrap_or_else(|| String::new());
|
||||
.unwrap_or_default();
|
||||
let html = matches!(row.get(HTML_INPUT), Some(NodeValue::Boolean(true)));
|
||||
let mut mode = TextLayoutMode::PlainText;
|
||||
let text = if html {
|
||||
@@ -100,7 +100,7 @@ impl TextGeneratorV1 {
|
||||
TextLayoutRequest {
|
||||
text,
|
||||
mode,
|
||||
font_family: row.get(FONT_INPUT).map(to_text).unwrap_or_else(String::new),
|
||||
font_family: row.get(FONT_INPUT).map(to_text).unwrap_or_default(),
|
||||
font_size_pt: row
|
||||
.get(FONT_SIZE_INPUT)
|
||||
.map(NodeValue::to_double)
|
||||
|
||||
@@ -92,7 +92,7 @@ impl TextGeneratorV2 {
|
||||
let text = row
|
||||
.get(TEXT_INPUT)
|
||||
.map(to_text)
|
||||
.unwrap_or_else(|| String::new());
|
||||
.unwrap_or_default();
|
||||
let html = matches!(row.get(HTML_INPUT), Some(NodeValue::Boolean(true)));
|
||||
let mut mode = TextLayoutMode::PlainText;
|
||||
let text = if html {
|
||||
@@ -111,7 +111,7 @@ impl TextGeneratorV2 {
|
||||
TextLayoutRequest {
|
||||
text,
|
||||
mode,
|
||||
font_family: row.get(FONT_INPUT).map(to_text).unwrap_or_else(String::new),
|
||||
font_family: row.get(FONT_INPUT).map(to_text).unwrap_or_default(),
|
||||
font_size_pt: row
|
||||
.get(FONT_SIZE_INPUT)
|
||||
.map(NodeValue::to_double)
|
||||
|
||||
@@ -760,12 +760,12 @@ impl TextGeneratorV3 {
|
||||
text: row
|
||||
.get(PLAIN_TEXT_INPUT)
|
||||
.map(to_text)
|
||||
.unwrap_or_else(String::new),
|
||||
.unwrap_or_default(),
|
||||
mode: TextLayoutMode::PlainText,
|
||||
font_family: row
|
||||
.get(FONT_FAMILY_INPUT)
|
||||
.map(to_text)
|
||||
.unwrap_or_else(String::new),
|
||||
.unwrap_or_default(),
|
||||
font_size_pt: row
|
||||
.get(FONT_SIZE_INPUT)
|
||||
.map(|v| v.to_double())
|
||||
@@ -776,7 +776,7 @@ impl TextGeneratorV3 {
|
||||
}
|
||||
} else {
|
||||
TextLayoutRequest {
|
||||
text: row.get(TEXT_INPUT).map(to_text).unwrap_or_else(String::new),
|
||||
text: row.get(TEXT_INPUT).map(to_text).unwrap_or_default(),
|
||||
mode: TextLayoutMode::OliveHtml,
|
||||
font_family: String::new(),
|
||||
font_size_pt: 0.0,
|
||||
@@ -2257,7 +2257,7 @@ mod tests {
|
||||
else {
|
||||
panic!("expected a CPU coverage frame");
|
||||
};
|
||||
let stride = frame.linesize_bytes() as usize;
|
||||
let stride = frame.linesize_bytes();
|
||||
let at = y * stride + x * 16;
|
||||
let mut out = [0f32; 4];
|
||||
for (c, v) in out.iter_mut().enumerate() {
|
||||
|
||||
@@ -381,6 +381,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(TileDistortNode { gizmo }))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.tile`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.tile",
|
||||
name: "Tile",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -483,14 +494,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Tile");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.tile`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.tile",
|
||||
name: "Tile",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -246,19 +246,19 @@ impl TransformDistortNode {
|
||||
|
||||
let scale_by_x = sequence_res.0 / texture_res.0;
|
||||
let scale_by_y = sequence_res.1 / texture_res.1;
|
||||
let autoscale_val;
|
||||
|
||||
|
||||
if (autoscale_type == AutoScaleType::Fit) == (sequence_real_ar > footage_real_ar) {
|
||||
let autoscale_val = if (autoscale_type == AutoScaleType::Fit) == (sequence_real_ar > footage_real_ar) {
|
||||
// Scale by height. Either the sequence is wider than
|
||||
// the footage or we're using fill and cutting off the
|
||||
// sides.
|
||||
autoscale_val = scale_by_y;
|
||||
scale_by_y
|
||||
} else {
|
||||
// Scale by width. Either the footage is wider than the
|
||||
// sequence or we're using fill and cutting off the top
|
||||
// and bottom.
|
||||
autoscale_val = scale_by_x;
|
||||
}
|
||||
scale_by_x
|
||||
};
|
||||
|
||||
adjusted_matrix =
|
||||
super::matrix::matrix_scale(adjusted_matrix, autoscale_val, autoscale_val, 1.0);
|
||||
@@ -671,6 +671,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
)
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.transform`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.transform",
|
||||
name: "Transform",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -960,14 +971,3 @@ mod tests {
|
||||
assert_eq!(dup.short_name(), "Transform");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.transform`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.transform",
|
||||
name: "Transform",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -478,6 +478,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(TransitionFxNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.transitionfx",
|
||||
name: "Transition FX",
|
||||
categories: &[Category::Effect],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -754,13 +764,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Transition FX");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.transitionfx",
|
||||
name: "Transition FX",
|
||||
categories: &[Category::Effect],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -403,6 +403,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(TransitionNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.transition",
|
||||
name: "Transition",
|
||||
categories: &[Category::Timeline],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -596,13 +606,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Transition");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.transition",
|
||||
name: "Transition",
|
||||
categories: &[Category::Timeline],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -213,6 +213,17 @@ pub const OPERATION_NAMES: [&str; 9] = [
|
||||
"Hyperbolic Tangent",
|
||||
];
|
||||
|
||||
/// Register this node type (C++ `k_trigonometry_node` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.trigonometry",
|
||||
name: "Trigonometry",
|
||||
categories: &[Category::Math],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -363,14 +374,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Trigonometry");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_trigonometry_node` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.trigonometry",
|
||||
name: "Trigonometry",
|
||||
categories: &[Category::Math],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -242,6 +242,16 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(UnpremultiplyNode))
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.unpremult",
|
||||
name: "Unpremultiply",
|
||||
categories: &[Category::Math],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -370,13 +380,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Unpremultiply");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type.
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.unpremult",
|
||||
name: "Unpremultiply",
|
||||
categories: &[Category::Math],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -171,6 +171,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(ValueNode))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_value_node` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.value",
|
||||
name: "Value",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -262,14 +273,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Value");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_value_node` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.value",
|
||||
name: "Value",
|
||||
categories: &[Category::Generator],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -177,6 +177,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(VolumeNode))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_audio_volume` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.volume",
|
||||
name: "Volume",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -331,14 +342,3 @@ mod tests {
|
||||
assert_eq!(dup.type_id(), "org.olivevideoeditor.Olive.volume");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ `k_audio_volume` in
|
||||
/// `factory.cpp::create_from_factory_index`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.volume",
|
||||
name: "Volume",
|
||||
categories: &[Category::Filter],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -241,6 +241,17 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
|
||||
(core, Box::new(WaveDistortNode))
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.wave`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.wave",
|
||||
name: "Wave",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -341,14 +352,3 @@ mod tests {
|
||||
assert_eq!(dup.name(), "Wave");
|
||||
}
|
||||
}
|
||||
|
||||
/// Register this node type (C++ factory entry for
|
||||
/// `org.olivevideoeditor.Olive.wave`).
|
||||
pub fn register(meta: &mut Vec<NodeMeta>) {
|
||||
meta.push(NodeMeta {
|
||||
type_id: "org.olivevideoeditor.Olive.wave",
|
||||
name: "Wave",
|
||||
categories: &[Category::Distort],
|
||||
create,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ impl WhiteBalanceNode {
|
||||
// exposure, then let tint move along the green-magenta axis.
|
||||
let tint_gain = (1.0 + tint).clamp(0.0, 2.0);
|
||||
|
||||
[red / green, green / green * tint_gain, blue / green]
|
||||
[red / green, tint_gain, blue / green]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,16 +189,18 @@ impl NodeBehavior for WhiteBalanceNode {
|
||||
params.insert(GAIN_INPUT.to_string(), crate::value::NodeValue::Vec3(gain));
|
||||
table.push(
|
||||
crate::value::ValueType::Texture,
|
||||
crate::value::NodeValue::Texture(crate::handle::make_owned(Job::ShaderJob(ShaderJobPayload {
|
||||
node_id: crate::id::NodeId::INVALID,
|
||||
time,
|
||||
iterations: 1,
|
||||
type_id: self.type_id().to_string(),
|
||||
shader_id: String::new(),
|
||||
effect_input: core.effect_input.clone(),
|
||||
params,
|
||||
iterative_input: String::new(),
|
||||
}))),
|
||||
crate::value::NodeValue::Texture(crate::handle::make_owned(Job::ShaderJob(
|
||||
ShaderJobPayload {
|
||||
node_id: crate::id::NodeId::INVALID,
|
||||
time,
|
||||
iterations: 1,
|
||||
type_id: self.type_id().to_string(),
|
||||
shader_id: String::new(),
|
||||
effect_input: core.effect_input.clone(),
|
||||
params,
|
||||
iterative_input: String::new(),
|
||||
},
|
||||
))),
|
||||
None,
|
||||
);
|
||||
}
|
||||
@@ -270,11 +272,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");
|
||||
@@ -391,8 +393,7 @@ mod tests {
|
||||
panic!("expected a texture-typed value");
|
||||
};
|
||||
let payload =
|
||||
unsafe { crate::jobs::shader_job(handle) }
|
||||
.expect("payload boxed behind the handle");
|
||||
unsafe { crate::jobs::shader_job(handle) }.expect("payload boxed behind the handle");
|
||||
assert_eq!(payload.type_id, "org.olivevideoeditor.Olive.whitebalance");
|
||||
assert_eq!(payload.shader_id, "");
|
||||
assert_eq!(payload.iterations, 1);
|
||||
|
||||
@@ -252,9 +252,7 @@ pub fn set_value_at_time_command(
|
||||
.and_then(|e| e.core.keyframe_track(&input, element))
|
||||
.and_then(|t| {
|
||||
t.keys()
|
||||
.iter()
|
||||
.filter(|k| k.time <= time)
|
||||
.next_back()
|
||||
.iter().rfind(|k| k.time <= time)
|
||||
.map(|k| k.interpolation)
|
||||
})
|
||||
.unwrap_or(Interpolation::Linear);
|
||||
|
||||
@@ -347,8 +347,8 @@ impl Project {
|
||||
return self.custom_cache_path.clone();
|
||||
}
|
||||
}
|
||||
1 => {
|
||||
if !self.filename.is_empty() {
|
||||
1
|
||||
if !self.filename.is_empty() => {
|
||||
let dir = std::path::Path::new(&self.filename)
|
||||
.parent()
|
||||
.map(|p| p.to_string_lossy().into_owned())
|
||||
@@ -357,7 +357,6 @@ impl Project {
|
||||
return format!("{}/cache", dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
// Default location: the shared disk-cache directory (single-lib:
|
||||
|
||||
@@ -690,7 +690,7 @@ impl Clone for NodeValue {
|
||||
fn clone(&self) -> Self {
|
||||
match self {
|
||||
NodeValue::Texture(h) => {
|
||||
let h2 = h.clone();
|
||||
let h2 = *h;
|
||||
if let Some(f) = h2.addref {
|
||||
// Safety: `h2` is a valid handle; addref only touches
|
||||
// the refcount.
|
||||
|
||||
@@ -163,10 +163,7 @@ fn golden_project_with_footage_loads() {
|
||||
|
||||
// The root folder (from the settings "root" key) holds the bin.
|
||||
let root = p.graph.get(p.root).expect("root folder resolves");
|
||||
assert_eq!(
|
||||
root.behavior.type_id(),
|
||||
"org.olivevideoeditor.Olive.folder"
|
||||
);
|
||||
assert_eq!(root.behavior.type_id(), "org.olivevideoeditor.Olive.folder");
|
||||
let folder = root
|
||||
.behavior
|
||||
.as_any()
|
||||
@@ -507,10 +504,10 @@ fn build_full_project() -> std::sync::Arc<std::sync::Mutex<oak_node::project::Pr
|
||||
}
|
||||
|
||||
/// Borrowed track list of a node.
|
||||
fn list_of<'a>(
|
||||
p: &'a oak_node::project::Project,
|
||||
fn list_of(
|
||||
p: &oak_node::project::Project,
|
||||
id: oak_node::id::NodeId,
|
||||
) -> &'a oak_node::track::TrackListBehavior {
|
||||
) -> &oak_node::track::TrackListBehavior {
|
||||
p.graph
|
||||
.get(id)
|
||||
.unwrap()
|
||||
@@ -521,7 +518,10 @@ fn list_of<'a>(
|
||||
}
|
||||
|
||||
/// Field-by-field comparison of the round-tripped full project.
|
||||
fn assert_full_roundtrip_fields(orig: &oak_node::project::Project, loaded: &oak_node::project::Project) {
|
||||
fn assert_full_roundtrip_fields(
|
||||
orig: &oak_node::project::Project,
|
||||
loaded: &oak_node::project::Project,
|
||||
) {
|
||||
use oak_node::block::ClipBlockBehavior;
|
||||
use oak_node::folder::FolderBehavior;
|
||||
use oak_node::footage::FootageBehavior;
|
||||
@@ -533,7 +533,11 @@ fn assert_full_roundtrip_fields(orig: &oak_node::project::Project, loaded: &oak_
|
||||
assert_eq!(loaded.settings, orig.settings, "settings");
|
||||
|
||||
// The graph keeps its node count, types and edge count.
|
||||
assert_eq!(loaded.graph.node_count(), orig.graph.node_count(), "node count");
|
||||
assert_eq!(
|
||||
loaded.graph.node_count(),
|
||||
orig.graph.node_count(),
|
||||
"node count"
|
||||
);
|
||||
let o_types: Vec<&str> = orig
|
||||
.graph
|
||||
.node_ids()
|
||||
@@ -607,7 +611,10 @@ fn assert_full_roundtrip_fields(orig: &oak_node::project::Project, loaded: &oak_
|
||||
l_f.proxy_video_stream_index, o_f.proxy_video_stream_index,
|
||||
"proxy stream"
|
||||
);
|
||||
assert_eq!(l_f.proxy_preset_version, o_f.proxy_preset_version, "proxy preset");
|
||||
assert_eq!(
|
||||
l_f.proxy_preset_version, o_f.proxy_preset_version,
|
||||
"proxy preset"
|
||||
);
|
||||
assert_eq!(l_f.streams.len(), o_f.streams.len(), "stream count");
|
||||
for (ls, os) in l_f.streams.iter().zip(&o_f.streams) {
|
||||
assert_eq!(ls.index, os.index, "stream index");
|
||||
@@ -644,7 +651,11 @@ fn assert_full_roundtrip_fields(orig: &oak_node::project::Project, loaded: &oak_
|
||||
orig.graph.get(o_seq).unwrap().core.override_color,
|
||||
"sequence color"
|
||||
);
|
||||
assert_eq!(l_s.track_lists.len(), o_s.track_lists.len(), "track list count");
|
||||
assert_eq!(
|
||||
l_s.track_lists.len(),
|
||||
o_s.track_lists.len(),
|
||||
"track list count"
|
||||
);
|
||||
let (o_vlist, l_vlist) = (o_s.track_lists[0], l_s.track_lists[0]);
|
||||
let (o_alist, l_alist) = (o_s.track_lists[1], l_s.track_lists[1]);
|
||||
|
||||
@@ -653,14 +664,22 @@ fn assert_full_roundtrip_fields(orig: &oak_node::project::Project, loaded: &oak_
|
||||
assert_eq!(l_vl.kind, o_vl.kind, "video list kind");
|
||||
assert_eq!(l_vl.array_base, o_vl.array_base, "video list base");
|
||||
assert_eq!(l_vl.sequence, Some(l_seq), "video list sequence backref");
|
||||
assert_eq!(l_vl.tracks.len(), o_vl.tracks.len(), "video list track count");
|
||||
assert_eq!(
|
||||
l_vl.tracks.len(),
|
||||
o_vl.tracks.len(),
|
||||
"video list track count"
|
||||
);
|
||||
let (o_vtrack, l_vtrack) = (o_vl.tracks[0], l_vl.tracks[0]);
|
||||
let o_al = list_of(orig, o_alist);
|
||||
let l_al = list_of(loaded, l_alist);
|
||||
assert_eq!(l_al.kind, o_al.kind, "audio list kind");
|
||||
assert_eq!(l_al.array_base, o_al.array_base, "audio list base");
|
||||
assert_eq!(l_al.sequence, Some(l_seq), "audio list sequence backref");
|
||||
assert_eq!(l_al.tracks.len(), o_al.tracks.len(), "audio list track count");
|
||||
assert_eq!(
|
||||
l_al.tracks.len(),
|
||||
o_al.tracks.len(),
|
||||
"audio list track count"
|
||||
);
|
||||
let (o_atrack, l_atrack) = (o_al.tracks[0], l_al.tracks[0]);
|
||||
|
||||
// Video track: kind/blocks/muted/locked/height/index/backref.
|
||||
@@ -686,7 +705,11 @@ fn assert_full_roundtrip_fields(orig: &oak_node::project::Project, loaded: &oak_
|
||||
assert_eq!(l_t.height, o_t.height, "video track height");
|
||||
assert_eq!(l_t.index, o_t.index, "video track index");
|
||||
assert_eq!(l_t.track_list, Some(l_vlist), "video track list backref");
|
||||
assert_eq!(l_t.blocks.len(), o_t.blocks.len(), "video track block count");
|
||||
assert_eq!(
|
||||
l_t.blocks.len(),
|
||||
o_t.blocks.len(),
|
||||
"video track block count"
|
||||
);
|
||||
let o_clip1 = o_t.blocks[0];
|
||||
let o_gap1 = o_t.blocks[1];
|
||||
let o_clip2 = o_t.blocks[2];
|
||||
@@ -816,7 +839,11 @@ fn assert_full_roundtrip_fields(orig: &oak_node::project::Project, loaded: &oak_
|
||||
assert_eq!(l_at.kind, TrackType::Audio, "audio track kind");
|
||||
assert_eq!(l_at.locked, o_at.locked, "audio track locked");
|
||||
assert_eq!(l_at.track_list, Some(l_alist), "audio track list backref");
|
||||
assert_eq!(l_at.blocks.len(), o_at.blocks.len(), "audio track block count");
|
||||
assert_eq!(
|
||||
l_at.blocks.len(),
|
||||
o_at.blocks.len(),
|
||||
"audio track block count"
|
||||
);
|
||||
let o_c3 = orig
|
||||
.graph
|
||||
.get(o_at.blocks[0])
|
||||
@@ -956,7 +983,11 @@ fn multicam_node_round_trip_preserves_current_in() {
|
||||
// serializes combo indices as Int — `string_to_value` maps
|
||||
// `ValueType::Combo` to `NodeValue::Int`).
|
||||
assert_eq!(
|
||||
l.graph.get(loaded_mc).unwrap().core.standard_value(CURRENT_INPUT, -1),
|
||||
l.graph
|
||||
.get(loaded_mc)
|
||||
.unwrap()
|
||||
.core
|
||||
.standard_value(CURRENT_INPUT, -1),
|
||||
NodeValue::Int(2),
|
||||
"current_in survives the round-trip"
|
||||
);
|
||||
@@ -1004,8 +1035,11 @@ fn dynamic_plugin_node_round_trips_across_load() {
|
||||
// from its OFX params).
|
||||
let probe_core = || {
|
||||
let mut core = NodeCore::new();
|
||||
core.inputs
|
||||
.push(Input::new(INPUT_ID, ValueType::Float, NodeValue::Float(0.0)));
|
||||
core.inputs.push(Input::new(
|
||||
INPUT_ID,
|
||||
ValueType::Float,
|
||||
NodeValue::Float(0.0),
|
||||
));
|
||||
core
|
||||
};
|
||||
{
|
||||
@@ -1049,7 +1083,11 @@ fn dynamic_plugin_node_round_trips_across_load() {
|
||||
.find(|id| l.graph.get(*id).map(|e| e.behavior.type_id()) == Some(TYPE_ID))
|
||||
.expect("loaded project has the dynamic node");
|
||||
assert_eq!(
|
||||
l.graph.get(probe).unwrap().core.standard_value(INPUT_ID, -1),
|
||||
l.graph
|
||||
.get(probe)
|
||||
.unwrap()
|
||||
.core
|
||||
.standard_value(INPUT_ID, -1),
|
||||
NodeValue::Float(2.5),
|
||||
"the standard value survives the rebuild"
|
||||
);
|
||||
@@ -1077,7 +1115,10 @@ fn multicam_clip_round_trip_preserves_wiring() {
|
||||
let seq_id = p.graph.add_node(core, behavior);
|
||||
let (core, behavior) = TrackListBehavior::create();
|
||||
let list_id = p.graph.add_node(core, behavior);
|
||||
let (core, behavior) = (NodeCore::new(), Box::new(TrackBehavior::new(TrackType::Video)));
|
||||
let (core, behavior) = (
|
||||
NodeCore::new(),
|
||||
Box::new(TrackBehavior::new(TrackType::Video)),
|
||||
);
|
||||
let track_id = p.graph.add_node(core, behavior);
|
||||
{
|
||||
let seq = p.graph.get_mut(seq_id).unwrap();
|
||||
@@ -1132,18 +1173,13 @@ fn multicam_clip_round_trip_preserves_wiring() {
|
||||
// The multicam node routed between the sequence and the clip.
|
||||
let (core, behavior) = create();
|
||||
let mc_id = p.graph.add_node(core, behavior);
|
||||
p.graph
|
||||
.connect(mc_id, clip_id, "tex_in", -1)
|
||||
.unwrap();
|
||||
p.graph.connect(mc_id, clip_id, "tex_in", -1).unwrap();
|
||||
p.graph.connect(seq_id, mc_id, SEQUENCE_INPUT, -1).unwrap();
|
||||
let mc = p.graph.get_mut(mc_id).unwrap();
|
||||
mc.core
|
||||
.set_standard_value(CURRENT_INPUT, -1, NodeValue::Combo(2));
|
||||
mc.core.set_standard_value(
|
||||
SEQUENCE_TYPE_INPUT,
|
||||
-1,
|
||||
NodeValue::Combo(0),
|
||||
);
|
||||
mc.core
|
||||
.set_standard_value(SEQUENCE_TYPE_INPUT, -1, NodeValue::Combo(0));
|
||||
(seq_id, clip_id, mc_id)
|
||||
};
|
||||
let _ = (seq_id, clip_id, mc_id);
|
||||
@@ -1165,12 +1201,20 @@ fn multicam_clip_round_trip_preserves_wiring() {
|
||||
})
|
||||
.expect("loaded project has a MultiCamNode");
|
||||
assert_eq!(
|
||||
l.graph.get(loaded_mc).unwrap().core.standard_value(CURRENT_INPUT, -1),
|
||||
l.graph
|
||||
.get(loaded_mc)
|
||||
.unwrap()
|
||||
.core
|
||||
.standard_value(CURRENT_INPUT, -1),
|
||||
NodeValue::Int(2),
|
||||
"current_in survives"
|
||||
);
|
||||
assert_eq!(
|
||||
l.graph.get(loaded_mc).unwrap().core.standard_value(SEQUENCE_TYPE_INPUT, -1),
|
||||
l.graph
|
||||
.get(loaded_mc)
|
||||
.unwrap()
|
||||
.core
|
||||
.standard_value(SEQUENCE_TYPE_INPUT, -1),
|
||||
NodeValue::Int(0),
|
||||
"sequence_type_in survives"
|
||||
);
|
||||
@@ -1332,5 +1376,8 @@ fn legacy_project_without_endpoints_migrates_on_load() {
|
||||
let r = reloaded.lock().unwrap();
|
||||
assert_eq!(r.graph.endpoints(), Some((li, lo)));
|
||||
assert_eq!(r.graph.node_count(), legacy_count + 2);
|
||||
assert_eq!(r.graph.connected_output(lo, GRAPH_OUTPUT_INPUT, -1), Some(li));
|
||||
assert_eq!(
|
||||
r.graph.connected_output(lo, GRAPH_OUTPUT_INPUT, -1),
|
||||
Some(li)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ fn texture_value_drop_releases() {
|
||||
assert_eq!(refs(&h), 2);
|
||||
|
||||
{
|
||||
let v = NodeValue::Texture(h.clone());
|
||||
let v = NodeValue::Texture(h);
|
||||
assert_eq!(refs(&h), 2, "no extra reference taken on clone");
|
||||
drop(v); // must release the payload's reference
|
||||
assert_eq!(refs(&h), 1);
|
||||
@@ -97,7 +97,7 @@ fn texture_value_clone_addrefs() {
|
||||
assert_eq!(refs(&h), 1);
|
||||
|
||||
{
|
||||
let a = NodeValue::Texture(h.clone());
|
||||
let a = NodeValue::Texture(h);
|
||||
assert_eq!(refs(&h), 1, "construction takes the caller's reference");
|
||||
{
|
||||
let b = a.clone();
|
||||
|
||||
Reference in New Issue
Block a user