Skip to content

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

Merge main into M13.2

Brandon Thomas7ac5317ce997
diff --cc crates/engine/src/commands/file.rs
index 661169e0b,fcff953b1..fe057683a
--- a/crates/engine/src/commands/file.rs
+++ b/crates/engine/src/commands/file.rs
@@@ -410,7 -449,7 +478,7 @@@ pub fn specs() -> Vec<CommandSpec>
"File...",
["File", "Import"],
Some("Cmd+I"),
- "{paths: [string], importAs?: footage|composition|compositionLayerSizes (Photoshop, PDF, Illustrator and EPS files), layer?: name|index (footage of one Photoshop layer)}",
- "{paths: [string], importAs?: footage|composition|compositionLayerSizes (Photoshop files), layer?: name|index (footage of one Photoshop layer), drag?: bool (dropped files: Settings ▸ Import ▸ Default Drag Import As)}",
++ "{paths: [string], importAs?: footage|composition|compositionLayerSizes (Photoshop, PDF, Illustrator and EPS files), layer?: name|index (footage of one Photoshop layer), drag?: bool (dropped files: Settings ▸ Import ▸ Default Drag Import As)}",
always,
import
),
diff --cc crates/engine/src/lib.rs
index f28c07a7a,f7fda4871..17d9b235d
--- a/crates/engine/src/lib.rs
+++ b/crates/engine/src/lib.rs
@@@ -748,10 -824,67 +824,72 @@@ pub fn text_families() -> Vec<String>
effectcraft_text::families().into_iter().map(|(f, _)| f).collect()
}
+/// The OpenType feature tags (GSUB / GPOS) of the face a family + style resolves to.
+pub fn font_features(family: &str, style: &str) -> Vec<String> {
+ effectcraft_text::fonts::face(effectcraft_text::resolve(family, style).face).features()
+}
++
+ /// One row of the Character panel's font menu.
+ #[derive(Clone, Debug, PartialEq)]
+ pub struct FontRow {
+ /// The family to apply (empty for the separator after the recent fonts).
+ pub family: String,
+ /// What the menu shows: the English family name, or the font's own-language name when
+ /// Settings ▸ Type ▸ Show Font Names in English is off.
+ pub display: String,
+ pub recent: bool,
+ }
+
+ /// Outline polylines of "Sample" set in `family` at `size` px (baseline at y = 0, y down), for
+ /// the font menu's preview (Settings ▸ Type ▸ Show Font Preview).
+ pub fn font_preview(family: &str, size: f64) -> Vec<Vec<[f32; 2]>> {
+ use kurbo::PathEl;
+ let st = effectcraft_keyframe::text_doc::CharStyle { font: family.to_string(), size, ..Default::default() };
+ let mut out = vec![];
+ let mut x = 0.0;
+ for ch in "Sample".chars() {
+ let (path, adv) = effectcraft_text::char_glyph_style(&st, ch);
+ let mut cur: Vec<[f32; 2]> = vec![];
+ let pt = |p: kurbo::Point| [(p.x + x) as f32, p.y as f32];
+ kurbo::flatten(&path, 0.2, |el| match el {
+ PathEl::MoveTo(p) => {
+ if cur.len() > 1 {
+ out.push(std::mem::take(&mut cur));
+ }
+ cur = vec![pt(p)];
+ }
+ PathEl::LineTo(p) => cur.push(pt(p)),
+ PathEl::ClosePath => {
+ if let Some(f) = cur.first().copied() {
+ cur.push(f);
+ }
+ if cur.len() > 1 {
+ out.push(std::mem::take(&mut cur));
+ }
+ }
+ _ => {}
+ });
+ if cur.len() > 1 {
+ out.push(cur);
+ }
+ x += adv;
+ }
+ out
+ }
+
+ /// The Character panel's font menu: the recent fonts (Settings ▸ Type ▸ Number of Recent Fonts
+ /// to Display), a separator, then every family.
+ pub fn font_menu(prefs: &prefs::Prefs) -> Vec<FontRow> {
+ let all = text_families();
+ let native = if prefs.type_.font_names_in_english { Default::default() } else { effectcraft_text::fonts::native_families() };
+ let row = |f: &String, recent: bool| FontRow { family: f.clone(), display: native.get(f).cloned().unwrap_or_else(|| f.clone()), recent };
+ let mut out: Vec<FontRow> = prefs.recent_fonts_shown().iter().filter(|f| all.contains(f)).map(|f| row(f, true)).collect();
+ if !out.is_empty() {
+ out.push(FontRow { family: String::new(), display: "-".into(), recent: false });
+ }
+ out.extend(all.iter().map(|f| row(f, false)));
+ out
+ }
#[cfg(test)]
mod tests_paint;
#[cfg(test)]
diff --cc crates/render/src/three_d/compose.rs
index c97b78bb4,a4bf7f20d..25755a474
--- a/crates/render/src/three_d/compose.rs
+++ b/crates/render/src/three_d/compose.rs
@@@ -161,16 -161,9 +161,16 @@@ pub(crate) fn camera_for(r: &Renderer,
}
}
+/// The size of the comp the camera looks through: a collapsed precomp's layers are projected
+/// into the outermost comp they collapse into (its centre and size), not their own comp's.
+pub(crate) fn view_size(r: &Renderer, ctx: &EvalCtx) -> (f64, f64) {
+ let c = r.collapse3d.map_or(ctx.comp, |c| c.parent.comp);
+ (c.width as f64, c.height as f64)
+}
+
/// Number of motion-blur sub-samples for a layer.
fn mb_samples(r: &Renderer, ctx: &EvalCtx, layer: &Layer) -> usize {
- if r.opts.motion_blur && ctx.comp.enable_motion_blur && layer.switches.motion_blur {
+ if r.opts.motion_blur && ctx.comp.enable_motion_blur && r.layer_motion_blur(layer) {
if r.opts.draft { 4 } else { ctx.comp.motion_blur_samples.clamp(2, 64) as usize }
} else {
1
diff --cc crates/ui-egui/src/panels/text_panels.rs
index 61c0f215d,6f72af125..81b9d0771
--- a/crates/ui-egui/src/panels/text_panels.rs
+++ b/crates/ui-egui/src/panels/text_panels.rs
@@@ -98,12 -98,11 +98,11 @@@ pub fn character(app: &mut EffectcraftA
widgets::open_popup(ui, pop);
}
app.auto.add("character.font", fr, "Font family");
- let fams: Vec<String> = effectcraft_engine::text_families();
- if let Some(i) = widgets::popup_menu(ui, pop, fr.left_bottom(), &fams, fams.iter().position(|f| *f == doc.font)) {
- actions.push(json!({"font": fams[i]}));
+ if let Some(f) = font_popup(app, ui, pop, fr.left_bottom(), &doc.font) {
+ actions.push(json!({"font": f}));
}
y += 28.0;
- let sr = Rect::from_min_size(pos2(x0, y), vec2(w, 22.0));
+ let sr = Rect::from_min_size(pos2(x0, y), vec2(w - 84.0, 22.0));
let spop = egui::Id::new("char-style-pop");
if widgets::dropdown(ui, sr, &doc.style, &t, egui::Id::new("char-style")).clicked() && enabled {
widgets::open_popup(ui, spop);
diff --cc docs/parity.md
index 68717920d,9c2b2d47c..3974630f0
--- a/docs/parity.md
+++ b/docs/parity.md
@@@ -21,10 -21,8 +21,8 @@@ Tracking 88%, Effects 85%, Web 65%
What is left, in priority order: the web app's depth (threads, storage, audio, non-blocking
renders); stroke taper/wave and multi-segment dashes; variable mask feather points; camera iris/bokeh and focus-link commands; Render Queue field render, crop/resize and templates;
-approximated effects (Subspace Warp, Key Cleaner) and Liquify's viewer brush; OpenType features and variable
-font axes; AI/EPS/PDF import; more codecs; 59 preferences not yet wired; ScriptUI; face tracking; and the "better than After Effects" items (a plug-in API, branching history; GPU particles landed in M12.7).
+approximated effects (Subspace Warp, Key Cleaner) and Liquify's viewer brush; text in imported
- PDF/AI files and Illustrator procset EPS; more codecs; 59 preferences not yet wired; ScriptUI;
- Lumetri Scopes, Footage, Media Browser and Metadata panels; Content-Aware Fill; face tracking; and
- the "better than After Effects" items (a plug-in API, branching history; GPU particles landed in M12.7).
++PDF/AI files and Illustrator procset EPS; more codecs; 59 preferences not yet wired; ScriptUI; face tracking; and the "better than After Effects" items (a plug-in API, branching history; GPU particles landed in M12.7).
The sections below are the original audit (morning of 2 October, ≈ 64%) and its updates, kept for
history.