Timeline: reveal shortcuts leave unselected layers alone (#160)

U (and P, S, R, T, A, E, M, F, L) kept one reveal filter for the whole
Timeline and replaced the set of open layers with the selected ones, so
revealing on one layer closed every other layer and dropped their
reveals.

Each layer now has its own filter (TimelineState::layer_reveal; an open
layer without one shows its whole tree). A shortcut applies to the
selected layers (all layers with none selected) through apply_reveal and
leaves the others as they are; `reveal` stays the last shortcut's filter
for toggling and Shift-adding. U's results replace only the target
layers' earlier picks, so U after UU shows the keyframed properties
again. anim.reveal tells the Timeline which layers it looked at, so a
layer with nothing keyframed closes. Twirling a layer by hand, Ctrl+`
and Collapse All clear the filters they cover.

Test: reveal_shortcuts_leave_unselected_layers_alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic
2026-10-07 13:02:01 +07:00
co-authored by Claude Opus 5.5
parent 8c4b988a65
commit 6b8200ff78
4 changed files with 130 additions and 35 deletions
+24 -1
View File
@@ -344,6 +344,23 @@ impl Default for ViewerState {
}
}
impl TimelineState {
/// Show `kinds` on `layers` (twirled open; empty: twirled closed) and remember it as the last
/// reveal. Other layers keep theirs.
pub fn apply_reveal(&mut self, layers: &[u64], kinds: Vec<String>) {
for id in layers {
if kinds.is_empty() {
self.open_layers.remove(id);
self.layer_reveal.remove(id);
} else {
self.open_layers.insert(*id);
self.layer_reveal.insert(*id, kinds.clone());
}
}
self.reveal = kinds;
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TimelineState {
/// Visible span start (seconds) and pixels per second; None = fit comp.
@@ -361,8 +378,13 @@ pub struct TimelineState {
/// Twirled-open layers and groups (by layer id / group uid).
pub open_layers: BTreeSet<u64>,
pub open_groups: BTreeSet<u64>,
/// "Reveal" filter: only show these property match ids (P/S/R/T/A…) — empty = normal.
/// The last reveal shortcut's filter (P/S/R/T/A…): what pressing it again toggles or adds to.
pub reveal: Vec<String>,
/// Each revealed layer's filter: an open layer without one shows its whole property tree. A
/// reveal shortcut sets it on the selected layers (all layers with none selected) and leaves
/// the others as they are.
#[serde(default)]
pub layer_reveal: BTreeMap<u64, Vec<String>>,
/// Properties / groups (uids) shown by the `props` reveal (Animation ▸ Reveal Properties…).
#[serde(default)]
pub reveal_props: BTreeSet<u64>,
@@ -426,6 +448,7 @@ impl Default for TimelineState {
open_layers: BTreeSet::new(),
open_groups: BTreeSet::new(),
reveal: vec![],
layer_reveal: BTreeMap::new(),
reveal_props: BTreeSet::new(),
graph_mode: auto_graph(),
graph_show_selected: true,