Timeline: a group twirled open by hand under a reveal shows all its properties
Collapsing and expanding an effect that shows only its revealed parameters (U, UU) now lists every parameter. The next reveal on the layer filters it again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
63cfcfbb90
commit
0c343212ae
@@ -945,7 +945,7 @@ fn reveal_rows(app: &EffectcraftApp, l: &Layer, kinds: &[String], rows: &mut Vec
|
||||
}
|
||||
wanted.extend(picked.iter().copied());
|
||||
}
|
||||
revealed_rows(rows, l, &wanted, &shown_groups, &tl.open_groups);
|
||||
revealed_rows(rows, l, &wanted, &shown_groups, &tl.open_groups, tl.full_groups.get(&l.id.0));
|
||||
if has("waveform")
|
||||
&& let Some(item) = super::waveform::audio_item(&app.session.project, l)
|
||||
{
|
||||
@@ -956,13 +956,22 @@ fn reveal_rows(app: &EffectcraftApp, l: &Layer, kinds: &[String], rows: &mut Vec
|
||||
/// Rows for the revealed properties `shown` of `l`, in tree order. Those inside an effect show
|
||||
/// under the effect and its groups, as in After Effects (Puppet ▸ Mesh 1 ▸ Deform ▸ Puppet
|
||||
/// Pin 1 ▸ Position: every pin's Position is told apart, #273); the others (Transform, masks…)
|
||||
/// on their own. Groups in `skip` already show with their contents.
|
||||
fn revealed_rows(rows: &mut Vec<Row>, l: &Layer, shown: &std::collections::BTreeSet<u64>, skip: &[u64], open: &std::collections::BTreeSet<u64>) {
|
||||
/// on their own. Groups in `skip` already show with their contents; those in `full` (twirled
|
||||
/// open by hand since the reveal) show all of theirs.
|
||||
fn revealed_rows(
|
||||
rows: &mut Vec<Row>,
|
||||
l: &Layer,
|
||||
shown: &std::collections::BTreeSet<u64>,
|
||||
skip: &[u64],
|
||||
open: &std::collections::BTreeSet<u64>,
|
||||
full: Option<&std::collections::BTreeSet<u64>>,
|
||||
) {
|
||||
struct Tree<'a> {
|
||||
l: &'a Layer,
|
||||
wanted: &'a dyn Fn(&Property) -> bool,
|
||||
skip: &'a [u64],
|
||||
open: &'a std::collections::BTreeSet<u64>,
|
||||
full: Option<&'a std::collections::BTreeSet<u64>>,
|
||||
}
|
||||
fn holds(g: &PropGroup, wanted: &dyn Fn(&Property) -> bool) -> bool {
|
||||
g.children.iter().any(|c| match c {
|
||||
@@ -981,6 +990,10 @@ fn revealed_rows(rows: &mut Vec<Row>, l: &Layer, shown: &std::collections::BTree
|
||||
if !o {
|
||||
return;
|
||||
}
|
||||
if t.full.is_some_and(|f| f.contains(&g.uid)) {
|
||||
push_group(rows, t.l, g, depth + 1, t.open);
|
||||
return;
|
||||
}
|
||||
for c in &g.children {
|
||||
match c {
|
||||
Node::Prop(p) if (t.wanted)(p) => rows.push(Row { layer: t.l.id, depth: depth + 1, kind: RowKind::Prop { uid: p.uid } }),
|
||||
@@ -990,7 +1003,7 @@ fn revealed_rows(rows: &mut Vec<Row>, l: &Layer, shown: &std::collections::BTree
|
||||
}
|
||||
}
|
||||
let wanted = |p: &Property| shown.contains(&p.uid) && prop_visible(p, l);
|
||||
let tree = Tree { l, wanted: &wanted, skip, open };
|
||||
let tree = Tree { l, wanted: &wanted, skip, open, full };
|
||||
for c in &l.props.children {
|
||||
match c {
|
||||
Node::Group(fx) if fx.match_id == "effects" => {
|
||||
@@ -2177,7 +2190,7 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
if *has_children {
|
||||
let tw = Rect::from_center_size(pos2(indent, cy), vec2(13.0, 13.0));
|
||||
if widgets::twirl(ui, tw, *open, egui::Id::new(("gtw", uid)), &t).clicked() {
|
||||
ui_actions.push(UiAct::ToggleGroup(*uid));
|
||||
ui_actions.push(UiAct::ToggleGroup(row.layer.0, *uid));
|
||||
}
|
||||
app.auto.add(&format!("timeline.group.{uid}.twirl"), tw, name);
|
||||
}
|
||||
@@ -2246,7 +2259,7 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
actions.push(("prop.select".into(), json!({"layer": layer.id.0, "prop": uid, "selectKeys": false})));
|
||||
actions.push(("window.panel".into(), json!({"panel": "EffectControls"})));
|
||||
} else {
|
||||
ui_actions.push(UiAct::ToggleGroup(*uid));
|
||||
ui_actions.push(UiAct::ToggleGroup(row.layer.0, *uid));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3085,6 +3098,7 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
// Twirled by hand, the layer shows its whole tree again.
|
||||
tl.reveal.clear();
|
||||
tl.layer_reveal.remove(&id);
|
||||
tl.full_groups.remove(&id);
|
||||
let open = !tl.open_layers.contains(&id);
|
||||
if open {
|
||||
tl.open_layers.insert(id);
|
||||
@@ -3103,11 +3117,7 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
}
|
||||
}
|
||||
}
|
||||
UiAct::ToggleGroup(uid) => {
|
||||
if !app.ui.timeline.open_groups.remove(&uid) {
|
||||
app.ui.timeline.open_groups.insert(uid);
|
||||
}
|
||||
}
|
||||
UiAct::ToggleGroup(layer, uid) => app.ui.timeline.toggle_group(layer, uid),
|
||||
UiAct::SetTime(tt) => app.session.set_time(tt),
|
||||
UiAct::EndMerge => app.session.history.merge_key = None,
|
||||
UiAct::ChangeRenderer => {
|
||||
@@ -3229,7 +3239,7 @@ fn layer_cells(
|
||||
|
||||
enum UiAct {
|
||||
ToggleLayer(u64, bool),
|
||||
ToggleGroup(u64),
|
||||
ToggleGroup(u64, u64),
|
||||
SetTime(Tick),
|
||||
EndMerge,
|
||||
/// Composition Settings on its 3D Renderer tab.
|
||||
@@ -4017,6 +4027,16 @@ mod tests {
|
||||
let fx = rows.iter().position(|r| r.trim().ends_with("Gaussian Blur")).unwrap_or_else(|| panic!("UU shows the effect: {rows:?}"));
|
||||
assert_eq!(rows[fx + 1].trim(), "Blurriness", "{rows:?}");
|
||||
assert!(!rows.iter().any(|r| r.trim() == "Blur Dimensions"), "unchanged parameters stay hidden: {rows:?}");
|
||||
// Collapsed and expanded by hand, the effect shows all its parameters; UU filters again.
|
||||
let fx_uid = app.session.active_comp().unwrap().layer(LayerId(bx)).unwrap().effects().unwrap().groups().next().unwrap().uid;
|
||||
app.ui.timeline.toggle_group(bx, fx_uid);
|
||||
assert!(!labels(&app).iter().any(|r| r.trim() == "Blurriness"), "collapsed");
|
||||
app.ui.timeline.toggle_group(bx, fx_uid);
|
||||
let rows = labels(&app);
|
||||
assert!(rows.iter().any(|r| r.trim() == "Blurriness") && rows.iter().any(|r| r.trim() == "Blur Dimensions"), "{rows:?}");
|
||||
app.last_reveal = Some(("keyframes".into(), f64::MAX));
|
||||
crate::menus::invoke(&mut app, &ctx, "anim.reveal", json!({"kind": "keyframes"})).unwrap();
|
||||
assert!(!labels(&app).iter().any(|r| r.trim() == "Blur Dimensions"), "UU again shows the changed ones only");
|
||||
app.last_reveal = Some(("keyframes".into(), -10.0));
|
||||
crate::menus::invoke(&mut app, &ctx, "anim.reveal", json!({"kind": "keyframes"})).unwrap();
|
||||
app.last_reveal = Some(("keyframes".into(), -10.0));
|
||||
|
||||
@@ -305,6 +305,7 @@ impl TimelineState {
|
||||
/// reveal. Other layers keep theirs.
|
||||
pub fn apply_reveal(&mut self, layers: &[u64], kinds: Vec<String>) {
|
||||
for id in layers {
|
||||
self.full_groups.remove(id);
|
||||
if kinds.is_empty() {
|
||||
self.open_layers.remove(id);
|
||||
self.layer_reveal.remove(id);
|
||||
@@ -315,6 +316,18 @@ impl TimelineState {
|
||||
}
|
||||
self.reveal = kinds;
|
||||
}
|
||||
|
||||
/// Twirl group `uid` of `layer` by hand. Opened under a reveal, it shows all its properties
|
||||
/// (collapse and expand an effect that shows only its revealed parameters to see them all).
|
||||
pub fn toggle_group(&mut self, layer: u64, uid: u64) {
|
||||
if self.open_groups.remove(&uid) {
|
||||
return;
|
||||
}
|
||||
self.open_groups.insert(uid);
|
||||
if self.layer_reveal.contains_key(&layer) {
|
||||
self.full_groups.entry(layer).or_default().insert(uid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
@@ -344,6 +357,10 @@ pub struct TimelineState {
|
||||
/// Properties / groups (uids) shown by the `props` reveal (Animation ▸ Reveal Properties…).
|
||||
#[serde(default)]
|
||||
pub reveal_props: BTreeSet<u64>,
|
||||
/// Groups of a revealed layer (by layer id) twirled open by hand since the reveal: they show
|
||||
/// their whole contents, not just the revealed properties.
|
||||
#[serde(default)]
|
||||
pub full_groups: BTreeMap<u64, BTreeSet<u64>>,
|
||||
/// Graph Editor: `auto` (Auto-Select Graph Type, the default: the speed graph when every
|
||||
/// property shown is spatial, else the value graph), `value` or `speed`.
|
||||
#[serde(default = "auto_graph")]
|
||||
@@ -414,6 +431,7 @@ impl Default for TimelineState {
|
||||
reveal: vec![],
|
||||
layer_reveal: BTreeMap::new(),
|
||||
reveal_props: BTreeSet::new(),
|
||||
full_groups: BTreeMap::new(),
|
||||
graph_mode: auto_graph(),
|
||||
graph_show_selected: true,
|
||||
graph_auto_zoom: true,
|
||||
|
||||
Reference in New Issue
Block a user