workspace: zero compiler warnings across all targets

254 warnings (320 counting replayed-cache re-emitters) cleaned:
unused mut/imports/variables, irrefutable if-lets and unreachable
patterns, dead code removed or annotated #[allow(dead_code)] with
the reason (C++ parity value sets, cfg(test) helpers, public API
reservations), drop(&ref) no-ops removed, fn-pointer identity via
std::ptr::fn_addr_eq, the test-stubs feature declared in
oak-node's manifest, missing docs filled. Every unused-Result site
was judged individually: meaningful errors propagate, intentional
ignores are let _ = with a note.

Two pre-existing latent bugs are documented in place, behavior
preserved: app.rs's timeline-tool observer and dialogs.rs's format
subscription both drop the returned Subscription immediately, so
they never fire.
This commit is contained in:
2026-09-11 16:38:44 +08:00
parent faebc79c31
commit 4f0f5cbba6
98 changed files with 409 additions and 455 deletions
-2
View File
@@ -664,7 +664,6 @@ impl Graph {
if index < 0 || index > size as i32 {
return Err(Error::Invalid);
}
drop(input_);
let entry = self.get_mut(id).ok_or(Error::NotFound)?;
entry.core.input_array_insert(input, index as usize);
@@ -703,7 +702,6 @@ impl Graph {
if index < 0 || index >= size as i32 {
return Err(Error::Invalid);
}
drop(input_);
let entry = self.get_mut(id).ok_or(Error::NotFound)?;
entry.core.input_array_remove(input, index as usize);
+1 -1
View File
@@ -24,7 +24,7 @@ use oak_core::{Rational, TimeRange};
use crate::id::NodeId;
use crate::input::{Input, ValueHint};
use crate::keyframe::KeyframeTrack;
use crate::value::{NodeValue, NodeValueRow, NodeValueTable};
use crate::value::{NodeValueRow, NodeValueTable};
/// Node category (mirrors C++ `Node::CategoryID` order).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-8
View File
@@ -198,14 +198,6 @@ void main() {
}
"#;
impl ChromaKeyNode {
/// Fragment shader with the `%1` OCIO stub marker still in place
/// (C++ `get_shader_code()` before the stub substitution).
fn shader_frag() -> &'static str {
SHADER_FRAG
}
}
impl NodeBehavior for ChromaKeyNode {
/// Human-readable name (C++ `name()`).
fn name(&self) -> &str {
@@ -128,14 +128,6 @@ void main(void) {
}
"#;
impl ColorDifferenceKeyNode {
/// Fragment shader (C++ `get_shader_code()`; the request is
/// ignored — there is a single shader).
fn shader_frag() -> &'static str {
SHADER_FRAG
}
}
impl NodeBehavior for ColorDifferenceKeyNode {
/// Human-readable name (C++ `name()`).
fn name(&self) -> &str {
@@ -124,6 +124,9 @@ void main() {
/// Vertex shader (C++ loads the `:/shaders/cornerpin.vert` resource in
/// `get_shader_code`). Text copied verbatim from
/// `engine/shaders/cornerpin.vert`.
// C++ parity: shader resource text kept alongside the frag shader; only
// the tests read it (via `shader_vert`).
#[allow(dead_code)]
const SHADER_VERT: &str = r#"uniform bool perspective_in;
uniform vec2 top_left_in;
uniform vec2 top_right_in;
@@ -234,6 +237,7 @@ impl CornerPinDistortNode {
/// Vertex shader (C++ `get_shader_code()` vert half; the request id
/// is ignored).
#[allow(dead_code)] // C++ parity accessor; exercised by the tests only.
fn shader_vert() -> &'static str {
SHADER_VERT
}
@@ -403,6 +407,7 @@ impl CornerPinDistortNode {
/// origin, so corner 0 (top-left) maps straight, corner 1 (top-right)
/// adds `(resolution.x, 0)`, corner 2 (bottom-right) adds the full
/// resolution, and corner 3 (bottom-left) adds `(0, resolution.y)`.
#[allow(dead_code)] // C++ parity helper; exercised by the tests only.
fn value_to_pixel(
value: i32,
row: &crate::value::NodeValueRow,
-8
View File
@@ -115,14 +115,6 @@ void main(void) {
}
"#;
impl DespillNode {
/// Fragment shader (C++ `get_shader_code()`; the request is
/// ignored — there is a single shader).
fn shader_frag() -> &'static str {
SHADER_FRAG
}
}
impl NodeBehavior for DespillNode {
/// Human-readable name (C++ `name()`).
fn name(&self) -> &str {
+3 -1
View File
@@ -53,7 +53,9 @@ pub struct DirBlurNode;
/// Number of taps averaged per pixel. Fixed (upstream has no tap-count
/// knob either): a power-of-two constant keeps the division exact and
/// the shader otherwise branch-free.
/// the shader otherwise branch-free. Only the shader-source test reads
/// it, so it is kept (with an `allow`) to document the GLSL define.
#[allow(dead_code)]
const TAP_COUNT: i32 = 16;
/// Fragment shader: one direction vector from `angle_in`, then a
@@ -55,6 +55,8 @@ impl DisplayTransformNode {
/// Selected display name (C++ `get_display()`): the display combo
/// index mapped through the color manager's display list; empty
/// string when no manager is attached or the index is out of range.
#[allow(dead_code)] // C++ parity getter; the Rust model never attaches a
// color manager, so callers have nothing to query yet.
fn get_display(&self, core: &NodeCore) -> String {
// The C++ reads the display combo index through
// `manager()->list_available_displays()`. The Rust model has no
@@ -69,6 +71,7 @@ impl DisplayTransformNode {
/// Selected view name (C++ `get_view()`): the view combo index
/// mapped through the manager's views for [`Self::get_display`];
/// empty when unavailable.
#[allow(dead_code)] // See `get_display`.
fn get_view(&self, core: &NodeCore) -> String {
// See [`Self::get_display`]: no manager is ever attached in the
// Rust model, so the empty string is returned.
@@ -80,6 +83,7 @@ impl DisplayTransformNode {
/// Transform direction (C++ `get_direction()`): the direction combo
/// value cast to `ColorProcessor::Direction` (`0` = normal/forward,
/// `1` = inverse).
#[allow(dead_code)] // C++ parity getter; read back by the tests only.
fn get_direction(&self, core: &NodeCore) -> i64 {
core.standard_value(DIRECTION_INPUT, -1).to_double() as i64
}
-19
View File
@@ -256,25 +256,6 @@ void main(void) {
}
"#;
impl MaskDistortNode {
/// Merge fragment shader (C++ `get_shader_code()` `"mrg"` branch).
fn shader_mrg_frag() -> &'static str {
SHADER_MRG_FRAG
}
/// Invert fragment shader (C++ `get_shader_code()` `"invert"`
/// branch).
fn shader_invert_frag() -> &'static str {
SHADER_INVERT_FRAG
}
/// Feather blur fragment shader (C++ `get_shader_code()`
/// `"feather"` branch).
fn shader_feather_frag() -> &'static str {
SHADER_FEATHER_FRAG
}
}
/// Combined mask fragment shader for the `"mask"` shader id, replacing
/// the C++ chain — matte rasterize -> optional invert -> optional 2-pass
/// feather blur -> multiply over base — with a single GPU pass: the base
+3 -1
View File
@@ -35,7 +35,9 @@ pub const PARAM_A_INPUT: &str = "param_a_in";
pub const PARAM_B_INPUT: &str = "param_b_in";
/// Operand C input id (C++ `k_param_c_in`). Declared as a static but
/// never added in the constructor — reserved/unused upstream.
/// never added in the constructor — reserved/unused upstream, so it is
/// kept (with an `allow`) as the parity constant rather than deleted.
#[allow(dead_code)]
pub const PARAM_C_INPUT: &str = "param_c_in";
/// Math node: applies a binary arithmetic operation to two values.
+5 -1
View File
@@ -251,6 +251,10 @@ pub struct MathNodeBase;
impl MathNodeBase {
/// Display name for an operation (C++ `get_operation_name()`):
/// Add/Subtract/Multiply/Divide/Power.
///
/// Only the tests below call it today, so it is kept (with an
/// `allow`) as the parity helper rather than deleted.
#[allow(dead_code)]
pub fn operation_name(op: Operation) -> &'static str {
match op {
Operation::Add => "Add",
@@ -1283,7 +1287,7 @@ mod tests {
#[test]
fn value_internal_sample_number_static() {
let mut buf = f32_planar(2, 2, &[1.0, 2.0, 3.0, 4.0]);
let buf = f32_planar(2, 2, &[1.0, 2.0, 3.0, 4.0]);
let samples = NodeValue::Samples(buf.clone());
let mut out = NodeValueTable::default();
let core = NodeCore::new();
-8
View File
@@ -71,14 +71,6 @@ void main(void) {
}
"#;
impl MergeNode {
/// Fragment shader (C++ `get_shader_code()`; the request id is
/// ignored — the same alpha-over shader serves every request).
fn shader_frag() -> &'static str {
SHADER_FRAG
}
}
impl NodeBehavior for MergeNode {
/// Human-readable name (C++ `name()`).
fn name(&self) -> &str {
@@ -18,7 +18,6 @@
//! `src/node/src/input/multicam/multicamnode.{h,cpp}`,
//! `olive::MultiCamNode`).
use std::any::Any;
use crate::factory::NodeMeta;
use crate::id::NodeId;
use crate::node::{Category, NodeBehavior, NodeCore};
@@ -159,6 +159,8 @@ impl OCIOGradingTransformLinearNode {
/// Set the per-component widget colors of a vec4 input (C++
/// `set_vec4_input_colors()`): master `#c0c0c0`, R `#ff0000`, G
/// `#00ff00`, B `#0000ff`.
#[allow(dead_code)] // C++ parity helper; the parametrized widget colours
// are re-applied through `set_input_property` at setup time.
fn set_vec4_input_colors(core: &mut NodeCore, input: &str) {
set_input_property(
core,
@@ -417,7 +419,7 @@ impl NodeBehavior for OCIOGradingTransformLinearNode {
.to_double() != 0.0;
let white_enabled = row_or_standard(core, inputs, CLAMP_WHITE_ENABLE_INPUT, time)
.to_double() != 0.0;
let mut black =
let black =
row_or_standard(core, inputs, CLAMP_BLACK_INPUT, time).to_double();
let mut white =
row_or_standard(core, inputs, CLAMP_WHITE_INPUT, time).to_double();
@@ -178,6 +178,7 @@ impl OCIOGradingTransformLogNode {
/// Set the per-component widget colors of a vec4 input (C++
/// `set_vec4_input_colors()`): master `#c0c0c0`, R `#ff0000`, G
/// `#00ff00`, B `#0000ff`.
#[allow(dead_code)] // C++ parity helper; see the linear sibling.
fn set_vec4_input_colors(core: &mut NodeCore, input: &str) {
set_input_property(
core,
@@ -448,7 +449,7 @@ impl NodeBehavior for OCIOGradingTransformLogNode {
.to_double() != 0.0;
let white_enabled = row_or_standard(core, inputs, CLAMP_WHITE_ENABLE_INPUT, time)
.to_double() != 0.0;
let mut black =
let black =
row_or_standard(core, inputs, CLAMP_BLACK_INPUT, time).to_double();
let mut white =
row_or_standard(core, inputs, CLAMP_WHITE_INPUT, time).to_double();
+6
View File
@@ -90,6 +90,7 @@ impl OCIOLutNode {
/// Human-readable description of why no LUT processor is active
/// (C++ `last_error()`); empty when a valid LUT processor is in use
/// or no LUT file has been selected yet.
#[allow(dead_code)] // C++ parity accessor; read back by the tests.
pub fn last_error(&self) -> String {
self.state.lock().unwrap().last_error.clone()
}
@@ -98,6 +99,8 @@ impl OCIOLutNode {
/// unchanged. The Qt version surfaced the error on the main-window
/// status bar; here it is only recorded and read back via
/// [`Self::last_error`].
#[allow(dead_code)] // C++ parity setter; the tests feed it through
// `last_error`.
fn set_last_error(&self, error: &str) {
let mut state = self.state.lock().unwrap();
if state.last_error == error {
@@ -139,6 +142,8 @@ impl OCIOLutNode {
/// Whether this is the main GUI process (C++ file-static
/// `is_main_process()`): true when a render manager exists (the
/// render worker never creates one).
#[allow(dead_code)] // C++ parity probe; constants-only in the Rust model.
// The tests assert the worker answer directly.
fn is_main_process() -> bool {
// The C++ probes `oakrender_manager_available()`, which the
// oakrender bridge does not expose. Without a render manager (the
@@ -153,6 +158,7 @@ impl OCIOLutNode {
/// ensures the processor is current, then — in the main process
/// only — invalidates the texture-input cache and cancels background
/// video cache tasks so in-flight renders cannot write stale frames.
#[allow(dead_code)] // C++ parity entry point; the tests drive it.
fn generate_processor(&mut self, core: &mut NodeCore) {
self.ensure_processor(core);
// The C++ main-process half (`invalidate_all(k_texture_input)`
+4 -15
View File
@@ -32,7 +32,10 @@ pub const VALUE_INPUT: &str = "opacity_in";
/// Opacity effect node. Multiplies a texture's alpha by a 0..1 factor.
pub struct OpacityEffect {
/// Owned child math node configured to `multiply` (C++ `math_`,
/// formerly a QObject child).
/// formerly a QObject child). Held for its construction side effect;
/// the multiply actually runs through `NodeCore`, so the handle is
/// never read — kept (with an `allow`) rather than removed.
#[allow(dead_code)]
math: Box<super::math::MathNode>,
}
@@ -85,20 +88,6 @@ void main() {
}
"#;
impl OpacityEffect {
/// Fragment shader for the plain opacity path (C++
/// `get_shader_code()` default branch).
fn shader_frag() -> &'static str {
SHADER_FRAG
}
/// Fragment shader for the `rgbmult` request (C++
/// `get_shader_code()` `"rgbmult"` branch).
fn shader_rgb_mult_frag() -> &'static str {
SHADER_RGB_MULT_FRAG
}
}
impl NodeBehavior for OpacityEffect {
/// Human-readable name (C++ `name()`).
fn name(&self) -> &str {
+4 -1
View File
@@ -47,7 +47,10 @@ pub const CHANNEL_INPUT: &str = "premult_channel_in";
/// Channel selector values for [`CHANNEL_INPUT`], in combo order. The
/// numeric values are the shader's channel indices: `0` selects nothing
/// (the image passes through — a factor of 1) and `1..=4` select
/// `r`/`g`/`b`/`a`.
/// `r`/`g`/`b`/`a`. Only `Alpha` is constructed today (the runtime value
/// is the raw combo index); the full upstream set is kept (with an
/// `allow`) for parity.
#[allow(dead_code)]
#[repr(i64)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Channel {
@@ -73,6 +73,7 @@ impl ShapeNodeBase {
/// signature. The property write and the gizmo point placements are
/// therefore not representable here (`// CPP-PARITY:
/// shapenodebase.cpp` `update_gizmo_positions`).
#[allow(dead_code)] // C++ parity helpers; covered by the no-op tests.
pub fn update_gizmo_positions(
core: &mut crate::node::NodeCore,
row: &crate::value::NodeValueRow,
@@ -88,6 +89,7 @@ impl ShapeNodeBase {
/// command stack; neither is carried by this signature or this
/// crate's data model, so the writes are not representable here
/// (`// CPP-PARITY: shapenodebase.cpp` `set_rect`).
#[allow(dead_code)]
pub fn set_rect(core: &mut crate::node::NodeCore, rect: (f64, f64, f64, f64)) {
let _ = (core, rect);
}
@@ -106,6 +108,7 @@ impl ShapeNodeBase {
/// Rust `NodeCore::gizmos` has no dragger state, so the drag is not
/// representable here (`// CPP-PARITY: shapenodebase.cpp`
/// `gizmo_drag_move`).
#[allow(dead_code)]
pub fn gizmo_drag_move(core: &mut crate::node::NodeCore, x: f64, y: f64, modifiers: u32) {
let _ = (core, x, y, modifiers);
}
+3 -3
View File
@@ -182,8 +182,8 @@ mod tests {
fn backend_hooks_default_none() {
let _guard = TEST_BACKEND_LOCK.lock().unwrap();
set_text_backends(None, None);
assert_eq!(text_measure_backend(), None);
assert_eq!(text_render_backend(), None);
assert!(text_measure_backend().is_none());
assert!(text_render_backend().is_none());
}
#[test]
@@ -195,7 +195,7 @@ mod tests {
height: 34.0,
}
}
fn render(_r: &TextLayoutRequest, _t: &TextRenderTransform, mut target: TextRenderTarget) {
fn render(_r: &TextLayoutRequest, _t: &TextRenderTransform, target: TextRenderTarget) {
for b in target.data.iter_mut() {
*b = 255;
}
+3
View File
@@ -79,6 +79,7 @@ impl TextGeneratorV1 {
/// and the wrap width at 80% of the frame width (the "title safe"
/// area — `(width / 10) * 8`). The measure backend is not consulted
/// here.
#[allow(dead_code)] // C++ parity helper; the tests drive it.
pub fn layout_request(row: &NodeValueRow, frame_width: i32) -> TextLayoutRequest {
let text = row
.get(TEXT_INPUT)
@@ -115,6 +116,7 @@ impl TextGeneratorV1 {
/// valign combo (top: 10% top margin; center: frame center; bottom:
/// 10% bottom margin). The C++ math is integer (`width()/10`,
/// `height()/2 - doc_height/2`, ...), mirrored here.
#[allow(dead_code)]
pub fn draw_offsets(
valign: i32,
frame_width: i32,
@@ -144,6 +146,7 @@ impl TextGeneratorV1 {
/// The render step and the alpha transplant need the frame's pixel
/// buffer, which the Rust frame handle does not expose; they are not
/// representable here (`// CPP-PARITY: textv1.cpp` `generate_frame`).
#[allow(dead_code)]
pub fn measure_and_layout(
row: &NodeValueRow,
frame_width: i32,
+6
View File
@@ -73,6 +73,7 @@ fn to_text(v: &NodeValue) -> String {
}
/// `Variant::to_vec2()` for the inherited position/size inputs.
#[allow(dead_code)] // C++ parity accessor used by the tests.
fn to_vec2(v: &NodeValue) -> [f64; 2] {
match v {
NodeValue::Vec2(a) => *a,
@@ -86,6 +87,7 @@ impl TextGeneratorV2 {
/// replaced by `<br>` when `html_in` is set, 72 DPI
/// (`dots_per_meter = 2835`), and the wrap width at the shape
/// size X.
#[allow(dead_code)]
pub fn layout_request(row: &NodeValueRow) -> TextLayoutRequest {
let text = row
.get(TEXT_INPUT)
@@ -124,6 +126,7 @@ impl TextGeneratorV2 {
/// position re-centered into frame space —
/// `pos - size/2 + frame/2` (the frame halves are integer division in
/// C++).
#[allow(dead_code)]
pub fn base_offset(
pos: [f64; 2],
size: [f64; 2],
@@ -140,6 +143,7 @@ impl TextGeneratorV2 {
/// offset plus the vertical alignment delta — top: none; center:
/// `size.y/2 - doc_height/2` (the halving is integer on the
/// `int(doc.height)`); bottom: `size.y - doc_height`.
#[allow(dead_code)]
pub fn draw_offset(
valign: i32,
base: (f64, f64),
@@ -163,6 +167,7 @@ impl TextGeneratorV2 {
/// scale, the draw offset, and the clip rect at the base offset
/// covering the shape size (set before the vertical-alignment
/// translate in the C++).
#[allow(dead_code)]
pub fn render_transform(
scale: f64,
draw: (f64, f64),
@@ -190,6 +195,7 @@ impl TextGeneratorV2 {
/// The render step and the alpha transplant need the frame's pixel
/// buffer, which the Rust frame handle does not expose; they are not
/// representable here (`// CPP-PARITY: textv2.cpp` `generate_frame`).
#[allow(dead_code)]
pub fn measure_and_layout(
row: &NodeValueRow,
frame_width: i32,
+7
View File
@@ -334,6 +334,7 @@ impl TextGeneratorV3 {
/// Middle -> `TextGizmo::k_align_vcenter`, Bottom ->
/// `TextGizmo::k_align_bottom` (0 = top, 1 = bottom, 2 = vcenter in
/// the gizmo's numbering).
#[allow(dead_code)] // C++ parity helpers; covered by the tests.
pub fn get_gizmo_alignment_from_ours(v: VerticalAlignment) -> i32 {
match v {
VerticalAlignment::Top => 0,
@@ -413,6 +414,7 @@ impl TextGeneratorV3 {
/// Gizmo activated callback (C++ `gizmo_activated()`): sets
/// `use_args_in` to `false` and `dont_emit_valign_ = true`.
#[allow(dead_code)] // C++ parity callbacks; covered by the tests.
fn gizmo_activated(&mut self, core: &mut NodeCore) {
core.set_standard_value(USE_ARGS_INPUT, -1, NodeValue::Boolean(false));
self.dont_emit_valign = true;
@@ -420,6 +422,7 @@ impl TextGeneratorV3 {
/// Gizmo deactivated callback (C++ `gizmo_deactivated()`): sets
/// `use_args_in` to `true` and `dont_emit_valign_ = true`.
#[allow(dead_code)]
fn gizmo_deactivated(&mut self, core: &mut NodeCore) {
core.set_standard_value(USE_ARGS_INPUT, -1, NodeValue::Boolean(true));
self.dont_emit_valign = true;
@@ -431,6 +434,7 @@ impl TextGeneratorV3 {
/// command stack is not part of this crate, so only the resulting
/// standard-value write is performed (`// CPP-PARITY: textv3.cpp`
/// `set_vertical_alignment_undoable`).
#[allow(dead_code)]
fn set_vertical_alignment_undoable(&mut self, core: &mut NodeCore, a: i32) {
core.set_standard_value(
VERTICAL_ALIGNMENT_INPUT,
@@ -738,6 +742,7 @@ impl TextGeneratorV3 {
/// dots/meter) with the font taken from the markup. Both wrap to the
/// shape size X; the backend defaults are used when font family/size
/// are empty/zero.
#[allow(dead_code)]
pub fn layout_request(row: &NodeValueRow) -> TextLayoutRequest {
Self::layout_request_path(Self::plain_text_path(), row)
}
@@ -785,6 +790,7 @@ impl TextGeneratorV3 {
/// The C++ base offset (textv3.cpp `generate_frame()`): the shape
/// position re-centered into frame space — `pos - size/2 + frame/2`
/// (the frame halves are integer division in C++).
#[allow(dead_code)] // C++ parity helpers; the tests drive them.
pub fn base_offset(
pos: [f64; 2],
size: [f64; 2],
@@ -846,6 +852,7 @@ impl TextGeneratorV3 {
/// The render step needs the frame's pixel buffer, which the Rust
/// frame handle does not expose; it is not representable here
/// (`// CPP-PARITY: textv3.cpp` `generate_frame`).
#[allow(dead_code)]
pub fn measure_and_layout(row: &NodeValueRow) -> (TextLayoutRequest, TextLayoutSize) {
let req = Self::layout_request(row);
let doc = match super::textbackend::text_measure_backend() {
@@ -102,14 +102,6 @@ void main(void)
}
"#;
impl ThreeWayColorNode {
/// Fragment shader for any request (C++ `get_shader_code()` ignores
/// the request id and always returns this shader).
fn shader_frag() -> &'static str {
SHADER_FRAG
}
}
impl NodeBehavior for ThreeWayColorNode {
/// Human-readable name (C++ `name()`, inline in the header).
fn name(&self) -> &str {
@@ -50,6 +50,10 @@ pub const MIRROR_Y_INPUT: &str = "mirrory_in";
/// Anchor point for tiling (C++ private enum `Anchor`); values match
/// the `anchor_in` combo indices and the shader's `anchor_in` defines.
/// Only `MiddleCenter` is constructed today (the runtime value is the
/// raw combo index); the full upstream set is kept (with an `allow`)
/// for parity.
#[allow(dead_code)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum Anchor {
/// Top-left corner.
@@ -85,6 +85,9 @@ pub const GIZMO_SCALE_COUNT: usize = 8;
/// Auto-scale mode (C++ `AutoScaleType`); values match the
/// `autoscale_in` combo indices.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
// C++ parity value set (`AutoScaleType`); only `None` is constructed at
// runtime (the combo indices are still resolved through this enum).
#[allow(dead_code)]
pub enum AutoScaleType {
/// No auto-scaling.
None = 0,
@@ -99,6 +102,7 @@ pub enum AutoScaleType {
/// Rotation direction for wrap-around detection (C++ private enum
/// `RotationDirection`).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[allow(dead_code)] // C++ parity value set; see `AutoScaleType`.
enum RotationDirection {
/// No direction established yet.
None,
@@ -110,6 +114,7 @@ enum RotationDirection {
/// Which axes a scale gizmo drags (C++ private enum `GizmoScaleType`).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[allow(dead_code)] // C++ parity value set; see `AutoScaleType`.
enum GizmoScaleType {
/// Horizontal center handles (C++ `k_gizmo_scale_x_only`).
XOnly,
@@ -191,6 +196,8 @@ impl TransformDistortNode {
/// representable: `generate_auto_scaled_matrix` needs the texture
/// params from the C++ `VideoParams` (the Rust texture handle carries
/// no params) and `is_a_scale_gizmo` compares gizmo pointers.
#[allow(dead_code)] // C++ parity helpers; the pure ones are covered by
// the tests, the rest are not representable in the Rust model.
fn adjust_matrix_by_resolutions(
mat: [f64; 16],
sequence_res: (f64, f64),
@@ -264,6 +271,7 @@ impl TransformDistortNode {
/// C++ `Matrix4x4::map(PointF)` equivalent: maps `p` through the
/// row-major matrix treating it as `(x, y, 0, 1)`, dividing by the
/// resulting `w` whenever it is not exactly 1.
#[allow(dead_code)]
fn map_point(mat: [f64; 16], p: (f64, f64)) -> (f64, f64) {
let x = p.0 * mat[0] + p.1 * mat[1] + mat[3];
let y = p.0 * mat[4] + p.1 * mat[5] + mat[7];
@@ -278,6 +286,7 @@ impl TransformDistortNode {
/// Scale-point gizmo placement (C++ `create_scale_point()`): maps the
/// unit-square position through `mat` and adds the sequence half
/// resolution.
#[allow(dead_code)]
fn create_scale_point(x: f64, y: f64, half_res: (f64, f64), mat: [f64; 16]) -> (f64, f64) {
let p = Self::map_point(mat, (x, y));
(p.0 + half_res.0, p.1 + half_res.1)
@@ -286,6 +295,7 @@ impl TransformDistortNode {
/// Rotation direction of a mouse angle step (C++
/// `get_direction_from_angles()`): positive when `current` is greater
/// than `last`, negative otherwise.
#[allow(dead_code)]
fn get_direction_from_angles(last: f64, current: f64) -> RotationDirection {
if current > last {
RotationDirection::Positive
+1 -1
View File
@@ -190,7 +190,7 @@ pub fn create() -> (NodeCore, Box<dyn NodeBehavior>) {
)];
core.add_input(method);
let mut x = crate::input::Input::new(
let x = crate::input::Input::new(
X_INPUT,
crate::value::ValueType::Float,
crate::value::NodeValue::Float(0.0),
+4 -1
View File
@@ -48,7 +48,10 @@ pub const CHANNEL_INPUT: &str = "unpremult_channel_in";
/// Channel selector values for [`CHANNEL_INPUT`], in combo order. The
/// numeric values are the shader's channel indices: `0` selects nothing
/// (the image passes through — a divisor of 1) and `1..=4` select
/// `r`/`g`/`b`/`a`.
/// `r`/`g`/`b`/`a`. Only `Alpha` is constructed today (the runtime value
/// is the raw combo index); the full upstream set is kept (with an
/// `allow`) for parity.
#[allow(dead_code)]
#[repr(i64)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Channel {
@@ -73,12 +73,6 @@ void main(void)
"#;
impl WhiteBalanceNode {
/// Fragment shader for any request (C++ `get_shader_code()` ignores
/// the request id and always returns this shader).
fn shader_frag() -> &'static str {
SHADER_FRAG
}
/// RGB gains for a given illuminant temperature and tint (C++
/// `get_gain_for_temperature()`, extracted for testability). Kelvin
/// is clamped to [1000, 40000]; the Tanner Helland blackbody
+12 -11
View File
@@ -114,9 +114,9 @@ pub fn copy_inputs(
/// node ids (source order). Undo packaging happens at the caller via
/// oakundo's `UndoCommand`.
pub fn copy_subgraph(
graph: &mut Graph,
nodes: &[NodeId],
exclude_items: bool,
_graph: &mut Graph,
_nodes: &[NodeId],
_exclude_items: bool,
) -> crate::error::Result<Vec<NodeId>> {
todo!()
}
@@ -124,22 +124,22 @@ pub fn copy_subgraph(
/// Transform a time range from one node's frame of reference to
/// another's along the connection path (C++ `Node::transform_time_to`).
pub fn transform_time_to(
graph: &Graph,
time: TimeRange,
from: NodeId,
to: NodeId,
_graph: &Graph,
_time: TimeRange,
_from: NodeId,
_to: NodeId,
) -> crate::error::Result<TimeRange> {
todo!()
}
/// Undo-command display strings (C++
/// `get_connect_command_string`/`get_disconnect_command_string`).
pub fn connect_command_string(output: NodeId, input: NodeId, input_id: &str) -> String {
pub fn connect_command_string(_output: NodeId, _input: NodeId, _input_id: &str) -> String {
todo!()
}
/// See [`connect_command_string`].
pub fn disconnect_command_string(output: NodeId, input: NodeId, input_id: &str) -> String {
pub fn disconnect_command_string(_output: NodeId, _input: NodeId, _input_id: &str) -> String {
todo!()
}
@@ -181,8 +181,9 @@ pub fn set_value_at_time_command(
use crate::error::Error;
use crate::keyframe::{Interpolation, Keyframe};
// Determine the mutation from the current state.
let declared = graph
// Determine the mutation from the current state. The declared type is
// validated but not otherwise used yet.
let _declared = graph
.get(node)
.and_then(|e| e.core.input_data_type(input))
.ok_or(Error::NotFound)?;
+1 -5
View File
@@ -17,7 +17,7 @@
//! Project: owns the graph, the folder tree, settings, and the undo
//! stack binding. Mirrors C++ `olive::Project`.
use std::sync::{Arc, Mutex, Weak};
use std::sync::{Arc, Mutex};
use crate::graph::Graph;
use crate::id::NodeId;
@@ -451,7 +451,3 @@ pub enum ChangeRecord {
},
}
/// Weak-project handle used by the identity registry (node_from_identity
/// upgrades it; a freed project leaves a dead weak entry that upgrades
/// to `None`).
pub(crate) type WeakProject = Weak<Mutex<Project>>;
+3 -3
View File
@@ -24,11 +24,11 @@ use crate::input::Input;
use crate::node::{Category, NodeBehavior, NodeCore};
use crate::value::{AudioParams, NodeValue, ValueType, VideoParams};
/// Sequence texture/samples input ids (ViewerOutput::k_texture_input /
/// k_samples_input) and the track input id format (Sequence::
/// k_track_input_format).
/// Sequence texture input id (C++ `ViewerOutput::k_texture_input`).
pub const TEXTURE_INPUT: &str = "tex_in";
/// Sequence audio samples input id (C++ `ViewerOutput::k_samples_input`).
pub const SAMPLES_INPUT: &str = "samples_in";
/// Sequence per-track input id format (C++ `Sequence::k_track_input_format`).
pub const TRACK_INPUT_FORMAT: &str = "track_in_%1";
/// Sequence behavior (viewer node).
+2 -3
View File
@@ -39,7 +39,7 @@ use crate::graph::Graph;
use crate::id::NodeId;
use crate::keyframe::{Interpolation, Keyframe};
use crate::node::NodeCore;
use crate::project::{NodeRef, Project};
use crate::project::Project;
use crate::value::{NodeValue, ValueType};
/// Minimal XML reader surface the serializer needs (implemented over
@@ -565,7 +565,6 @@ fn load_project_body(
reader: &mut dyn XmlRead,
project: &mut Project,
) -> crate::error::Result<std::collections::HashMap<u64, NodeId>> {
use crate::error::Error;
// Identity -> NodeId map for connection resolution.
let mut id_map: std::collections::HashMap<u64, NodeId> = std::collections::HashMap::new();
// Deferred connections: (output_identity, input_node_id, input_id, element).
@@ -693,7 +692,7 @@ fn load_node(
// types fall back to an error. `create_any` also covers the dynamic
// (runtime-registered OpenFX plugin) entries — `find` alone would
// reject every project that carries a plugin node.
let (mut core, behavior): (NodeCore, Box<dyn crate::node::NodeBehavior>) =
let (core, behavior): (NodeCore, Box<dyn crate::node::NodeBehavior>) =
match create_timeline_type(&type_id) {
Some(x) => x,
None => match crate::factory::Factory::global().create_any(&type_id) {
+3 -11
View File
@@ -203,11 +203,6 @@ impl SampleBuffer {
return None;
}
let bps = self.format.bytes_per_sample();
let stride = if self.format.is_planar() {
self.sample_count
} else {
self.channels
};
let pos = if self.format.is_planar() {
channel * self.sample_count + index
} else {
@@ -695,7 +690,7 @@ impl Clone for NodeValue {
fn clone(&self) -> Self {
match self {
NodeValue::Texture(h) => {
let mut h2 = h.clone();
let h2 = h.clone();
if let Some(f) = h2.addref {
// Safety: `h2` is a valid handle; addref only touches
// the refcount.
@@ -771,7 +766,7 @@ impl OakNodeValue {
/// Map an oaknode_value POD into a [`NodeValue`] of the input's
/// declared type (C++ `variant_from_value`). `OAKNODE_VALUE_STRING`
/// and unknown kinds are rejected with [`Error::Invalid`].
pub fn to_node_value(self, declared: ValueType) -> crate::error::Result<NodeValue> {
pub fn to_node_value(self, _declared: ValueType) -> crate::error::Result<NodeValue> {
use crate::error::Error;
match self.kind {
oak::INT | oak::COMBO => Ok(NodeValue::Int(self.num)),
@@ -858,10 +853,7 @@ impl OakNodeValue {
out.f = a;
Ok(out)
}
_ => {
out.kind = oak::NONE;
Err(Error::Failed("type has no POD representation".to_string()))
}
_ => Err(Error::Failed("type has no POD representation".to_string())),
}
}
}