From a96c85b0e5677daf8e744101605bb2d40f4177b3 Mon Sep 17 00:00:00 2001 From: pravdomil <2387356+pravdomil@users.noreply.github.com> Date: Mon, 12 Oct 2026 16:17:31 +0200 Subject: [PATCH] Timeline: expression row takes its property row's background Rows stripe by their index among the non-expression rows, so adding or removing an expression leaves every other row's stripe unchanged. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/panels/timeline.rs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/panels/timeline.rs b/crates/ui-egui/src/panels/timeline.rs index 72f10429..b5e1ffbc 100644 --- a/crates/ui-egui/src/panels/timeline.rs +++ b/crates/ui-egui/src/panels/timeline.rs @@ -1769,7 +1769,17 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) { let mut hit_rows: Vec<(Rect, Row)> = vec![]; // The value fields of multi-dimension properties (per dimension), for the pick whip. let mut dim_hits: Vec<(u64, Vec)> = vec![]; - for (ri, row) in rows.iter().enumerate() { + // Rows stripe by their index among the rows that are not expression editors, so adding or + // removing an expression leaves every other row's stripe alone; an editor takes the index + // (and so the stripe) of its property's row, the one just above. + let mut striped = 0usize; + for row in rows.iter() { + let ri = if matches!(row.kind, RowKind::Expr { .. }) { + striped.saturating_sub(1) + } else { + striped += 1; + striped - 1 + }; // Outline widgets never spill into the time graph (narrow timelines). ui.set_clip_rect(left_clip); let hh = row_height(row, rh); @@ -2274,7 +2284,19 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) { let Some(prop) = layer.props.find(*uid) else { continue }; let Some(ex) = prop.expr.clone() else { continue }; let (buf_id, edit_id) = (expr_buf_id(*uid), egui::Id::new(("expr-edit", uid))); - lp.rect_filled(left, 0.0, t.row_alt); + // The same background as its property's row, selection included. + let sel_prop = app.session.state.selected_props.contains(&(layer.id, *uid)); + lp.rect_filled( + left, + 0.0, + if sel_prop { + t.row_selected + } else if ri % 2 == 0 { + t.row + } else { + t.row_alt + }, + ); let indent = cw.name + 6.0 + 14.0 * row.depth as f32; lp.text(pos2(indent + 12.0, cy), Align2::LEFT_CENTER, crate::i18n::tr("Expression:"), Tokens::ui(11.5), t.text_dim); lp.text(pos2(indent + 82.0, cy), Align2::LEFT_CENTER, &prop.name, Tokens::ui(11.5), t.text);