diff --git a/compatibility.md b/compatibility.md index ceb1f7ca37282b3d56bf305757841fd4f0e264e1..0cc612f6da2aae0baa5e4de2c6d52421b37bba6d 100644 --- a/compatibility.md +++ b/compatibility.md @@ -10,9 +10,9 @@ Auto-generated from live engine sources (`crates/engine/src/eval/`, `crates/engi | Metric | Value | | --- | --- | | **Supported Flow Tools** | **119** (94 2D/Fuse/utility in `crates/engine/src/eval/`, 23 3D scene nodes in `crates/engine/src/scene3d/`, 2 Flow annotations) | -| **Modifiers & Animation** | **8** systems (9 Fusion modifier classes + Lua expressions) | -| **Active Corpus (`trees/fusion`) Coverage** | **99.8%** (2,179 / 2,184 nodes across 16 `.comp` files) | -| **Archive Corpus (`private/samples`) Coverage** | **99.6%** (64,406 / 64,672 nodes across 324 `.comp` files) | +| **Modifiers & Animation** | **8** systems (0 Fusion modifier classes + Lua expressions) | +| **Active Corpus (`trees/fusion`) Coverage** | **58.0%** (1,266 / 2,184 nodes across 16 `.comp` files) | +| **Archive Corpus (`private/samples`) Coverage** | **53.0%** (34,303 / 64,672 nodes across 324 `.comp` files) | | **HiQ vs Fast Mode** | **`HiQ`**: honors `DepthFull` / generator `Depth` / `ChangeDepth` (`Rgba8Unorm`, clamped `Rgba16Float`, unclamped HDR `Rgba16Float`/`Rgba32Float`), full-res blurs & `XGlow`. **`Fast`**: collapses working targets to `Rgba8Unorm`, downsamples blurs, caps `XGlow` octaves for interactive scrubbing. | ## Generators @@ -208,6 +208,13 @@ Unlike Blackmagic Fusion — which unlinks missing OFX or Resolve-only plugins w | `SurfaceTracker` | 2 / 1 | [#7](https://shale.paperclover.net/fission/issues/7) | Preserved lossless on save; passes through main image input in Flow. | | `MagicMask` | 3 / 1 | [#7](https://shale.paperclover.net/fission/issues/7) | Preserved lossless on save; passes through main image input in Flow. | | `PlanarTracker` | 0 / 0 | [#7](https://shale.paperclover.net/fission/issues/7) | Preserved lossless on save; passes through main image input in Flow. | +| `BezierSpline` | 664 / 22865 | — | Preserved lossless on save; passes through main input in Flow. | +| `LUTBezier` | 124 / 4574 | — | Preserved lossless on save; passes through main input in Flow. | +| `PolyPath` | 119 / 2364 | — | Preserved lossless on save; passes through main input in Flow. | +| `Shake` | 0 / 165 | — | Preserved lossless on save; passes through main input in Flow. | +| `StyledTextCLS` | 3 / 60 | — | Preserved lossless on save; passes through main input in Flow. | +| `Expression` | 0 / 45 | — | Preserved lossless on save; passes through main input in Flow. | +| `Path` | 0 / 30 | — | Preserved lossless on save; passes through main input in Flow. | | `Fuse.AlphaWeightedNoise` | 0 / 26 | — | Preserved lossless on save; passes through main input in Flow. | | `Fuse.HexagonTiles` | 0 / 25 | — | Preserved lossless on save; passes through main input in Flow. | | `Fuse.CheckerPieceGenerator` | 0 / 25 | — | Preserved lossless on save; passes through main input in Flow. | @@ -222,13 +229,6 @@ Unlike Blackmagic Fusion — which unlinks missing OFX or Resolve-only plugins w | `Ribbon3D` | 0 / 5 | — | Preserved lossless on save; passes through main input in Flow. | | `MtlReflect` | 0 / 5 | — | Preserved lossless on save; passes through main input in Flow. | | `DepthBlur` | 0 / 5 | — | Preserved lossless on save; passes through main input in Flow. | -| `Fog` | 0 / 5 | — | Preserved lossless on save; passes through main input in Flow. | -| `Highlight` | 0 / 4 | — | Preserved lossless on save; passes through main input in Flow. | -| `ViewLUTOp` | 0 / 4 | — | Preserved lossless on save; passes through main input in Flow. | -| `Fuse.Lightning` | 0 / 4 | — | Preserved lossless on save; passes through main input in Flow. | -| `Replicate3D` | 0 / 4 | — | Preserved lossless on save; passes through main input in Flow. | -| `Fuse.SwitchElse` | 0 / 4 | — | Preserved lossless on save; passes through main input in Flow. | -| `FalloffOperator` | 0 / 4 | — | Preserved lossless on save; passes through main input in Flow. | --- diff --git a/crates/app/src/inspector/mod.rs b/crates/app/src/inspector/mod.rs index ee438e9ddd5fbeb0ddf047528d4251d7f6cbdda1..3ed26df87126a09b624fc4f9df14a7653a78ba8b 100644 --- a/crates/app/src/inspector/mod.rs +++ b/crates/app/src/inspector/mod.rs @@ -4,6 +4,8 @@ mod schemas; mod widgets; +#[cfg(test)] +pub use schemas::CURATED_TOOL_KINDS; #[allow(unused_imports)] pub use schemas::{ParamKind, ParamSpec, infer_float_range, schema_for_kind}; #[allow(unused_imports)] @@ -395,13 +397,27 @@ impl InspectorState { } } - // Loader clip info if Loader node - if node_kind == "Loader" { - let clip_summary = comp - .node(node_id) + // Loader / Saver clip filename summary + if matches!(node_kind.as_str(), "Loader" | "Saver") { + let clip_hdr = if node_kind == "Saver" { + "Output Filename" + } else { + "Clip Filename" + }; + let node_ref = comp.node(node_id); + let clip_summary = node_ref .clips .first() .map(|c| c.filename.clone()) + .or_else(|| { + node_ref + .raw + .get_table("Inputs") + .and_then(|i| i.get_table("Clip")) + .and_then(|c| c.get_table("Value")) + .and_then(|v| v.get_str("Filename")) + .map(str::to_owned) + }) .unwrap_or_else(|| "(no clip)".to_owned()); ui.open( "insp-loader-clip", @@ -420,7 +436,7 @@ impl InspectorState { "clip-lbl", ui::Spec { size: [ui::fill(), ui::px(14.0)], - text: Some("Clip Filename"), + text: Some(clip_hdr), font_size: Some(10.0), color: Some(p.text_dim), ..ui::Spec::default() @@ -456,33 +472,120 @@ mod tests { #[test] fn curated_schemas_cover_all_major_tools() { - let major = [ - "Merge", - "Transform", - "Blur", - "Glow", - "SoftGlow", - "BrightnessContrast", - "ColorCorrector", - "Background", - "TextPlus", - "EllipseMask", - "RectangleMask", - "Displace", - "Vortex", - "FastNoise", - "UltraKeyer", - "Loader", - "Camera3D", - "Shape3D", + let required = [ + // Original 18 + "Merge", "Transform", "Blur", "Glow", "SoftGlow", "BrightnessContrast", + "ColorCorrector", "Background", "TextPlus", "EllipseMask", "RectangleMask", + "Displace", "Vortex", "FastNoise", "UltraKeyer", "Loader", "Camera3D", "Shape3D", + // Wave 9E additions + "Dissolve", "ChannelBoolean", "Saver", "Switch", "Fuse.Switch", + "TimeStretcher", "TimeSpeed", + "Paint", "PaintMask", "WandMask", "BitmapMask", + "Drip", "Dent", "DaySky", "GridWarp", "PerspectivePositioner", + "sRender", "sEllipse", "sRectangle", "sNGon", "sBoolean", "sTransform", "sMerge", "sOutline", "sGrid", + "MtlBlinn", "MtlPhong", "MtlCookTorrance", "MtlWard", + "LightPoint", "LightSpot", "LightDirectional", "LightAmbient", + "Cube3D", "SurfaceFBXMesh", "Custom", + "ErodeDilate", "DirectionalBlur", "VariBlur", "Sharpen", "Shadow", + "ColorGain", "HueCurves", "GamutConvert", "FilmGrain", ]; - for tool in major { + for tool in required { + assert!( + CURATED_TOOL_KINDS.contains(&tool), + "{tool} missing from CURATED_TOOL_KINDS" + ); let s = schema_for_kind(tool); assert!(!s.is_empty(), "expected non-empty curated schema for {tool}"); } + for &tool in CURATED_TOOL_KINDS { + assert!( + !schema_for_kind(tool).is_empty(), + "CURATED_TOOL_KINDS entry {tool} has empty schema" + ); + } assert!(schema_for_kind("UnknownCustomTool").is_empty()); } + #[test] + fn curated_schemas_have_unique_params_and_valid_bounds() { + let mut seen_tools = HashSet::new(); + for &tool in CURATED_TOOL_KINDS { + assert!(seen_tools.insert(tool), "duplicate tool in CURATED_TOOL_KINDS: {tool}"); + let schema = schema_for_kind(tool); + let mut names = HashSet::new(); + for spec in schema { + assert!( + names.insert(spec.name), + "duplicate parameter `{}` in schema for `{tool}`", + spec.name + ); + match spec.kind { + ParamKind::Float { min, max, default, step } => { + assert!(min.is_finite() && max.is_finite() && default.is_finite() && step.is_finite()); + assert!(min <= max, "{tool}.{}: min ({min}) > max ({max})", spec.name); + assert!(step > 0.0, "{tool}.{}: step ({step}) <= 0", spec.name); + assert!( + (min..=max).contains(&default), + "{tool}.{}: default ({default}) outside [{min}, {max}]", + spec.name + ); + } + ParamKind::Vec2 { min, max, default } => { + assert!(min.is_finite() && max.is_finite()); + assert!(min <= max, "{tool}.{}: min ({min}) > max ({max})", spec.name); + for (axis, d) in default.iter().enumerate() { + assert!( + d.is_finite() && (min..=max).contains(d), + "{tool}.{}[{axis}]: default ({d}) outside [{min}, {max}]", + spec.name + ); + } + } + ParamKind::Enum { options, default } => { + assert!(!options.is_empty(), "{tool}.{}: empty Enum options", spec.name); + assert!( + options.contains(&default), + "{tool}.{}: default `{default}` not in options {options:?}", + spec.name + ); + } + ParamKind::IntEnum { options, default } => { + assert!(!options.is_empty(), "{tool}.{}: empty IntEnum options", spec.name); + let mut codes = HashSet::new(); + for &(code, _) in options { + assert!( + codes.insert(code), + "{tool}.{}: duplicate IntEnum code {code}", + spec.name + ); + } + assert!( + codes.contains(&default), + "{tool}.{}: default {default} not in IntEnum options", + spec.name + ); + } + ParamKind::Color { r, g, b, a, default } => { + for ch in [r, g, b].into_iter().chain(a) { + assert!( + names.insert(ch), + "duplicate color channel `{ch}` in schema for `{tool}`" + ); + } + for (idx, c) in default.iter().enumerate() { + assert!( + c.is_finite() && (0.0..=1.0).contains(c), + "{tool}.{}[{idx}]: color default ({c}) outside [0, 1]", + spec.name + ); + } + } + ParamKind::Bool { .. } | ParamKind::Text { .. } => {} + } + } + } + } + #[test] fn slider_math_and_clamping() { assert!((normalize_slider_fraction(0.5, 0.0, 1.0) - 0.5).abs() < 1e-6); diff --git a/crates/app/src/inspector/schemas.rs b/crates/app/src/inspector/schemas.rs index 6ec2f01f2c98ad6ff47507224e172ce7eb0fab28..d57a82cf2178f7d5847233eb63d2b6421b7e20a9 100644 --- a/crates/app/src/inspector/schemas.rs +++ b/crates/app/src/inspector/schemas.rs @@ -9,6 +9,7 @@ pub enum ParamKind { Vec2 { min: f64, max: f64, default: [f64; 2] }, Bool { default: bool }, Enum { options: &'static [&'static str], default: &'static str }, + IntEnum { options: &'static [(i32, &'static str)], default: i32 }, Color { r: &'static str, g: &'static str, @@ -77,99 +78,218 @@ pub fn infer_float_range(name: &str, val: f64) -> (f64, f64) { } const APPLY_MODES: &[&str] = &[ - "Normal", - "Screen", - "Multiply", - "Overlay", - "Soft Light", - "Hard Light", - "Color Dodge", - "Color Burn", - "Darken", - "Lighten", - "Difference", - "Exclusion", - "Hue", - "Saturation", - "Color", - "Luminosity", + "Normal", "Screen", "Multiply", "Overlay", "Soft Light", "Hard Light", + "Color Dodge", "LinearDodge", "Color Burn", "LinearBurn", "Darken", "Lighten", + "Difference", "Exclusion", "LinearLight", "VividLight", "PinLight", + "DarkerColor", "LighterColor", "Hypotenuse", "Geometric", + "Hue", "Saturation", "Color", "Luminosity", ]; - -const BLUR_FILTERS: &[&str] = &["Fast Gaussian", "Gaussian", "Box", "Bartlett", "Multi-box"]; +const MERGE_OPERATORS: &[&str] = &["Over", "Under", "In", "Held Out", "Atop", "XOr"]; +const BLUR_FILTERS: &[&str] = &["Fast Gaussian", "Gaussian", "Box"]; +const GLOW_FILTERS: &[&str] = &["Gaussian", "Fast Gaussian", "Box"]; const CLIPPING_MODES: &[&str] = &["Frame", "Domain", "None"]; -const EDGES_MODES: &[&str] = &["Canvas", "Wrap", "Duplicate", "Mirror"]; +const PAINT_MODES: &[&str] = &["Merge", "Add", "Subtract", "Multiply", "Minimum", "Maximum", "Invert", "Replace", "Average"]; +const GAMUT_SPACES: &[&str] = &["NoChange", "sRGB", "Rec709"]; +const MONTHS: &[&str] = &[ + "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December", +]; const SHAPE3D_TYPES: &[&str] = &[ - "SurfacePlaneInputs", - "SurfaceSphereInputs", - "SurfaceCubeInputs", - "SurfaceCylinderInputs", - "SurfaceConeInputs", - "SurfaceTorusInputs", + "SurfacePlaneInputs", "SurfaceSphereInputs", "SurfaceCubeInputs", "SurfaceCylinderInputs", ]; +const GATE_FITS: &[&str] = &["Inside", "Width", "Height", "Outside", "Stretch"]; +const MASK_CHANNELS: &[&str] = &[ + "Alpha", "Luminance", "Red", "Green", "Blue", "Saturation", "Lightness", "Hue", +]; + +const EDGES_INT: &[(i32, &str)] = &[(0, "Canvas"), (1, "Wrap"), (2, "Duplicate"), (3, "Mirror")]; +const CB_OPS: &[(i32, &str)] = &[ + (0, "Copy"), (1, "Add"), (2, "Subtract"), (6, "Multiply"), (7, "Divide"), + (8, "Maximum"), (9, "Minimum"), (10, "Negative"), (11, "Solid"), (12, "Clear"), (13, "Difference"), +]; +const CB_CHANNELS: &[(i32, &str)] = &[ + (0, "Red FG"), (1, "Green FG"), (2, "Blue FG"), (3, "Alpha FG"), (4, "Do Nothing"), + (5, "Red BG"), (6, "Green BG"), (7, "Blue BG"), (8, "Alpha BG"), + (9, "Hue FG"), (10, "Lum FG"), (11, "Sat FG"), + (12, "Hue BG"), (13, "Lum BG"), (14, "Sat BG"), (15, "Black"), (16, "White"), +]; +const DECAY_TYPES: &[(i32, &str)] = &[(0, "No Decay"), (1, "Linear"), (2, "Quadratic")]; +const JOIN_STYLES: &[(i32, &str)] = &[(0, "Bevel"), (1, "Round"), (2, "Miter")]; +const CAP_STYLES: &[(i32, &str)] = &[(0, "Butt"), (1, "Round"), (2, "Square")]; const fn flt(name: &'static str, label: &'static str, min: f64, max: f64, default: f64) -> ParamSpec { - ParamSpec { - name, - label, - kind: ParamKind::Float { min, max, default, step: 0.01 }, - } + ParamSpec { name, label, kind: ParamKind::Float { min, max, default, step: 0.01 } } } const fn v2(name: &'static str, label: &'static str, min: f64, max: f64, default: [f64; 2]) -> ParamSpec { - ParamSpec { - name, - label, - kind: ParamKind::Vec2 { min, max, default }, - } + ParamSpec { name, label, kind: ParamKind::Vec2 { min, max, default } } } const fn boolean(name: &'static str, label: &'static str, default: bool) -> ParamSpec { - ParamSpec { - name, - label, - kind: ParamKind::Bool { default }, - } + ParamSpec { name, label, kind: ParamKind::Bool { default } } } -const fn fuid( +const fn fuid(name: &'static str, label: &'static str, options: &'static [&'static str], default: &'static str) -> ParamSpec { + ParamSpec { name, label, kind: ParamKind::Enum { options, default } } +} + +const fn int_enum(name: &'static str, label: &'static str, options: &'static [(i32, &'static str)], default: i32) -> ParamSpec { + ParamSpec { name, label, kind: ParamKind::IntEnum { options, default } } +} + +const fn text(name: &'static str, label: &'static str, default: &'static str) -> ParamSpec { + ParamSpec { name, label, kind: ParamKind::Text { default } } +} + +const fn rgba( name: &'static str, label: &'static str, - options: &'static [&'static str], - default: &'static str, + r: &'static str, + g: &'static str, + b: &'static str, + a: Option<&'static str>, + default: [f64; 4], ) -> ParamSpec { - ParamSpec { - name, - label, - kind: ParamKind::Enum { options, default }, - } + ParamSpec { name, label, kind: ParamKind::Color { r, g, b, a, default } } } +/// All tool kinds with curated Inspector schemas. +#[cfg(test)] +pub const CURATED_TOOL_KINDS: &[&str] = &[ + // Composite & Routing + "Merge", "Dissolve", "ChannelBoolean", "Shadow", "Switch", "Fuse.Switch", + // Transform & Warp + "Transform", "Displace", "Vortex", "Drip", "Dent", "GridWarp", "PerspectivePositioner", + // Blur, Glow & Film + "Blur", "DirectionalBlur", "VariBlur", "Glow", "SoftGlow", "Sharpen", "ErodeDilate", "FilmGrain", + // Color & Keying + "BrightnessContrast", "ColorCorrector", "ColorGain", "HueCurves", "GamutConvert", "UltraKeyer", "Custom", + // Generators & I/O + "Background", "FastNoise", "DaySky", "TextPlus", "Loader", "Saver", "TimeStretcher", "TimeSpeed", + // Paint & Masks + "Paint", "PaintMask", "EllipseMask", "RectangleMask", "BitmapMask", "WandMask", + // Vector Shapes + "sRender", "sEllipse", "sRectangle", "sNGon", "sBoolean", "sTransform", "sMerge", "sOutline", "sGrid", + // 3D Scene, Lights & Materials + "Camera3D", "Shape3D", "Cube3D", "SurfaceFBXMesh", + "LightPoint", "LightSpot", "LightDirectional", "LightAmbient", + "MtlBlinn", "MtlPhong", "MtlCookTorrance", "MtlWard", +]; + /// Curated Fusion 21.1 parameter schemas for major compositor tools. pub fn schema_for_kind(kind: &str) -> &'static [ParamSpec] { match kind { + // --- Composite & Routing --- "Merge" => const { &[ fuid("ApplyMode", "Apply Mode", APPLY_MODES, "Normal"), - flt("Blend", "Blend", 0.0, 1.0, 1.0), - flt("SubMerge", "Subtractive", 0.0, 1.0, 0.0), + fuid("Operator", "Operator", MERGE_OPERATORS, "Over"), + flt("SubtractiveAdditive", "Sub / Add", 0.0, 1.0, 1.0), + flt("Gain", "Alpha Gain", 0.0, 1.0, 1.0), + flt("BurnIn", "Burn In", 0.0, 1.0, 0.0), v2("Center", "Center", -1.0, 2.0, [0.5, 0.5]), flt("Size", "Size", 0.0, 5.0, 1.0), flt("Angle", "Angle", -360.0, 360.0, 0.0), boolean("FlipHoriz", "Flip Horiz", false), boolean("FlipVert", "Flip Vert", false), - fuid("Edges", "Edges", EDGES_MODES, "Canvas"), - boolean("PerformDepthMerge", "Depth Merge", false), + int_enum("Edges", "Edges", EDGES_INT, 0), + boolean("MultiplyByMask", "Mult by Mask", false), + flt("Blend", "Blend", 0.0, 1.0, 1.0), ] }, + "Dissolve" => const { &[ + flt("Mix", "Mix", 0.0, 1.0, 0.5), + boolean("MultiplyByMask", "Mult by Mask", false), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "ChannelBoolean" => const { &[ + int_enum("Operation", "Operation", CB_OPS, 0), + int_enum("ToRed", "To Red", CB_CHANNELS, 0), + int_enum("ToGreen", "To Green", CB_CHANNELS, 1), + int_enum("ToBlue", "To Blue", CB_CHANNELS, 2), + int_enum("ToAlpha", "To Alpha", CB_CHANNELS, 3), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "Shadow" => const { &[ + v2("ShadowOffset", "Offset", -1.0, 2.0, [0.5, 0.5]), + flt("Softness", "Softness", 0.0, 0.2, 0.0), + rgba("Color", "Color", "Red", "Green", "Blue", Some("Alpha"), [0.0, 0.0, 0.0, 1.0]), + int_enum("Output", "Output", &[(0, "Normal"), (1, "Shadow Only")], 0), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "Switch" => const { &[ + flt("Source", "Source", 0.0, 16.0, 0.0), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "Fuse.Switch" => const { &[ + flt("Which", "Which", 1.0, 16.0, 1.0), + ] }, + + // --- Transform & Warp --- "Transform" => const { &[ v2("Center", "Center", -1.0, 2.0, [0.5, 0.5]), v2("Pivot", "Pivot", -1.0, 2.0, [0.5, 0.5]), + boolean("UseSizeAndAspect", "Size/Aspect", true), flt("Size", "Size", 0.0, 5.0, 1.0), flt("Aspect", "Aspect", 0.1, 4.0, 1.0), + flt("XSize", "X Size", 0.0, 5.0, 1.0), + flt("YSize", "Y Size", 0.0, 5.0, 1.0), flt("Angle", "Angle", -360.0, 360.0, 0.0), boolean("FlipHoriz", "Flip Horiz", false), boolean("FlipVert", "Flip Vert", false), - fuid("Edges", "Edges", EDGES_MODES, "Canvas"), + boolean("InvertTransform", "Invert", false), + int_enum("Edges", "Edges", EDGES_INT, 0), + boolean("MultiplyByMask", "Mult by Mask", false), flt("Blend", "Blend", 0.0, 1.0, 1.0), ] }, + "Displace" => const { &[ + int_enum("Type", "Type", &[(0, "Radial"), (1, "XY")], 0), + flt("RefractionStrength", "Strength", -2.0, 2.0, 0.05), + flt("XRefraction", "X Refract", -1.0, 1.0, 0.0), + flt("YRefraction", "Y Refract", -1.0, 1.0, 0.0), + flt("XOffset", "X Offset", -1.0, 1.0, 0.0), + flt("YOffset", "Y Offset", -1.0, 1.0, 0.0), + flt("Spread", "Spread", 0.0, 1.0, 0.0), + flt("LightPower", "Light Power", -2.0, 2.0, 0.0), + flt("LightAngle", "Light Angle", -360.0, 360.0, 0.0), + v2("Center", "Center", -0.5, 1.5, [0.5, 0.5]), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "Vortex" => const { &[ + v2("Center", "Center", -0.5, 1.5, [0.5, 0.5]), + flt("Size", "Size", 0.01, 2.0, 0.5), + flt("Angle", "Angle", -720.0, 720.0, 0.0), + flt("Power", "Power", 0.0, 20.0, 5.0), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "Drip" => const { &[ + int_enum("Shape", "Shape", &[(0, "Circle"), (1, "Square"), (2, "Random"), (3, "Horizontal"), (4, "Vertical")], 0), + v2("Center", "Center", -0.5, 1.5, [0.5, 0.5]), + flt("Amplitude", "Amplitude", -1.0, 1.0, 0.1), + flt("Frequency", "Frequency", 0.0, 50.0, 10.0), + flt("Aspect", "Aspect", 0.1, 4.0, 1.0), + flt("Phase", "Phase", -10.0, 10.0, 0.0), + flt("Dampening", "Dampening", 0.0, 5.0, 0.0), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "Dent" => const { &[ + int_enum("Type", "Type", &[(0, "Dent"), (1, "Sine"), (2, "Pinch"), (3, "Punch"), (4, "Cosine")], 0), + v2("Center", "Center", -0.5, 1.5, [0.5, 0.5]), + flt("Size", "Size", 0.01, 2.0, 0.5), + flt("Strength", "Strength", -2.0, 2.0, 0.5), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "GridWarp" => const { &[ + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "PerspectivePositioner" => const { &[ + int_enum("MappingType", "Mapping", &[(0, "Linear"), (1, "Perspective")], 0), + v2("TopLeft", "Top Left", -0.5, 1.5, [0.0, 1.0]), + v2("TopRight", "Top Right", -0.5, 1.5, [1.0, 1.0]), + v2("BottomLeft", "Bottom Left", -0.5, 1.5, [0.0, 0.0]), + v2("BottomRight", "Bottom Right", -0.5, 1.5, [1.0, 0.0]), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + + // --- Blur, Glow & Film --- "Blur" => const { &[ fuid("Filter", "Filter", BLUR_FILTERS, "Fast Gaussian"), boolean("LockXY", "Lock X/Y", true), @@ -178,19 +298,82 @@ pub fn schema_for_kind(kind: &str) -> &'static [ParamSpec] { fuid("ClippingMode", "Clipping", CLIPPING_MODES, "Frame"), flt("Blend", "Blend", 0.0, 1.0, 1.0), ] }, + "DirectionalBlur" => const { &[ + int_enum("Type", "Type", &[(0, "Linear"), (1, "Radial"), (2, "Centered"), (3, "Zoom")], 0), + flt("Length", "Length", -0.5, 0.5, 0.02), + flt("Angle", "Angle", -360.0, 360.0, 0.0), + v2("Center", "Center", -0.5, 1.5, [0.5, 0.5]), + flt("Glow", "Glow", 0.0, 1.0, 0.0), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "VariBlur" => const { &[ + flt("XBlurSize", "Blur Size", 0.0, 100.0, 1.0), + flt("YBlurSize", "Y Blur Size", 0.0, 100.0, 1.0), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, "Glow" => const { &[ + fuid("Filter", "Filter", GLOW_FILTERS, "Gaussian"), + boolean("LockXY", "Lock X/Y", true), flt("XGlowSize", "Glow Size", 0.0, 100.0, 10.0), - flt("Glow", "Glow", 0.0, 2.0, 0.8), + flt("YGlowSize", "Y Glow Size", 0.0, 100.0, 10.0), + flt("Glow", "Glow", 0.0, 1.0, 0.8), + flt("RedScale", "Red Scale", 0.0, 5.0, 1.0), + flt("GreenScale", "Green Scale", 0.0, 5.0, 1.0), + flt("BlueScale", "Blue Scale", 0.0, 5.0, 1.0), + flt("AlphaScale", "Alpha Scale", 0.0, 5.0, 1.0), + boolean("Alpha", "Alpha", true), + fuid("ClippingMode", "Clipping", CLIPPING_MODES, "Frame"), flt("Blend", "Blend", 0.0, 1.0, 1.0), - fuid("Filter", "Filter", BLUR_FILTERS, "Fast Gaussian"), ] }, "SoftGlow" => const { &[ - fuid("Filter", "Filter", BLUR_FILTERS, "Fast Gaussian"), + fuid("Filter", "Filter", GLOW_FILTERS, "Gaussian"), flt("Threshold", "Threshold", 0.0, 1.0, 0.0), flt("Gain", "Gain", 0.0, 5.0, 2.0), + boolean("LockXY", "Lock X/Y", true), flt("XGlowSize", "Glow Size", 0.0, 100.0, 10.0), + flt("YGlowSize", "Y Glow Size", 0.0, 100.0, 10.0), + flt("RedScale", "Red Scale", 0.0, 5.0, 1.0), + flt("GreenScale", "Green Scale", 0.0, 5.0, 1.0), + flt("BlueScale", "Blue Scale", 0.0, 5.0, 1.0), + flt("AlphaScale", "Alpha Scale", 0.0, 5.0, 1.0), + boolean("Alpha", "Alpha", true), + fuid("ClippingMode", "Clipping", CLIPPING_MODES, "Frame"), flt("Blend", "Blend", 0.0, 1.0, 1.0), ] }, + "Sharpen" => const { &[ + boolean("LockAmountXY", "Lock X/Y", true), + flt("XAmount", "X Amount", 0.0, 50.0, 1.0), + flt("YAmount", "Y Amount", 0.0, 50.0, 1.0), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "ErodeDilate" => const { &[ + int_enum("Filter", "Filter", &[(0, "Box"), (1, "Bartlett"), (2, "Gaussian"), (3, "Circle")], 0), + boolean("LockXY", "Lock X/Y", true), + flt("XAmount", "X Amount", -0.2, 0.2, 0.0), + flt("YAmount", "Y Amount", -0.2, 0.2, 0.0), + boolean("Red", "Red", true), + boolean("Green", "Green", true), + boolean("Blue", "Blue", true), + boolean("Alpha", "Alpha", true), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "FilmGrain" => const { &[ + flt("MasterStrength", "Strength", 0.0, 1.0, 0.05), + boolean("LockSize", "Lock Size", true), + flt("MasterXSize", "Size", 0.1, 10.0, 1.0), + flt("MasterYSize", "Y Size", 0.1, 10.0, 1.0), + flt("MasterRoughness", "Roughness", 0.0, 1.0, 0.0), + boolean("Monochrome", "Monochrome", true), + boolean("LogProcessing", "Log Process", true), + boolean("TimeLockSeed", "Lock Seed", false), + flt("Seed", "Seed", 0.0, 10000.0, 0.0), + flt("RedStrength", "Red Str", 0.0, 2.0, 1.0), + flt("GreenStrength", "Green Str", 0.0, 2.0, 1.0), + flt("BlueStrength", "Blue Str", 0.0, 2.0, 1.0), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + + // --- Color & Keying --- "BrightnessContrast" => const { &[ flt("Gain", "Gain", 0.0, 5.0, 1.0), flt("Lift", "Lift", -1.0, 1.0, 0.0), @@ -199,6 +382,7 @@ pub fn schema_for_kind(kind: &str) -> &'static [ParamSpec] { flt("Brightness", "Brightness", -1.0, 1.0, 0.0), flt("Saturation", "Saturation", 0.0, 4.0, 1.0), boolean("PreDividePostMultiply", "Pre-Div/Post", false), + boolean("MultiplyByMask", "Mult by Mask", false), flt("Blend", "Blend", 0.0, 1.0, 1.0), ] }, "ColorCorrector" => const { &[ @@ -210,122 +394,301 @@ pub fn schema_for_kind(kind: &str) -> &'static [ParamSpec] { flt("MasterRGBContrast", "Contrast", 0.0, 3.0, 1.0), flt("MasterRGBBrightness", "Brightness", -1.0, 1.0, 0.0), boolean("PreDividePostMultiply", "Pre-Div/Post", false), + boolean("MultiplyByMask", "Mult by Mask", false), flt("Blend", "Blend", 0.0, 1.0, 1.0), ] }, + "ColorGain" => const { &[ + boolean("LockRGB", "Lock RGB", false), + flt("GainRed", "Gain Red", 0.0, 5.0, 1.0), + flt("GainGreen", "Gain Green", 0.0, 5.0, 1.0), + flt("GainBlue", "Gain Blue", 0.0, 5.0, 1.0), + flt("LiftRed", "Lift Red", -1.0, 1.0, 0.0), + flt("LiftGreen", "Lift Green", -1.0, 1.0, 0.0), + flt("LiftBlue", "Lift Blue", -1.0, 1.0, 0.0), + flt("GammaRed", "Gamma Red", 0.05, 5.0, 1.0), + flt("GammaGreen", "Gamma Green", 0.05, 5.0, 1.0), + flt("GammaBlue", "Gamma Blue", 0.05, 5.0, 1.0), + flt("SaturationRed", "Sat Red", 0.0, 4.0, 1.0), + flt("SaturationGreen", "Sat Green", 0.0, 4.0, 1.0), + flt("SaturationBlue", "Sat Blue", 0.0, 4.0, 1.0), + boolean("PreDividePostMultiply", "Pre-Div/Post", false), + boolean("MultiplyByMask", "Mult by Mask", false), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "HueCurves" => const { &[ + boolean("PreDividePostMultiply", "Pre-Div/Post", false), + boolean("MultiplyByMask", "Mult by Mask", false), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "GamutConvert" => const { &[ + fuid("SourceSpace", "Source Space", GAMUT_SPACES, "NoChange"), + boolean("RemoveGamma", "Remove Gamma", true), + fuid("OutputSpace", "Output Space", GAMUT_SPACES, "NoChange"), + boolean("AddGamma", "Add Gamma", true), + boolean("PreDividePostMultiply", "Pre-Div/Post", false), + boolean("MultiplyByMask", "Mult by Mask", false), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "UltraKeyer" => const { &[ + rgba("KeyColor", "Key Color", "BackgroundRed", "BackgroundGreen", "BackgroundBlue", None, [0.0, 1.0, 0.0, 1.0]), + flt("MatteSeparation", "Matte Sep", 0.0, 1.0, 0.0), + flt("LowMatteThreshold", "Matte Low", 0.0, 1.0, 0.0), + flt("High", "Matte High", 0.0, 1.0, 1.0), + flt("SpillSuppression", "Spill", 0.0, 1.0, 0.0), + boolean("InvertMatte", "Invert Matte", false), + boolean("PostMultiplyImage", "Post-Multiply", true), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "Custom" => const { &[ + text("RedExpression", "Red Expr", "r1"), + text("GreenExpression", "Green Expr", "g1"), + text("BlueExpression", "Blue Expr", "b1"), + text("AlphaExpression", "Alpha Expr", "a1"), + flt("NumberIn1", "Number 1", -10.0, 10.0, 0.0), + flt("NumberIn2", "Number 2", -10.0, 10.0, 0.0), + flt("NumberIn3", "Number 3", -10.0, 10.0, 0.0), + flt("NumberIn4", "Number 4", -10.0, 10.0, 0.0), + flt("NumberIn5", "Number 5", -10.0, 10.0, 0.0), + flt("NumberIn6", "Number 6", -10.0, 10.0, 0.0), + flt("NumberIn7", "Number 7", -10.0, 10.0, 0.0), + flt("NumberIn8", "Number 8", -10.0, 10.0, 0.0), + v2("PointIn1", "Point 1", -1.0, 2.0, [0.5, 0.5]), + v2("PointIn2", "Point 2", -1.0, 2.0, [0.5, 0.5]), + v2("PointIn3", "Point 3", -1.0, 2.0, [0.5, 0.5]), + v2("PointIn4", "Point 4", -1.0, 2.0, [0.5, 0.5]), + boolean("ProcessRed", "Proc Red", true), + boolean("ProcessGreen", "Proc Green", true), + boolean("ProcessBlue", "Proc Blue", true), + boolean("ProcessAlpha", "Proc Alpha", true), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + + // --- Generators & I/O --- "Background" => const { &[ - ParamSpec { - name: "TopLeftColor", - label: "Color", - kind: ParamKind::Color { - r: "TopLeftRed", - g: "TopLeftGreen", - b: "TopLeftBlue", - a: Some("TopLeftAlpha"), - default: [0.0, 0.0, 0.0, 1.0], - }, - }, + fuid("Type", "Type", &["Solid", "Horizontal", "Vertical", "Corner", "Gradient"], "Solid"), + fuid("GradientType", "Grad Type", &["Linear", "Radial", "Angle", "Reflect"], "Linear"), + rgba("TopLeftColor", "Color", "TopLeftRed", "TopLeftGreen", "TopLeftBlue", Some("TopLeftAlpha"), [0.0, 0.0, 0.0, 1.0]), flt("Width", "Width", 1.0, 7680.0, 1920.0), flt("Height", "Height", 1.0, 4320.0, 1080.0), ] }, - "TextPlus" => const { &[ - ParamSpec { - name: "StyledText", - label: "Styled Text", - kind: ParamKind::Text { default: "" }, - }, - ParamSpec { - name: "Font", - label: "Font", - kind: ParamKind::Text { default: "Open Sans" }, - }, - flt("Size", "Size", 0.005, 1.0, 0.08), - flt("Tracking", "Tracking", 0.0, 4.0, 1.0), - v2("Center", "Center", -1.0, 2.0, [0.5, 0.5]), - ParamSpec { - name: "TextColor", - label: "Text Color", - kind: ParamKind::Color { - r: "Red1", - g: "Green1", - b: "Blue1", - a: Some("Alpha1"), - default: [1.0, 1.0, 1.0, 1.0], - }, - }, - flt("Blend", "Blend", 0.0, 1.0, 1.0), - ] }, - "EllipseMask" => const { &[ - flt("Level", "Level", 0.0, 1.0, 1.0), - flt("SoftEdge", "Soft Edge", 0.0, 0.5, 0.0), - flt("BorderWidth", "Border", -0.2, 0.2, 0.0), - boolean("Solid", "Solid", true), - boolean("Invert", "Invert", false), - v2("Center", "Center", -0.5, 1.5, [0.5, 0.5]), - flt("Width", "Width", 0.0, 2.0, 0.5), - flt("Height", "Height", 0.0, 2.0, 0.5), - flt("Angle", "Angle", -360.0, 360.0, 0.0), - ] }, - "RectangleMask" => const { &[ - flt("Level", "Level", 0.0, 1.0, 1.0), - flt("SoftEdge", "Soft Edge", 0.0, 0.5, 0.0), - flt("CornerRadius", "Corner", 0.0, 1.0, 0.0), - boolean("Solid", "Solid", true), - boolean("Invert", "Invert", false), - v2("Center", "Center", -0.5, 1.5, [0.5, 0.5]), - flt("Width", "Width", 0.0, 2.0, 0.5), - flt("Height", "Height", 0.0, 2.0, 0.5), - flt("Angle", "Angle", -360.0, 360.0, 0.0), - ] }, - "Displace" => const { &[ - flt("XRefraction", "X Refract", -1.0, 1.0, 0.0), - flt("YRefraction", "Y Refract", -1.0, 1.0, 0.0), - flt("RefractionStrength", "Strength", -2.0, 2.0, 0.0), - flt("LightAngle", "Light Angle", -360.0, 360.0, 0.0), - flt("Blend", "Blend", 0.0, 1.0, 1.0), - ] }, - "Vortex" => const { &[ - v2("Center", "Center", -0.5, 1.5, [0.5, 0.5]), - flt("Size", "Size", 0.0, 2.0, 0.5), - flt("Angle", "Angle", -720.0, 720.0, 90.0), - flt("Power", "Power", 0.1, 5.0, 1.0), - flt("Blend", "Blend", 0.0, 1.0, 1.0), - ] }, "FastNoise" => const { &[ flt("Detail", "Detail", 0.0, 10.0, 2.0), flt("Contrast", "Contrast", 0.0, 5.0, 1.0), flt("Brightness", "Brightness", -1.0, 1.0, 0.0), + boolean("LockXY", "Lock X/Y", true), flt("XScale", "Scale", 0.01, 50.0, 2.0), + flt("YScale", "Y Scale", 0.01, 50.0, 2.0), + flt("Angle", "Angle", -360.0, 360.0, 0.0), flt("Seethe", "Seethe", 0.0, 100.0, 0.0), flt("SeetheRate", "Seethe Rate", 0.0, 2.0, 0.0), + boolean("Discontinuous", "Discontinuous", false), + boolean("Inverted", "Inverted", false), v2("Center", "Center", -2.0, 3.0, [0.5, 0.5]), + rgba("Color1", "Color 1", "Color1Red", "Color1Green", "Color1Blue", Some("Color1Alpha"), [0.0, 0.0, 0.0, 0.0]), + rgba("Color2", "Color 2", "Color2Red", "Color2Green", "Color2Blue", Some("Color2Alpha"), [1.0, 1.0, 1.0, 1.0]), + flt("Width", "Width", 1.0, 7680.0, 1920.0), + flt("Height", "Height", 1.0, 4320.0, 1080.0), ] }, - "UltraKeyer" => const { &[ - ParamSpec { - name: "KeyColor", - label: "Key Color", - kind: ParamKind::Color { - r: "BackgroundRed", - g: "BackgroundGreen", - b: "BackgroundBlue", - a: None, - default: [0.0, 1.0, 0.0, 1.0], - }, - }, - flt("MatteThresholdLow", "Matte Low", 0.0, 1.0, 0.0), - flt("MatteThresholdHigh", "Matte High", 0.0, 1.0, 1.0), - flt("SpillSuppression", "Spill", 0.0, 1.0, 0.0), - boolean("PostMultiplyImage", "Post-Multiply", true), + "DaySky" => const { &[ + boolean("UseFrameFormatSettings", "Frame Format", false), + flt("Width", "Width", 1.0, 7680.0, 1920.0), + flt("Height", "Height", 1.0, 4320.0, 1080.0), + flt("Latitude", "Latitude", -90.0, 90.0, 43.65), + flt("Longitude", "Longitude", -180.0, 180.0, -79.38), + fuid("Month", "Month", MONTHS, "January"), + flt("Day", "Day", 1.0, 31.0, 1.0), + flt("Time", "Time (Hr)", 0.0, 24.0, 12.0), + flt("Turbidity", "Turbidity", 0.0, 1.0, 0.0), + flt("Exposure", "Exposure", 0.0, 5.0, 0.72), + flt("Horizon.Brightness", "Horiz Bright", 0.0, 5.0, 1.0), + flt("Horizon.Luminance", "Horiz Luma", 0.0, 5.0, 1.0), + flt("Circumsolar.Intensity", "Sun Int", 0.0, 5.0, 1.0), + flt("Circumsolar.Width", "Sun Width", 0.0, 5.0, 1.0), + flt("BackscatteredLight", "Backscatter", 0.0, 5.0, 1.0), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "TextPlus" => const { &[ + text("StyledText", "Styled Text", ""), + text("Font", "Font", "Helvetica Neue"), + text("Style", "Style", "Regular"), + flt("Size", "Size", 0.005, 1.0, 0.08), + flt("CharacterSpacing", "Tracking", 0.0, 4.0, 1.0), + flt("LineSpacing", "Line Space", 0.0, 4.0, 1.0), + v2("Center", "Center", -1.0, 2.0, [0.5, 0.5]), + flt("HorizontalLeftCenterRight", "H Align", -1.0, 1.0, 0.0), + flt("VerticalTopCenterBottom", "V Align", -1.0, 1.0, 0.0), + rgba("TextColor", "Text Color", "Red1", "Green1", "Blue1", Some("Alpha1"), [1.0, 1.0, 1.0, 1.0]), flt("Blend", "Blend", 0.0, 1.0, 1.0), ] }, "Loader" => const { &[ flt("GlobalIn", "Global In", 0.0, 10000.0, 0.0), flt("GlobalOut", "Global Out", 0.0, 10000.0, 100.0), + int_enum("MissingFrames", "Missing", &[(0, "Fail"), (1, "Output Color"), (2, "Hold Previous")], 0), boolean("Loop", "Loop", false), boolean("Reverse", "Reverse", false), ] }, + "Saver" => const { &[ + boolean("CreateDir", "Create Dir", true), + boolean("SetSequenceStart", "Seq Start", false), + flt("SequenceStartFrame", "Start Frame", 0.0, 10000.0, 0.0), + boolean("ProcessWhenBlendIs00", "Proc Blend 0", false), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "TimeStretcher" => const { &[ + flt("SourceTime", "Source Time", 0.0, 10000.0, 0.0), + int_enum("InterpolateBetweenFrames", "Interpolate", &[(0, "Nearest"), (1, "Blend"), (2, "Flow")], 1), + ] }, + "TimeSpeed" => const { &[ + flt("Speed", "Speed", -10.0, 10.0, 1.0), + flt("Delay", "Delay", -1000.0, 1000.0, 0.0), + ] }, + + // --- Paint & Masks --- + "Paint" => const { &[ + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "PaintMask" => const { &[ + fuid("PaintMode", "Paint Mode", PAINT_MODES, "Merge"), + fuid("Filter", "Filter", BLUR_FILTERS, "Fast Gaussian"), + flt("SoftEdge", "Soft Edge", 0.0, 0.5, 0.0), + flt("Level", "Level", 0.0, 1.0, 1.0), + boolean("Invert", "Invert", false), + fuid("ClippingMode", "Clipping", CLIPPING_MODES, "Frame"), + flt("MaskWidth", "Mask Width", 1.0, 7680.0, 1920.0), + flt("MaskHeight", "Mask Height", 1.0, 4320.0, 1080.0), + ] }, + "EllipseMask" => const { &[ + fuid("PaintMode", "Paint Mode", PAINT_MODES, "Merge"), + flt("Level", "Level", 0.0, 1.0, 1.0), + fuid("Filter", "Filter", BLUR_FILTERS, "Fast Gaussian"), + flt("SoftEdge", "Soft Edge", 0.0, 0.5, 0.0), + flt("BorderWidth", "Border", -0.2, 0.2, 0.0), + boolean("Solid", "Solid", true), + boolean("Invert", "Invert", false), + v2("Center", "Center", -0.5, 1.5, [0.5, 0.5]), + flt("Width", "Width", 0.0, 2.0, 0.5), + flt("Height", "Height", 0.0, 2.0, 0.5), + flt("Angle", "Angle", -360.0, 360.0, 0.0), + fuid("ClippingMode", "Clipping", CLIPPING_MODES, "Frame"), + ] }, + "RectangleMask" => const { &[ + fuid("PaintMode", "Paint Mode", PAINT_MODES, "Merge"), + flt("Level", "Level", 0.0, 1.0, 1.0), + fuid("Filter", "Filter", BLUR_FILTERS, "Fast Gaussian"), + flt("SoftEdge", "Soft Edge", 0.0, 0.5, 0.0), + flt("BorderWidth", "Border", -0.2, 0.2, 0.0), + flt("CornerRadius", "Corner", 0.0, 1.0, 0.0), + boolean("Solid", "Solid", true), + boolean("Invert", "Invert", false), + v2("Center", "Center", -0.5, 1.5, [0.5, 0.5]), + flt("Width", "Width", 0.0, 2.0, 0.5), + flt("Height", "Height", 0.0, 2.0, 0.5), + flt("Angle", "Angle", -360.0, 360.0, 0.0), + fuid("ClippingMode", "Clipping", CLIPPING_MODES, "Frame"), + ] }, + "BitmapMask" => const { &[ + fuid("Channel", "Channel", MASK_CHANNELS, "Alpha"), + flt("Low", "Low", 0.0, 1.0, 0.0), + flt("High", "High", 0.0, 1.0, 1.0), + fuid("Filter", "Filter", BLUR_FILTERS, "Fast Gaussian"), + flt("SoftEdge", "Soft Edge", 0.0, 0.5, 0.0), + flt("Level", "Level", 0.0, 1.0, 1.0), + boolean("Invert", "Invert", false), + boolean("FitInput", "Fit Input", false), + v2("Center", "Center", -0.5, 1.5, [0.5, 0.5]), + fuid("PaintMode", "Paint Mode", PAINT_MODES, "Merge"), + fuid("ClippingMode", "Clipping", CLIPPING_MODES, "Frame"), + fuid("OutputSize", "Output Size", &["Default", "Custom"], "Default"), + ] }, + "WandMask" => const { &[ + v2("SelectionPoint", "Seed Point", 0.0, 1.0, [0.5, 0.5]), + flt("Range", "Range", 0.0, 1.0, 0.1), + flt("RangeSoftEdge", "Range Soft", 0.0, 1.0, 0.0), + int_enum("ColorSpace", "Color Space", &[(0, "RGB"), (1, "YUV")], 0), + fuid("Filter", "Filter", BLUR_FILTERS, "Fast Gaussian"), + flt("SoftEdge", "Soft Edge", 0.0, 0.5, 0.0), + flt("Level", "Level", 0.0, 1.0, 1.0), + boolean("Invert", "Invert", false), + fuid("PaintMode", "Paint Mode", PAINT_MODES, "Merge"), + fuid("ClippingMode", "Clipping", CLIPPING_MODES, "Frame"), + ] }, + + // --- Vector Shapes --- + "sRender" => const { &[ + flt("Width", "Width", 1.0, 7680.0, 1920.0), + flt("Height", "Height", 1.0, 4320.0, 1080.0), + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "sEllipse" => const { &[ + flt("Width", "Width", 0.0, 2.0, 0.5), + flt("Height", "Height", 0.0, 2.0, 0.5), + flt("Translate.X", "Offset X", -1.0, 1.0, 0.0), + flt("Translate.Y", "Offset Y", -1.0, 1.0, 0.0), + flt("Angle", "Angle", -360.0, 360.0, 0.0), + boolean("Solid", "Solid", true), + flt("BorderWidth", "Border", 0.0, 0.2, 0.01), + rgba("Color", "Color", "Red", "Green", "Blue", Some("Alpha"), [1.0, 1.0, 1.0, 1.0]), + ] }, + "sRectangle" => const { &[ + flt("Width", "Width", 0.0, 2.0, 0.5), + flt("Height", "Height", 0.0, 2.0, 0.5), + flt("CornerRadius", "Corner", 0.0, 1.0, 0.0), + flt("Translate.X", "Offset X", -1.0, 1.0, 0.0), + flt("Translate.Y", "Offset Y", -1.0, 1.0, 0.0), + flt("Angle", "Angle", -360.0, 360.0, 0.0), + boolean("Solid", "Solid", true), + flt("BorderWidth", "Border", 0.0, 0.2, 0.01), + int_enum("JoinStyle", "Join", JOIN_STYLES, 2), + rgba("Color", "Color", "Red", "Green", "Blue", Some("Alpha"), [1.0, 1.0, 1.0, 1.0]), + ] }, + "sNGon" => const { &[ + flt("Sides", "Sides", 3.0, 64.0, 6.0), + flt("Width", "Width", 0.0, 2.0, 0.5), + flt("Height", "Height", 0.0, 2.0, 0.5), + flt("Translate.X", "Offset X", -1.0, 1.0, 0.0), + flt("Translate.Y", "Offset Y", -1.0, 1.0, 0.0), + flt("Angle", "Angle", -360.0, 360.0, 0.0), + boolean("Solid", "Solid", true), + flt("BorderWidth", "Border", 0.0, 0.2, 0.01), + int_enum("JoinStyle", "Join", JOIN_STYLES, 2), + rgba("Color", "Color", "Red", "Green", "Blue", Some("Alpha"), [1.0, 1.0, 1.0, 1.0]), + ] }, + "sBoolean" => const { &[ + fuid("Operation", "Operation", &["Intersection", "Union", "Subtract", "Xor"], "Intersection"), + rgba("Color", "Color", "Red", "Green", "Blue", Some("Alpha"), [1.0, 1.0, 1.0, 1.0]), + ] }, + "sTransform" => const { &[ + flt("XOffset", "X Offset", -1.0, 1.0, 0.0), + flt("YOffset", "Y Offset", -1.0, 1.0, 0.0), + flt("XPivot", "X Pivot", -1.0, 1.0, 0.0), + flt("YPivot", "Y Pivot", -1.0, 1.0, 0.0), + flt("Scale", "Scale", 0.0, 5.0, 1.0), + flt("XSize", "X Size", 0.0, 5.0, 1.0), + flt("YSize", "Y Size", 0.0, 5.0, 1.0), + flt("ZRotation", "Rotation", -360.0, 360.0, 0.0), + ] }, + "sMerge" => const { &[ + flt("Blend", "Blend", 0.0, 1.0, 1.0), + ] }, + "sOutline" => const { &[ + flt("Thickness", "Thickness", 0.0, 0.2, 0.01), + int_enum("JoinStyle", "Join", JOIN_STYLES, 2), + int_enum("CapStyle", "Cap", CAP_STYLES, 0), + ] }, + "sGrid" => const { &[ + flt("CellsX", "Cells X", 1.0, 32.0, 3.0), + flt("CellsY", "Cells Y", 1.0, 32.0, 3.0), + flt("XOffset", "X Offset", -2.0, 2.0, 0.2), + flt("YOffset", "Y Offset", -2.0, 2.0, 0.2), + ] }, + + // --- 3D Scene, Lights & Materials --- "Camera3D" => const { &[ - flt("FLength", "Focal Len", 5.0, 200.0, 24.0), - flt("PlaneOfFocus", "Focus Dist", 0.1, 100.0, 5.0), + flt("FLength", "Focal Len", 5.0, 200.0, 35.0), + flt("ApertureW", "Gate W", 0.1, 5.0, 1.4173236), + flt("ApertureH", "Gate H", 0.1, 5.0, 0.9448824), + fuid("ResolutionGateFit", "Gate Fit", GATE_FITS, "Height"), + flt("PlaneOfFocus", "Focus Dist", 0.01, 100.0, 5.0), flt("Transform3DOp.Translate.X", "Trans X", -50.0, 50.0, 0.0), flt("Transform3DOp.Translate.Y", "Trans Y", -50.0, 50.0, 0.0), flt("Transform3DOp.Translate.Z", "Trans Z", -50.0, 50.0, 5.0), @@ -335,13 +698,103 @@ pub fn schema_for_kind(kind: &str) -> &'static [ParamSpec] { ] }, "Shape3D" => const { &[ fuid("Shape", "Shape", SHAPE3D_TYPES, "SurfacePlaneInputs"), - flt("SurfacePlaneInputs.Width", "Width", 0.01, 20.0, 1.0), - flt("SurfacePlaneInputs.Height", "Height", 0.01, 20.0, 1.0), + flt("SurfacePlaneInputs.Width", "Plane W", 0.01, 20.0, 1.0), + flt("SurfacePlaneInputs.SubdivisionWidth", "Plane Sub", 1.0, 64.0, 10.0), + flt("SurfaceSphereInputs.Radius", "Sphere R", 0.01, 20.0, 1.0), + flt("SurfaceCylinderInputs.Radius", "Cyl R", 0.01, 20.0, 1.0), + flt("SurfaceCylinderInputs.Height", "Cyl H", 0.01, 20.0, 2.0), + flt("SurfaceCubeInputs.Width", "Cube W", 0.01, 20.0, 1.0), flt("Transform3DOp.Translate.X", "Trans X", -50.0, 50.0, 0.0), flt("Transform3DOp.Translate.Y", "Trans Y", -50.0, 50.0, 0.0), flt("Transform3DOp.Translate.Z", "Trans Z", -50.0, 50.0, 0.0), + flt("Transform3DOp.Rotate.X", "Rot X", -180.0, 180.0, 0.0), + flt("Transform3DOp.Rotate.Y", "Rot Y", -180.0, 180.0, 0.0), + flt("Transform3DOp.Rotate.Z", "Rot Z", -180.0, 180.0, 0.0), flt("Transform3DOp.Scale.X", "Scale", 0.01, 20.0, 1.0), ] }, + "Cube3D" => const { &[ + flt("SurfaceCubeInputs.Width", "Width", 0.01, 20.0, 1.0), + flt("SurfaceCubeInputs.SubdivisionWidth", "Subdivs", 1.0, 64.0, 10.0), + boolean("SurfaceCubeInputs.Wireframe", "Wireframe", false), + boolean("SurfaceCubeInputs.Visibility.IsVisible", "Visible", true), + boolean("SurfaceCubeInputs.Lighting.IsAffectedByLights", "Lit", true), + flt("Transform3DOp.Translate.X", "Trans X", -50.0, 50.0, 0.0), + flt("Transform3DOp.Translate.Y", "Trans Y", -50.0, 50.0, 0.0), + flt("Transform3DOp.Translate.Z", "Trans Z", -50.0, 50.0, 0.0), + flt("Transform3DOp.Rotate.X", "Rot X", -180.0, 180.0, 0.0), + flt("Transform3DOp.Rotate.Y", "Rot Y", -180.0, 180.0, 0.0), + flt("Transform3DOp.Rotate.Z", "Rot Z", -180.0, 180.0, 0.0), + flt("Transform3DOp.Scale.X", "Scale", 0.01, 20.0, 1.0), + ] }, + "SurfaceFBXMesh" => const { &[ + text("ImportFile", "FBX / OBJ", ""), + text("ObjName", "Object Name", ""), + flt("ScaleFileUnitsBy", "Scale Units", 0.001, 100.0, 1.0), + boolean("SurfaceFBXInputs.Visibility.IsVisible", "Visible", true), + boolean("SurfaceFBXInputs.Lighting.IsAffectedByLights", "Lit", true), + flt("Transform3DOp.Translate.X", "Trans X", -50.0, 50.0, 0.0), + flt("Transform3DOp.Translate.Y", "Trans Y", -50.0, 50.0, 0.0), + flt("Transform3DOp.Translate.Z", "Trans Z", -50.0, 50.0, 0.0), + flt("Transform3DOp.Rotate.X", "Rot X", -180.0, 180.0, 0.0), + flt("Transform3DOp.Rotate.Y", "Rot Y", -180.0, 180.0, 0.0), + flt("Transform3DOp.Rotate.Z", "Rot Z", -180.0, 180.0, 0.0), + flt("Transform3DOp.Scale.X", "Scale", 0.01, 20.0, 1.0), + ] }, + "LightPoint" => const { &[ + boolean("Enabled", "Enabled", true), + rgba("Color", "Color", "Red", "Green", "Blue", None, [1.0, 1.0, 1.0, 1.0]), + flt("Intensity", "Intensity", 0.0, 20.0, 1.0), + int_enum("DecayType", "Decay Type", DECAY_TYPES, 0), + flt("Transform3DOp.Translate.X", "Trans X", -50.0, 50.0, 0.0), + flt("Transform3DOp.Translate.Y", "Trans Y", -50.0, 50.0, 0.0), + flt("Transform3DOp.Translate.Z", "Trans Z", -50.0, 50.0, 0.0), + ] }, + "LightSpot" => const { &[ + boolean("Enabled", "Enabled", true), + rgba("Color", "Color", "Red", "Green", "Blue", None, [1.0, 1.0, 1.0, 1.0]), + flt("Intensity", "Intensity", 0.0, 20.0, 1.0), + flt("ConeAngle", "Cone Angle", 1.0, 179.0, 40.0), + flt("PenumbraAngle", "Penumbra", -45.0, 45.0, 0.0), + int_enum("DecayType", "Decay Type", DECAY_TYPES, 0), + flt("Transform3DOp.Translate.X", "Trans X", -50.0, 50.0, 0.0), + flt("Transform3DOp.Translate.Y", "Trans Y", -50.0, 50.0, 0.0), + flt("Transform3DOp.Translate.Z", "Trans Z", -50.0, 50.0, 0.0), + flt("Transform3DOp.Rotate.X", "Rot X", -180.0, 180.0, 0.0), + flt("Transform3DOp.Rotate.Y", "Rot Y", -180.0, 180.0, 0.0), + flt("Transform3DOp.Rotate.Z", "Rot Z", -180.0, 180.0, 0.0), + ] }, + "LightDirectional" => const { &[ + boolean("Enabled", "Enabled", true), + rgba("Color", "Color", "Red", "Green", "Blue", None, [1.0, 1.0, 1.0, 1.0]), + flt("Intensity", "Intensity", 0.0, 20.0, 1.0), + flt("Transform3DOp.Rotate.X", "Rot X", -180.0, 180.0, 0.0), + flt("Transform3DOp.Rotate.Y", "Rot Y", -180.0, 180.0, 0.0), + flt("Transform3DOp.Rotate.Z", "Rot Z", -180.0, 180.0, 0.0), + ] }, + "LightAmbient" => const { &[ + boolean("Enabled", "Enabled", true), + rgba("Color", "Color", "Red", "Green", "Blue", None, [1.0, 1.0, 1.0, 1.0]), + flt("Intensity", "Intensity", 0.0, 10.0, 1.0), + ] }, + "MtlBlinn" | "MtlPhong" => const { &[ + rgba("Diffuse", "Diffuse", "Diffuse.Color.Red", "Diffuse.Color.Green", "Diffuse.Color.Blue", Some("Diffuse.Opacity"), [1.0, 1.0, 1.0, 1.0]), + rgba("Specular", "Specular", "Specular.Color.Red", "Specular.Color.Green", "Specular.Color.Blue", None, [1.0, 1.0, 1.0, 1.0]), + flt("Specular.Intensity", "Spec Int", 0.0, 4.0, 1.0), + flt("Specular.Exponent", "Spec Exp", 1.0, 200.0, 50.0), + ] }, + "MtlCookTorrance" => const { &[ + rgba("Diffuse", "Diffuse", "Diffuse.Color.Red", "Diffuse.Color.Green", "Diffuse.Color.Blue", Some("Diffuse.Opacity"), [1.0, 1.0, 1.0, 1.0]), + rgba("Specular", "Specular", "Specular.Color.Red", "Specular.Color.Green", "Specular.Color.Blue", None, [1.0, 1.0, 1.0, 1.0]), + flt("Specular.Intensity", "Spec Int", 0.0, 4.0, 1.0), + flt("Specular.Roughness", "Roughness", 0.05, 1.0, 0.6), + ] }, + "MtlWard" => const { &[ + rgba("Diffuse", "Diffuse", "Diffuse.Color.Red", "Diffuse.Color.Green", "Diffuse.Color.Blue", Some("Diffuse.Opacity"), [1.0, 1.0, 1.0, 1.0]), + rgba("Specular", "Specular", "Specular.Color.Red", "Specular.Color.Green", "Specular.Color.Blue", None, [1.0, 1.0, 1.0, 1.0]), + flt("Specular.Intensity", "Spec Int", 0.0, 4.0, 1.0), + flt("Specular.SpreadU", "Spread U", 0.01, 1.0, 0.25), + flt("Specular.SpreadV", "Spread V", 0.01, 1.0, 0.25), + ] }, _ => &[], } } diff --git a/crates/app/src/inspector/widgets.rs b/crates/app/src/inspector/widgets.rs index 31f32b009a1a74b82d8a0f2ac2eaac7323d652b5..a67502fe1d182c0f9066ebffab98bad3ab1f2c56 100644 --- a/crates/app/src/inspector/widgets.rs +++ b/crates/app/src/inspector/widgets.rs @@ -111,6 +111,9 @@ impl InspectorState { ParamKind::Enum { options, default } => { self.render_enum_row(ui, comp, history, node_id, spec.name, spec.label, options, default, actions); } + ParamKind::IntEnum { options, default } => { + self.render_int_enum_row(ui, comp, history, node_id, spec.name, spec.label, options, default, actions); + } ParamKind::Color { r, g, b, a, default } => { self.render_color_group( ui, @@ -501,6 +504,59 @@ impl InspectorState { .static_str(input_name) .unwrap_or(default) .to_owned(); + let idx = options.iter().position(|&o| o == cur).unwrap_or(0); + if let Some(next_idx) = self.render_combo_row(ui, node_id, input_name, label, &cur, idx, options.len()) { + history.push_snapshot(comp, format!("Set {label}")); + comp.set_input_value(node_id, input_name, ParamValue::FuId(options[next_idx].to_owned())); + actions.push(InspectorAction::ParamEdited(node_id)); + } + } + + #[allow(clippy::too_many_arguments)] + fn render_int_enum_row( + &mut self, + ui: &mut ui::Ui, + comp: &mut Comp, + history: &mut CompHistory, + node_id: NodeId, + input_name: &str, + label: &str, + options: &'static [(i32, &'static str)], + default: i32, + actions: &mut Vec, + ) { + let cur_val = comp + .node(node_id) + .static_number(input_name) + .map(|v| v.round() as i32) + .unwrap_or(default); + let idx = options.iter().position(|&(v, _)| v == cur_val).unwrap_or(0); + let fallback_label; + let cur_label = match options.iter().find(|&&(v, _)| v == cur_val) { + Some(&(_, name)) => name, + None => { + fallback_label = format!("{cur_val}"); + &fallback_label + } + }; + if let Some(next_idx) = self.render_combo_row(ui, node_id, input_name, label, cur_label, idx, options.len()) { + history.push_snapshot(comp, format!("Set {label}")); + comp.set_input_value(node_id, input_name, ParamValue::Number(f64::from(options[next_idx].0))); + actions.push(InspectorAction::ParamEdited(node_id)); + } + } + + #[allow(clippy::too_many_arguments)] + fn render_combo_row( + &self, + ui: &mut ui::Ui, + node_id: NodeId, + input_name: &str, + label: &str, + cur_label: &str, + cur_idx: usize, + option_count: usize, + ) -> Option { let p = self.palette; ui.open( @@ -523,7 +579,7 @@ impl InspectorState { ..ui::Spec::default() }, ); - let btn_lbl = format!("{cur} ▾"); + let btn_lbl = format!("{cur_label} ▾"); let sig = ui.leaf( ("enum", node_id.0, input_name), ui::Spec { @@ -541,18 +597,17 @@ impl InspectorState { ..ui::Spec::default() }, ); - if sig.clicked && !options.is_empty() { - let idx = options.iter().position(|&o| o == cur).unwrap_or(0); - let next_idx = if ui.modifiers().shift_key() { - (idx + options.len() - 1) % options.len() + let next = if sig.clicked && option_count > 0 { + Some(if ui.modifiers().shift_key() { + (cur_idx + option_count - 1) % option_count } else { - (idx + 1) % options.len() - }; - history.push_snapshot(comp, format!("Set {label}")); - comp.set_input_value(node_id, input_name, ParamValue::FuId(options[next_idx].to_owned())); - actions.push(InspectorAction::ParamEdited(node_id)); - } + (cur_idx + 1) % option_count + }) + } else { + None + }; ui.close(); + next } #[allow(clippy::too_many_arguments)]