M9.12: effect parameter fidelity – all categories

Align every effect's display name, category, parameter names, order,
twirl-down groups, popup options, units, defaults and ranges with the
public After Effects effect reference, and implement controls that were
ignored or missing where cheap. One commit because the categories share
the registry, migration tables and GPU kernels (only green states).

Infrastructure
- effects::migrate: saved instances are upgraded on project open
  (Session::replace_project → upgrade_effects): renamed ids
  (PARAM_ID_ALIASES), params moved into twirl-down groups, popup values
  remapped by label (POPUP_LABEL_ALIASES), refreshed names/UI hints,
  added params created with legacy_default values that keep old renders.
- flatten_params also keys nested props by match path (group/param), so
  effects declare grouped params with `group/param` ids; layer-source
  companions sit next to grouped layer params.
- lookup() resolves old effect names (EFFECT_NAME_ALIASES).
- Registry-wide test: unique ids/names, non-empty names, defaults in
  range, popup defaults within options, value kinds match UI.
- docs/effects.md generated from the registry (catalog.rs) with GPU /
  32-bpc badges and per-effect status; a test keeps it current.

Batches
- Blur & Sharpen, Channel, 3D Channel, Perspective, Text, Utility:
  Camera Lens Blur iris/highlight groups, Compound Blur layer, Camera-
  Shake Deblur method/strength, Invert full channel list (CPU HLS/YIQ),
  Set Channels/Set Matte layers, Channel Combiner targets, 3D Channel
  Extract clamp/invert.
- Color Correction: temporal smoothing + scene detect for Auto Color/
  Contrast/Levels and Shadow/Highlight, Brightness & Contrast legacy
  switch, Change to Color tolerance group, Leave Color, Photo Filter
  presets, Exposure channels, Levels clip popups, Colorama phase source,
  Color Link sample list, Lumetri groups (CPU + GPU kernels).
- Distort: Bulge, Displacement Map layer/behaviour, Magnify, Optics
  Compensation resize, Ripple conversion, Transform sampling, Turbulent
  Displace types/pinning/evolution, Wave Warp types/pinning, Twirl and
  Ripple radius fixes.
- Generate: 4-Color Gradient, Checkerboard, Grid, Circle size/feather/
  blending, Advanced Lightning types, Cell Pattern, Radio Waves, Fractal
  palettes, Scribble/Vegas names.
- Keying, Matte, Obsolete: Color Difference Key partials/views, Unmult
  controls, Key Light groups, Refine Soft/Hard Matte, Roto Brush groups,
  Mocha shape moved to Matte, Spill Suppressor accuracy, Basic/Path Text
  groups.
- Noise & Grain, Immersive Video, Audio, Time: Fractal/Turbulent Noise
  full control set (noise3.rs, GPU), grain look groups, Remove Grain,
  VR effects, Compressor/Gate/Distortion controls, Timewarp groups,
  VR Sphere to Plane name.
- Simulation: AE twirl-down groups for all simulations, Foam strength,
  Particle Playground barrel radius and mapper targets.
- Stylize, Transition: Glow looping/dimensions/alpha (CPU + GPU),
  Mosaic averaging, Cartoon groups, Roughen Edges evolution, Texturize
  layer, Gradient Wipe layer, Radial Wipe both, Card Wipe options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-03 00:15:06 -04:00
