#3460: legacy Roto Brush keys hash Gaussian Blur's 0.24 Blurriness range

Roto Brush Input Keys saved by 0.22-0.24 hashed each effect above the
brush through its derived Debug text, UI hints included. Opening a project
replaces an instance's hints with the current spec's, so widening a range
would stop those keys matching and drop the frozen matte. The legacy text
now puts back the slider range 0.24 shipped for parameters listed in
SLIDERS_0_24, starting with Gaussian Blur's Blurriness.
This commit is contained in:
arnav-hiwarkar
2026-11-17 16:06:36 +05:30
parent aeedb92ef2
commit 4b4d273086
2 changed files with 43 additions and 3 deletions
@@ -2,7 +2,7 @@
//! keyed with them. They hash derived `Debug` text, so `tests::analysis_signature` pins keys
//! those releases saved: if a type change alters this text, write that part out here.
use effectcraft_project::{Footage, ItemId, ItemKind, Layer, LayerSource, Project, Uid};
use effectcraft_project::{Footage, GroupKind, ItemId, ItemKind, Layer, LayerSource, ParamUi, Project, PropGroup, Uid};
use super::fnv;
@@ -41,12 +41,39 @@ pub(crate) fn input_key_of(mut s: String, layer: &Layer, uid: Uid) -> String {
if g.uid == uid {
break;
}
s.push_str(&format!("{g:?}"));
s.push_str(&effect_text(g));
}
}
format!("{:016x}", fnv(&s))
}
/// The slider ranges 0.22–0.24 gave effect parameters whose range has changed since, as
/// (effect, parameter path, [min, max, slider min, slider max], decimals). Those releases hashed
/// each effect's UI hints into the Roto Brush Input Key, and opening a project replaces an
/// instance's hints with the current ones, so [`effect_text`] puts these back. A range change
/// above a Roto Brush would otherwise drop the analysis such a key kept: add a row with it.
#[rustfmt::skip]
const SLIDERS_0_24: &[(&str, &str, [f64; 4], u8)] = &[
("ec.blur.gaussian", "blurriness", [0.0, 3000.0, 0.0, 50.0], 1),
];
/// An effect instance as 0.22–0.24 wrote it into a Roto Brush Input Key: its derived `Debug`,
/// with the [`SLIDERS_0_24`] ranges in place of today's.
pub(crate) fn effect_text(g: &PropGroup) -> String {
let GroupKind::Effect { effect } = &g.kind else { return format!("{g:?}") };
let mut rows = SLIDERS_0_24.iter().filter(|r| r.0 == effect).peekable();
if rows.peek().is_none() {
return format!("{g:?}");
}
let mut g = g.clone();
for &(_, path, [min, max, slider_min, slider_max], decimals) in rows {
if let Some(p) = g.prop_mut(path).filter(|p| matches!(p.ui, ParamUi::Slider { .. })) {
p.ui = ParamUi::Slider { min, max, slider_min, slider_max, decimals };
}
}
format!("{g:?}")
}
/// A footage item as 0.23–0.24 wrote it into a signature (without `placed_page` before 0.23),
/// with `missing` in place of the item's.
pub(crate) fn footage_text(f: &Footage, missing: bool, placed_page: bool) -> String {
+14 -1
View File
@@ -5,7 +5,7 @@ use effectcraft_effects::camera_tracker::{TRACKS, TRACKS_KEY};
use effectcraft_effects::roto::{FROZEN, INPUT_KEY};
use effectcraft_effects::warp_stab::{ANALYSIS, ANALYSIS_KEY};
use effectcraft_keyframe::Value;
use effectcraft_project::{ItemId, LayerId, Project};
use effectcraft_project::{GroupKind, ItemId, LayerId, ParamUi, Project};
use serde_json::json;
use crate::Session;
@@ -93,6 +93,19 @@ fn analyses_saved_by_0_24_survive_edits_that_keep_their_frames() {
assert_eq!(saved(&s), before);
}
/// 0.24 hashed each effect's UI hints into the Roto Brush's key, and opening a project takes the
/// current ones: the legacy text puts back Gaussian Blur's 0.24 Blurriness range (#3460).
#[test]
fn legacy_roto_keys_hash_the_0_24_blurriness_range() {
let s = open(ANALYSED_0_24);
let layer = s.project.comp(COMP).unwrap().layer(CLIP).unwrap();
let is_blur = |kind: &GroupKind| matches!(kind, GroupKind::Effect { effect } if effect == "ec.blur.gaussian");
let blur = layer.effects().and_then(|fx| fx.groups().find(|g| is_blur(&g.kind))).expect("the fixture has a Gaussian Blur above the Roto Brush");
let mut as_0_24 = blur.clone();
as_0_24.get_mut("blurriness").unwrap().ui = ParamUi::Slider { min: 0.0, max: 3000.0, slider_min: 0.0, slider_max: 50.0, decimals: 1 };
assert_eq!(crate::analysis::frames_key::legacy::effect_text(blur), format!("{as_0_24:?}"));
}
/// The text keys are made from today, written field by field (#3536). It changes only when this
/// test is changed with it: a new field of a type it writes doesn't compile until it is decided
/// in `analysis::frames_key`, and renaming a field or variant doesn't change it.