Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Merge main into enhance/audio-levels-link

tylerjenningsw0138e0ec8a90
diff --cc crates/ui-egui/src/panels/timeline.rs
index b052d32d2,9f308e4be..06e3c0ff2
--- a/crates/ui-egui/src/panels/timeline.rs
+++ b/crates/ui-egui/src/panels/timeline.rs
@@@ -5494,19 -5664,18 +5664,21 @@@ fn vector_editor(app: &mut EffectcraftA
// Mask Feather: two linked values, never negative (as in After Effects, #203).
let feather = prop.match_id == "feather" && layer.props.parent_of(uid).is_some_and(|g| matches!(g.kind, GroupKind::Mask { .. }));
let range = if feather { (0.0, 1e9) } else { (-1e9, 1e9) };
+ // Audio Levels link their two channels too, off by default, by the same dB change (#2485).
+ let levels = prop.match_id == "levels" && layer.props.parent_of(uid).is_some_and(|g| g.match_id == "audio");
// Scale and Mask Feather: the chain link (Constrain Proportions, on by default).
- let linkable = feather || levels || (pct && prop.match_id == "scale");
- let linked = linkable && app.ui.timeline.is_linked(uid, !levels);
+ // Rectangle and Ellipse Path Size have it too, off by default (#2489).
+ let size = prop.match_id == "size" && layer.props.parent_of(uid).is_some_and(|g| matches!(g.match_id.as_str(), "rect" | "ellipse"));
- let linkable = feather || size || (pct && prop.match_id == "scale");
- let linked = linkable && app.ui.timeline.is_linked(uid, !size);
++ let linkable = feather || size || levels || (pct && prop.match_id == "scale");
++ let linked = linkable && app.ui.timeline.is_linked(uid, !(size || levels));
if linkable {
let lr = Rect::from_center_size(pos2(x + 7.0, at.y), vec2(14.0, 14.0));
- let resp = ui.interact(lr, egui::Id::unique(("tl-link", uid)), Sense::click()).on_hover_text(crate::i18n::tr("Constrain Proportions"));
+ let label = if levels { "Link Channels" } else { "Constrain Proportions" };
+ let resp = ui.interact(lr, egui::Id::unique(("tl-link", uid)), Sense::click()).on_hover_text(crate::i18n::tr(label));
icons::paint(p, lr, Icon::Link, if linked { t.accent } else { t.text_faint });
- app.auto.add(&format!("timeline.prop.{uid}.link"), lr, "Constrain Proportions");
+ app.auto.add(&format!("timeline.prop.{uid}.link"), lr, label);
if resp.clicked() {
- app.ui.timeline.toggle_link(uid, !levels);
- app.ui.timeline.toggle_link(uid, !size);
++ app.ui.timeline.toggle_link(uid, !(size || levels));
}
x += 18.0;
}
diff --cc crates/ui-egui/src/state.rs
index d10676a5c,c1320054a..6abe76b2f
--- a/crates/ui-egui/src/state.rs
+++ b/crates/ui-egui/src/state.rs
@@@ -308,8 -308,8 +308,8 @@@ impl Default for ViewerState
impl TimelineState {
/// Whether property `uid`'s chain link (Constrain Proportions) is on. One that starts linked
- /// (Scale, Mask Feather) records a click in `unlinked`; one that starts unlinked (Audio Levels)
- /// (Scale, Mask Feather) records a click in `unlinked`; one that starts unlinked (shape Size)
-- /// records it in `linked`.
++ /// (Scale, Mask Feather) records a click in `unlinked`; one that starts unlinked (shape Size,
++ /// Audio Levels) records it in `linked`.
pub fn is_linked(&self, uid: u64, linked_by_default: bool) -> bool {
if linked_by_default { !self.unlinked.contains(&uid) } else { self.linked.contains(&uid) }
}
@@@ -439,12 -429,10 +439,13 @@@ pub struct TimelineState
/// was turned off.
#[serde(default)]
pub unlinked: BTreeSet<u64>,
- /// Audio Levels properties whose channel link (off by default) was turned on (#2485).
- /// Shape Rectangle and Ellipse Path Size properties whose chain link (off by default) was
- /// turned on (#2489).
++ /// Shape Rectangle and Ellipse Path Size (#2489) and Audio Levels (#2485) properties whose
++ /// chain link (off by default) was turned on.
#[serde(default)]
pub linked: BTreeSet<u64>,
+ /// The project (its epoch) `unlinked` and `linked` belong to.
+ #[serde(skip)]
+ pub link_epoch: u64,
/// Visible optional columns (column header right-click ▸ Columns): `av`, `keys`, `label`,
/// `num`, `comment`, `switches`, `parent`, `in`, `out`, `duration`, `stretch`. The name
/// column is always shown; Modes follows `show_modes` (F4).