Timeline: enabling time remapping reveals Time Remap (#157)

Layer ▸ Time ▸ Enable Time Remapping (and the layer menu's entry) added
the property and its two keyframes but left the layer twirled closed, so
nothing visibly changed. When the command turns remapping on, the
layers that have it now twirl open on Time Remap, through the same
per-layer reveal as RR. Turning it off reveals nothing.

Test: enabling_time_remapping_reveals_time_remap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic
2026-10-07 13:04:12 +07:00
co-authored by Claude Opus 5.5
parent 6b8200ff78
commit 76761bd2ef
2 changed files with 45 additions and 0 deletions
+22
View File
@@ -175,6 +175,20 @@ pub fn reveal(app: &mut EffectcraftApp, kind: &str, now: f64, add: bool) {
tl.apply_reveal(&targets, kinds);
}
/// Show Time Remap on the layers of a `layer.enableTimeRemap` (`layers` by id, else the
/// selected ones) that have it now.
fn reveal_time_remap(app: &mut EffectcraftApp, params: &Value) {
let asked: Vec<u64> = match params.get("layers").and_then(Value::as_array) {
Some(a) => a.iter().filter_map(Value::as_u64).collect(),
None => app.session.state.selected_layers.iter().map(|l| l.0).collect(),
};
let Some(comp) = app.session.active_comp() else { return };
let layers: Vec<u64> = comp.layers.iter().filter(|l| asked.contains(&l.id.0) && l.props.get("timeRemap").is_some()).map(|l| l.id.0).collect();
if !layers.is_empty() {
app.ui.timeline.apply_reveal(&layers, vec!["timeRemap".into()]);
}
}
/// The layers a reveal shortcut acts on: the selected ones, else every layer of the active comp.
fn reveal_targets(app: &EffectcraftApp) -> Vec<u64> {
if app.session.state.selected_layers.is_empty() {
@@ -541,6 +555,14 @@ pub fn invoke(app: &mut EffectcraftApp, ctx: &egui::Context, id: &str, params: V
}
return r;
}
// Enabling time remapping twirls its layers open on Time Remap and its two keys.
if id == "layer.enableTimeRemap" {
let r = run_engine(app, ctx, id, params.clone());
if r.as_ref().is_ok_and(|on| on.as_bool() == Some(true)) {
reveal_time_remap(app, &params);
}
return r;
}
if id == "layer.rename" && params.get("name").is_none() {
crate::panels::timeline::begin_rename(app, ctx);
return Ok(Value::Null);