#3478, #3479: 4-Color Gradient: Blend and Jitter take After Effects' ranges

Blend goes up to 10000 (it keeps its minimum of 1, below After Effects' 5)
and Jitter up to 500 %, After Effects' recorded valid ranges in the same
units. Defaults and sliders are unchanged.

The CPU and GPU renderers capped Jitter's dither at 100 %, so higher values
would be stored but render as 100. Both now take it from one function,
four_color_jitter, which keeps the dither linear up to 500 %. Blend 10000
is a finite softening (Blend squared) at the same cost.

Jitter was written as "percent" in keyframe text because its range was
0..100; a UNITS row keeps that unit.
This commit is contained in:
arnav-hiwarkar committed 2026-11-12 15:14:34 +05:30
1 parent 39a3b565d8
commit 363a800d3f
8 files changed
+53 -9

No files matched your search

@@ -273,6 +273,7 @@ pub(crate) const UNITS: &[(&str, &str, &str)] = &[
("ec.distort.wavewarp", "width", "percent"),
("ec.distort.wavewarp", "speed", "pixels"),
("ec.generate.fourcolor", "blend", "percent"),
("ec.generate.fourcolor", "jitter", "percent"),
("ec.generate.advancedlightning", "coreSettings/coreRadius", ""),
("ec.generate.advancedlightning", "glowSettings/glowRadius", "percent"),
("ec.generate.advancedlightning", "alphaObstacle", "pixels"),
+5 -2
View File
@@ -9,8 +9,9 @@ use serde_json::{Value, json};
use crate::Session;
/// (issue, effect, parameter path, lowest, highest): the ends of After Effects' valid range,
/// in EffectCraft's units, each outside the range the effect accepted before the issue.
/// (issue, effect, parameter path, lowest, highest): the ends of the range the effect now accepts,
/// in EffectCraft's units: After Effects' valid range, or wider where EffectCraft already was.
/// At least one end of each is outside the range accepted before the issue.
#[rustfmt::skip]
const ROWS: &[(u32, &str, &str, f64, f64)] = &[
(3487, "ec.color.levelsic", "rgb/rgbInBlack", -10000.0, 10000.0),
@@ -38,6 +39,8 @@ const ROWS: &[(u32, &str, &str, f64, f64)] = &[
(3489, "ec.color.levelsic", "alpha/alphaOutBlack", -10000.0, 10000.0),
(3490, "ec.color.levelsic", "alpha/alphaOutWhite", -10000.0, 10000.0),
(3491, "ec.color.levelsic", "alpha/alphaGamma", 0.0, 10.0),
(3478, "ec.generate.fourcolor", "blend", 1.0, 10000.0),
(3479, "ec.generate.fourcolor", "jitter", 0.0, 500.0),
];
fn path(effect: &str, param: &str) -> String {
+18
View File
@@ -480,3 +480,21 @@ fn camera_light_and_material_options_are_written_as_after_effects_does() {
assert!(text.contains(block), "{block}in\n{text}");
}
}
/// The unit column of `name`'s block in copied keyframe text.
fn unit_of<'a>(text: &'a str, name: &str) -> &'a str {
let mut lines = text.lines().skip_while(|l| !l.contains(&format!("\t{name} #")));
lines.next().unwrap_or_else(|| panic!("no {name} in\n{text}"));
lines.next().and_then(|l| l.strip_prefix("\tFrame\t")).and_then(|l| l.strip_suffix('\t')).unwrap_or_else(|| panic!("{name} in\n{text}"))
}
/// Widening a 0..100 slider to After Effects' range (#3479, #3483, #3484) keeps the unit the
/// keyframe text writes for it.
#[test]
fn widened_effect_ranges_keep_their_keyframe_text_units() {
let (mut s, l) = session();
s.execute("effect.apply", json!({"layer": l.0, "effect": "ec.generate.fourcolor"})).unwrap();
let text = copy_props(&mut s, l, &["effects/#1/blend", "effects/#1/jitter"]);
assert_eq!(unit_of(&text, "Blend"), "percent");
assert_eq!(unit_of(&text, "Jitter"), "percent");
}