.aep: popup items match ignoring case outside ASCII too (#3432 follow-up) (#3447)

popup_key lowered only ASCII letters, so an item starting with a capital
outside ASCII (French "Écran") kept it and never matched the same word in
lower case. After Effects stores popup items in its UI language, and
#3432 starts matching such names through popup_alias, keyed by
popup_key. Use Unicode lower case; ASCII keys are unchanged.
This commit is contained in:
ash
2026-11-11 17:16:46 +05:30
committed by GitHub
parent 12260b288c
commit 284cec6e46
+19 -1
View File
@@ -1142,8 +1142,12 @@ pub const GLOW_MIDPOINT_MAX: f64 = 0.990_005_493_164_062_5;
/// The key a popup item is matched by between the two programs: trimmed, lower case, and
/// Set Matte's "Red Channel" ... "Alpha Channel" are EffectCraft's "Red" ... "Alpha" (904 E24).
///
/// Lower case is Unicode's, not only ASCII's: After Effects stores popup items in its UI
/// language, so an item can start with a capital outside ASCII (French "Écran"), and its key must
/// be the same as for the same word in lower case.
pub fn popup_key(item: &str) -> String {
let s = item.trim().to_ascii_lowercase();
let s = item.trim().to_lowercase();
s.strip_suffix(" channel").map(str::to_string).unwrap_or(s)
}
@@ -1186,3 +1190,17 @@ pub const HUE_SATURATION_MASTER: [&str; 3] = ["hue", "saturation", "lightness"];
/// The EffectCraft parameters Levels' RGB channel values (`Extra::Levels`) go to, in the order of
/// the data (input black, input white, gamma, output black, output white: 512-516).
pub const LEVELS_RGB: [&str; 5] = ["inBlack", "inWhite", "gamma", "outBlack", "outWhite"];
#[cfg(test)]
mod tests {
use super::*;
/// A capital outside ASCII has the same key as its lower case; ASCII keys are unchanged.
#[test]
fn popup_key_lowers_non_ascii_capitals() {
assert_eq!(popup_key("ÉCRAN"), popup_key("écran"));
assert_eq!(popup_key(" Désactivé "), "désactivé");
assert_eq!(popup_key("Off for 32 bpc Color"), "off for 32 bpc color");
assert_eq!(popup_key("Red Channel"), "red");
}
}