mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-03 06:52:21 -06:00
Timeline: UU reveals an effect's changed parameters only
The modified reveal showed every effect in full. It now compares each effect with a new instance and reveals the parameters whose value differs, plus the groups a new instance lacks (puppet meshes and pins, paint strokes). An effect whose plug-in is missing still shows in full. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9efe75330c
commit
63cfcfbb90
@@ -349,6 +349,25 @@ fn changed_from(g: &PropGroup, default: &PropGroup, out: &mut Vec<Uid>) {
|
||||
}
|
||||
}
|
||||
|
||||
/// What of effect group `g` differs from `new`, a new instance of the effect: parameters with
|
||||
/// another value, and in full the groups a new instance lacks (puppet meshes and pins, paint
|
||||
/// strokes: what the user made).
|
||||
fn effect_changes(g: &PropGroup, new: &PropGroup, out: &mut Vec<Uid>) {
|
||||
for c in &g.children {
|
||||
match c {
|
||||
Node::Prop(pr) => {
|
||||
if new.get(&pr.match_id).is_some_and(|d| d.value != pr.value) && !out.contains(&pr.uid) {
|
||||
out.push(pr.uid);
|
||||
}
|
||||
}
|
||||
Node::Group(sg) => match new.sub(&sg.match_id) {
|
||||
Some(d) => effect_changes(sg, d, out),
|
||||
None => out.push(sg.uid),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn reveal(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let kind = str_p(p, "kind").unwrap_or("keyframes").to_string();
|
||||
let cid = super::comp_id(s, p)?;
|
||||
@@ -389,12 +408,30 @@ fn reveal(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
found.push(pr.uid);
|
||||
}
|
||||
});
|
||||
// Modified: effects and masks count as modifications in full (AE reveals them).
|
||||
if kind == "modified" && matches!(top.match_id.as_str(), "effects" | "masks") {
|
||||
// Modified: masks count as modifications in full (AE reveals them).
|
||||
if kind == "modified" && top.match_id == "masks" {
|
||||
for g in top.groups() {
|
||||
found.push(g.uid);
|
||||
}
|
||||
}
|
||||
// Modified: an effect's parameters that differ from a new instance's.
|
||||
if kind == "modified" && top.match_id == "effects" {
|
||||
let size = effectcraft_render::effect_bounds(&s.project, comp, l).0;
|
||||
for g in top.groups() {
|
||||
let spec = match &g.kind {
|
||||
GroupKind::Effect { effect } => effectcraft_effects::find(effect),
|
||||
_ => None,
|
||||
};
|
||||
// A missing plug-in's defaults aren't known: the effect shows in full.
|
||||
let Some(spec) = spec else {
|
||||
found.push(g.uid);
|
||||
continue;
|
||||
};
|
||||
let mut next = 0;
|
||||
let new = effectcraft_effects::instantiate(spec, &mut Ids(&mut next), "", size);
|
||||
effect_changes(g, &new, &mut found);
|
||||
}
|
||||
}
|
||||
if kind == "modified" && top.match_id == "text" {
|
||||
for g in top.group("animators").into_iter().flat_map(|a| a.groups()) {
|
||||
found.push(g.uid);
|
||||
|
||||
Reference in New Issue
Block a user