co-authored by Claude Opus 5.5
parent 0631ef29dc
commit 355a6255a2
51 changed files with 6799 additions and 1737 deletions
+226 -12
View File
@@ -9,6 +9,7 @@
pub mod audio_fx;
mod blur2;
mod blur3;
pub mod catalog;
mod channel;
mod channel2;
mod channel3d;
@@ -27,10 +28,12 @@ mod keying;
mod keying2;
pub mod keylight;
mod matte;
pub mod migrate;
mod misc;
pub mod mocha_shape;
mod noise;
mod noise2;
mod noise3;
mod obsolete;
mod ocio;
pub mod paint;
@@ -56,11 +59,13 @@ pub mod warp_stab;
use std::collections::HashMap;
use std::sync::OnceLock;
pub use color_fx::{exposure_settings, levels_clip};
pub use color2::Curve;
use effectcraft_keyframe::Value;
use effectcraft_project::build::Ids;
use effectcraft_project::{GroupKind, ParamUi, PropGroup, Property};
pub use effectcraft_raster::{AuxChannels, Image};
pub use misc::{INVERT_ALPHA, INVERT_CHANNELS};
/// Effect categories in Effects & Presets order.
pub const CATEGORIES: &[&str] = &[
@@ -150,14 +155,20 @@ impl Params {
/// meshes and pins). Direct properties keep their match id as the key. The `i`-th child group
/// (1-based, counting groups only) of a group with key prefix `pre` gets the prefix
/// `{pre}#{i}/`, its properties `{pre}#{i}/{match}`, and metadata keys `@match`, `@name`
/// (`Value::Str`), `@enabled` (`Value::Bool`) and `@uid` (`Value::Scalar`).
/// (`Value::Str`), `@enabled` (`Value::Bool`) and `@uid` (`Value::Scalar`). Nested properties
/// are also keyed by their match path (`group/sub/param`, the first group with each match id),
/// which is how effects with twirl-down groups declare and read them.
pub fn flatten_params(g: &PropGroup, eval: &mut dyn FnMut(&Property) -> Value) -> Params {
fn walk(g: &PropGroup, pre: &str, eval: &mut dyn FnMut(&Property) -> Value, out: &mut HashMap<String, Value>) {
fn walk(g: &PropGroup, pre: &str, mpre: &str, eval: &mut dyn FnMut(&Property) -> Value, out: &mut HashMap<String, Value>) {
let mut gi = 0;
for c in &g.children {
match c {
effectcraft_project::Node::Prop(p) => {
out.insert(format!("{pre}{}", p.match_id), eval(p));
let v = eval(p);
if !mpre.is_empty() {
out.entry(format!("{mpre}{}", p.match_id)).or_insert_with(|| v.clone());
}
out.insert(format!("{pre}{}", p.match_id), v);
}
effectcraft_project::Node::Group(sg) => {
gi += 1;
@@ -166,13 +177,13 @@ pub fn flatten_params(g: &PropGroup, eval: &mut dyn FnMut(&Property) -> Value) -
out.insert(format!("{sp}@name"), Value::Str(sg.name.clone()));
out.insert(format!("{sp}@enabled"), Value::Bool(sg.enabled));
out.insert(format!("{sp}@uid"), Value::Scalar(sg.uid as f64));
walk(sg, &sp, eval, out);
walk(sg, &sp, &format!("{mpre}{}/", sg.match_id), eval, out);
}
}
}
}
let mut values = HashMap::new();
walk(g, "", eval, &mut values);
walk(g, "", "", eval, &mut values);
Params { values }
}
@@ -367,6 +378,7 @@ pub fn registry() -> &'static [EffectSpec] {
v.extend(channel2::specs());
v.extend(keying2::specs());
v.extend(noise2::specs());
v.extend(noise3::specs());
v.extend(color3::specs());
v.extend(obsolete::specs());
v.extend(ocio::specs());
@@ -399,10 +411,16 @@ pub fn find(id: &str) -> Option<&'static EffectSpec> {
/// Find by id or (case-insensitive) display name.
pub fn lookup(name_or_id: &str) -> Option<&'static EffectSpec> {
find(name_or_id).or_else(|| registry().iter().find(|s| s.name.eq_ignore_ascii_case(name_or_id))).or_else(|| {
// After Effects' third-party display names we register under a generic name.
keylight::KEYLIGHT_ALIASES.iter().any(|a| a.eq_ignore_ascii_case(name_or_id)).then(|| find("ec.keying.keylight")).flatten()
})
find(name_or_id)
.or_else(|| registry().iter().find(|s| s.name.eq_ignore_ascii_case(name_or_id)))
.or_else(|| {
// After Effects' third-party display names we register under a generic name.
keylight::KEYLIGHT_ALIASES.iter().any(|a| a.eq_ignore_ascii_case(name_or_id)).then(|| find("ec.keying.keylight")).flatten()
})
.or_else(|| {
// Display names of earlier versions.
migrate::EFFECT_NAME_ALIASES.iter().find(|(old, _)| old.eq_ignore_ascii_case(name_or_id)).and_then(|(_, id)| find(id))
})
}
/// A parameter's default value on a layer of `layer_size` (point defaults are fractions of the
@@ -446,19 +464,143 @@ pub fn instantiate(spec: &EffectSpec, ids: &mut Ids, instance_name: &str, layer_
}
// Layer parameters carry a source choice (Source / Masks / Effects & Masks) unless the
// effect declares its own (with its own default).
// A grouped layer parameter's companion sits next to it in its group, so it flattens
// to `group/paramSource` = `layer_source_id("group/param")`.
let sid = layer_source_id(ps.id);
if matches!(ps.ui, ParamUi::Layer) && !spec.params.iter().any(|q| q.id == sid) {
let mut src = Property::new(ids.alloc(), &sid, &format!("{} Source", ps.name), Value::Enum(2)).with_ui(ParamUi::Hidden);
let mut src = Property::new(ids.alloc(), &layer_source_id(leaf), &format!("{} Source", ps.name), Value::Enum(2)).with_ui(ParamUi::Hidden);
src.hold_only = true;
g.children.push(src.into());
match path {
Some(path) => nested_group(&mut g, ids, path).children.push(src.into()),
None => g.children.push(src.into()),
}
}
}
g
}
/// Display names of twirl-down parameter groups (`group/param` spec ids) by match id, for
/// effects without their own table.
pub const PARAM_GROUPS: &[(&str, &str)] = &[
// Color Correction: Exposure, Levels (Individual Controls), Change to Color, Colorama,
// Shadow/Highlight, Lumetri Color.
("master", "Master"),
("rgb", "RGB"),
("red", "Red"),
("green", "Green"),
("blue", "Blue"),
("alpha", "Alpha"),
("toleranceGroup", "Tolerance"),
("inputPhase", "Input Phase"),
("outputCycle", "Output Cycle"),
("moreOptions", "More Options"),
("basicCorrection", "Basic Correction"),
("whiteBalance", "White Balance"),
("tone", "Tone"),
("creative", "Creative"),
("adjustments", "Adjustments"),
("curves", "Curves"),
("colorWheels", "Color Wheels"),
("vignette", "Vignette"),
// Camera Lens Blur.
("irisProperties", "Iris Properties"),
("highlight", "Highlight"),
// Numbers.
("format", "Format"),
("fillAndStroke", "Fill and Stroke"),
// Stylize: Cartoon, Roughen Edges.
("fill", "Fill"),
("edge", "Edge"),
("evolutionOptions", "Evolution Options"),
// Noise & Grain: Fractal / Turbulent Noise, Add / Match Grain, Remove Grain, Noise Alpha.
("transform", "Transform"),
("subSettings", "Sub Settings"),
("tweaking", "Tweaking"),
("channelIntensities", "Channel Intensities"),
("channelSize", "Channel Size"),
("color", "Color"),
("application", "Application"),
("animation", "Animation"),
("noiseReductionSettings", "Noise Reduction Settings"),
("fineTuning", "Fine Tuning"),
("unsharpMask", "Unsharp Mask"),
("noiseOptions", "Noise Options (Animation)"),
// Time: Timewarp.
("tuning", "Tuning"),
("motionBlur", "Motion Blur"),
// Simulation.
("extras", "Extras"),
("wiggle", "Wiggle"),
("light", "Light"),
("shading", "Shading"),
("producer", "Producer"),
("physics", "Physics"),
("directionAxis", "Direction Axis"),
("gravityVector", "Gravity Vector"),
("particle", "Particle"),
("hairfallMap", "Hairfall Map"),
("hairColor", "Hair Color"),
("bottom", "Bottom"),
("water", "Water"),
("lighting", "Lighting"),
("material", "Material"),
("shape", "Shape"),
("force1", "Force 1"),
("force2", "Force 2"),
("bubbles", "Bubbles"),
("rendering", "Rendering"),
("heightMapControls", "Height Map Controls"),
("simulation", "Simulation"),
("producer1", "Producer 1"),
("producer2", "Producer 2"),
("xPosition", "X Position"),
("yPosition", "Y Position"),
("zPosition", "Z Position"),
("xRotation", "X Rotation"),
("yRotation", "Y Rotation"),
("zRotation", "Z Rotation"),
("xScale", "X Scale"),
("yScale", "Y Scale"),
("cameraPosition", "Camera Position"),
("cannon", "Cannon"),
("grid", "Grid"),
("layerExploder", "Layer Exploder"),
("layerMap", "Layer Map"),
("gravity", "Gravity"),
("repel", "Repel"),
("wall", "Wall"),
("persistentPropertyMapper", "Persistent Property Mapper"),
// Keying, Matte, Obsolete (Key Light's groups are in `keylight::GROUPS`).
("ultraSettings", "Ultra Settings"),
("fillAndStroke", "Fill and Stroke"),
("pathOptions", "Path Options"),
("controlPoints", "Control Points"),
("character", "Character"),
("orientation", "Orientation"),
("paragraph", "Paragraph"),
("preview", "Preview"),
// Generate.
("positionsColors", "Positions & Colors"),
("feather", "Feather"),
("tilingOptions", "Tiling Options"),
("polygon", "Polygon"),
("waveMotion", "Wave Motion"),
("waveStroke", "Stroke"),
("coreSettings", "Core Settings"),
("glowSettings", "Glow Settings"),
("expertSettings", "Expert Settings"),
("mandelbrot", "Mandelbrot"),
("julia", "Julia"),
("postInversionOffset", "Post-Inversion Offset"),
("fractalColor", "Color"),
("highQualitySettings", "High Quality Settings"),
("edgeOptions", "Edge Options"),
("strokeOptions", "Stroke Options"),
];
/// Display names of nested parameter groups by match id.
fn group_name(m: &str) -> &str {
warp_stab::GROUPS.iter().chain(roto::GROUPS).find(|(id, _)| *id == m).map(|(_, n)| *n).unwrap_or(m)
warp_stab::GROUPS.iter().chain(roto::GROUPS).chain(keylight::GROUPS).chain(PARAM_GROUPS).find(|(id, _)| *id == m).map(|(_, n)| *n).unwrap_or(m)
}
/// The nested group at `path` (`borders/autoScale`) under `g`, created on first use.
@@ -524,6 +666,11 @@ pub const TIME_DEPENDENT: &[&str] = &[
"ec.time.ccforcemotionblur",
"ec.time.ccwidetime",
"ec.time.pixelmotionblur",
// Temporal Smoothing reads neighbouring frames.
"ec.color.autolevels",
"ec.color.autocontrast",
"ec.color.autocolor",
"ec.color.shadowhighlight",
"ec.vr.digitalglitch",
"ec.blur.camerashakedeblur",
"ec.distort.rollingshutterrepair",
@@ -594,6 +741,73 @@ mod tests {
}
}
/// Registry-wide parameter sanity: unique ids and names, non-empty display names, defaults
/// of the right kind and inside their ranges, popup defaults inside their options.
#[test]
fn every_param_is_well_formed() {
let mut problems = vec![];
let mut names = std::collections::HashSet::new();
for s in registry() {
if s.name.trim().is_empty() {
problems.push(format!("{}: empty display name", s.id));
}
if !names.insert(s.name) {
problems.push(format!("{}: duplicate display name {}", s.id, s.name));
}
let mut ids = std::collections::HashSet::new();
for p in &s.params {
let at = format!("{} / {}", s.id, p.id);
if !ids.insert(p.id) {
problems.push(format!("{at}: duplicate id"));
}
if p.id.is_empty() || p.id.contains(char::is_whitespace) {
problems.push(format!("{at}: bad id"));
}
if p.name.trim().is_empty() {
problems.push(format!("{at}: empty display name"));
}
match (&p.ui, &p.default) {
(ParamUi::Slider { min, max, slider_min, slider_max, .. }, d) => {
if !(min <= max && slider_min <= slider_max) {
problems.push(format!("{at}: inverted range"));
}
if !(slider_min >= min && slider_max <= max) {
problems.push(format!("{at}: slider range {slider_min}..{slider_max} outside valid range {min}..{max}"));
}
match d {
Value::Scalar(v) if v < min || v > max => problems.push(format!("{at}: default {v} outside {min}..{max}")),
Value::Scalar(_) => {}
d => problems.push(format!("{at}: slider default {d:?} is not a number")),
}
}
(ParamUi::Popup { options }, d) => {
if options.is_empty() || options.iter().any(|o| o.trim().is_empty()) {
problems.push(format!("{at}: empty popup option"));
}
let uniq: std::collections::HashSet<_> = options.iter().collect();
if uniq.len() != options.len() {
problems.push(format!("{at}: duplicate popup option"));
}
match d {
Value::Enum(i) if (*i as usize) < options.len() => {}
d => problems.push(format!("{at}: popup default {d:?} not among {} options", options.len())),
}
}
(ParamUi::Checkbox, d) if !matches!(d, Value::Bool(_)) => problems.push(format!("{at}: checkbox default {d:?}")),
(ParamUi::Color, d) if !matches!(d, Value::Color(_)) => problems.push(format!("{at}: color default {d:?}")),
(ParamUi::Point, d) if !matches!(d, Value::Vec2(_)) => problems.push(format!("{at}: point default {d:?}")),
(ParamUi::Point3, d) if !matches!(d, Value::Vec3(_)) => problems.push(format!("{at}: 3D point default {d:?}")),
(ParamUi::Layer, d) if !matches!(d, Value::Layer(_)) => problems.push(format!("{at}: layer default {d:?}")),
(ParamUi::Percent | ParamUi::Angle | ParamUi::Pixels | ParamUi::Number, d) if !matches!(d, Value::Scalar(_) | Value::Vec2(_)) => {
problems.push(format!("{at}: numeric default {d:?}"))
}
_ => {}
}
}
}
assert!(problems.is_empty(), "{} problems:\n{}", problems.len(), problems.join("\n"));
}
/// Every effect runs on a small image with its default parameters without panicking and
/// keeps alpha in range.
#[test]