Skip to content

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

Merge main into #1897; EvalCtx in convert_to_bezier built with ..EvalCtx::new

bflatastic480d1ba2bf14
diff --cc crates/engine/src/cmd/paths.rs
index 7cd457640,0bb2eaae2..8364f67ec
--- a/crates/engine/src/cmd/paths.rs
+++ b/crates/engine/src/cmd/paths.rs
@@@ -173,24 -160,6 +173,22 @@@ fn convert_to_bezier(s: &mut Session, p
}
let t = s.time();
let n = shapes.len();
+ // Read the geometry before editing, with the same expression-aware context the renderer
+ // uses: an expression-driven corner radius, size or position must convert to what is on
+ // screen, not to the property's underlying value.
- let expr = s.expr.clone();
+ let prepared = {
+ let comp = s.project.comp(cid).ok_or(EngineError::NoComp)?;
- let ctx =
- EvalCtx { project: &s.project, comp_id: cid, comp, time: t, expr: expr.as_deref(), footage: None, property_overrides: &[], media_overrides: &[] };
++ let ctx = EvalCtx { expr: s.expr.as_deref(), ..EvalCtx::new(&s.project, cid, comp, t) };
+ let mut prepared = Vec::new();
+ for (lid, uid) in &shapes {
+ let Some(l) = comp.layer(*lid) else { continue };
+ let Some(old) = l.props.sub("contents").and_then(|c| c.find_group(*uid)) else { continue };
+ let Some(path) = parametric_path(&ctx, l, old) else { continue };
+ // Path Direction is the shape's own, not a default: reversing is a separate command.
+ prepared.push((*lid, *uid, path, ctx.e(l, old, "direction"), old.enabled));
+ }
+ prepared
+ };
let made = s.edit("Convert To Bezier Path", None, |proj, st| {
let mut next = proj.next_id;
let mut made = Vec::new();