Merge main into M14.5 (settings and menus)

Reconciled with main's keyframe labels (same Keyframe::label field; keys.setLabel and
keys.selectLabelGroup from main are kept, M14.5's duplicates removed; Edit ▸ Label on
selected keys delegates to the label helper), proxies (RenderOpts::proxy next to
nested_switches/draft_shadows), offloaded renders (Work carries nested_switches), wasm
audio pump (preview mix rate), variable font axes and mask feather points.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-03 03:11:45 -04:00
co-authored by Claude Opus 5.5
196 changed files with 18527 additions and 2382 deletions
+2 -3
View File
@@ -14,7 +14,7 @@ pub mod value;
use effectcraft_time::{TICKS_PER_SECOND, Tick};
use serde::{Deserialize, Serialize};
pub use text_doc::{BaselineOption, CharStyle, Composer, Direction, Kerning, ParaStyle, StyleRun};
pub use value::{Gradient, Justify, ShapePath, TextDoc, Value};
pub use value::{FeatherPoint, Gradient, Justify, ShapePath, TextDoc, Value};
/// Temporal interpolation on one side of a keyframe.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
@@ -84,8 +84,7 @@ pub struct Keyframe {
pub spatial_continuous: bool,
#[serde(default)]
pub roving: bool,
/// Keyframe colour label (Edit ▸ Label on selected keyframes): 0 = None, 1–16 = the 16
/// label colours (Red … Dark Green).
/// Keyframe color label: index into the label list (0 = None).
#[serde(default, skip_serializing_if = "is_zero")]
pub label: u8,
}
+19 -1
View File
@@ -172,6 +172,11 @@ pub struct CharStyle {
pub baseline: BaselineOption,
pub kerning: Kerning,
pub ligatures: bool,
/// Vertical type: set these characters horizontally within the column (Tate-Chu-Yoko).
pub tate_chu_yoko: bool,
/// Vertical type: keep Roman (half-width) characters upright instead of turning them on
/// their side (Character panel menu ▸ Standard Vertical Roman Alignment).
pub vertical_roman_upright: bool,
}
impl Default for CharStyle {
@@ -250,6 +255,9 @@ pub struct TextDoc {
pub kerning: Kerning,
#[serde(default = "yes")]
pub ligatures: bool,
/// Base Tate-Chu-Yoko and Standard Vertical Roman Alignment (see [`CharStyle`]).
pub tate_chu_yoko: bool,
pub vertical_roman_upright: bool,
pub indent_left: f64,
pub indent_right: f64,
pub indent_first: f64,
@@ -299,6 +307,8 @@ impl Default for TextDoc {
baseline: BaselineOption::Normal,
kerning: Kerning::Metrics,
ligatures: true,
tate_chu_yoko: false,
vertical_roman_upright: false,
indent_left: 0.0,
indent_right: 0.0,
indent_first: 0.0,
@@ -383,6 +393,8 @@ impl TextDoc {
baseline: self.baseline,
kerning: self.kerning,
ligatures: self.ligatures,
tate_chu_yoko: self.tate_chu_yoko,
vertical_roman_upright: self.vertical_roman_upright,
}
}
@@ -408,6 +420,8 @@ impl TextDoc {
self.baseline = s.baseline;
self.kerning = s.kerning;
self.ligatures = s.ligatures;
self.tate_chu_yoko = s.tate_chu_yoko;
self.vertical_roman_upright = s.vertical_roman_upright;
}
/// The base (first paragraph's) settings.
@@ -792,6 +806,8 @@ pub const CHAR_ATTRS: &[&str] = &[
"subscript",
"kerning",
"ligatures",
"tateChuYoko",
"verticalRomanUpright",
];
/// Paragraph attribute keys of `layer.setText`.
@@ -851,6 +867,8 @@ pub fn apply_char_attr(s: &mut CharStyle, key: &str, v: &J) -> Result<bool, Stri
}
"kerning" => s.kerning = Kerning::parse(v).ok_or("kerning: expected metrics|optical|number")?,
"ligatures" => s.ligatures = flag(key, v)?,
"tateChuYoko" => s.tate_chu_yoko = flag(key, v)?,
"verticalRomanUpright" => s.vertical_roman_upright = flag(key, v)?,
_ => return Ok(false),
}
Ok(true)
@@ -896,7 +914,7 @@ pub fn char_style_json(s: &CharStyle) -> J {
"tracking": s.tracking, "leading": s.leading.map_or(J::from("auto"), J::from), "baselineShift": s.baseline_shift,
"hScale": s.h_scale, "vScale": s.v_scale, "tsume": s.tsume, "fauxBold": s.faux_bold, "fauxItalic": s.faux_italic,
"allCaps": s.all_caps, "smallCaps": s.small_caps, "baseline": s.baseline.key(), "kerning": s.kerning.to_json(),
"ligatures": s.ligatures,
"ligatures": s.ligatures, "tateChuYoko": s.tate_chu_yoko, "verticalRomanUpright": s.vertical_roman_upright,
})
}
+89 -1
View File
@@ -10,15 +10,79 @@ pub struct ShapePath {
pub in_tangents: Vec<[f64; 2]>,
pub out_tangents: Vec<[f64; 2]>,
pub closed: bool,
/// Variable-width mask feather points (Mask Feather tool). They travel with the path, so a
/// Mask Path keyframe carries them.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub feather: Vec<FeatherPoint>,
}
/// A mask feather point: a position on the path (segment `segment`, from vertex `segment` to the
/// next, at Bezier parameter `t`), a signed feather `radius` in pixels (positive = outer
/// feather, negative = inner) and a `tension` 0–1 (0: the radius blends smoothly to the
/// neighbouring points, 1: linearly).
#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct FeatherPoint {
pub segment: usize,
pub t: f64,
pub radius: f64,
#[serde(default)]
pub tension: f64,
}
impl ShapePath {
pub fn polygon(points: &[[f64; 2]], closed: bool) -> ShapePath {
ShapePath { vertices: points.to_vec(), in_tangents: vec![[0.0; 2]; points.len()], out_tangents: vec![[0.0; 2]; points.len()], closed }
ShapePath {
vertices: points.to_vec(),
in_tangents: vec![[0.0; 2]; points.len()],
out_tangents: vec![[0.0; 2]; points.len()],
closed,
feather: Vec::new(),
}
}
pub fn len(&self) -> usize {
self.vertices.len()
}
/// Number of segments (vertex to next vertex, the closing one included).
pub fn segment_count(&self) -> usize {
let n = self.vertices.len();
if self.closed { n } else { n.saturating_sub(1) }
}
/// Keep feather points in place after a vertex was inserted at `i` (segments from `i` on
/// shift by one; a split of segment `i - 1` at parameter `split` re-parameterises its points).
pub fn feather_after_insert(&mut self, i: usize, split: Option<f64>) {
for f in &mut self.feather {
if i > 0 && f.segment == i - 1 {
if let Some(t) = split.filter(|t| *t > 0.0 && *t < 1.0) {
if f.t < t {
f.t /= t;
} else {
f.segment += 1;
f.t = (f.t - t) / (1.0 - t);
}
}
} else if f.segment >= i {
f.segment += 1;
}
}
}
/// Keep feather points after vertex `i` was removed: its two segments merge.
pub fn feather_after_remove(&mut self, i: usize) {
let segs = self.segment_count();
self.feather.retain_mut(|f| {
if i == 0 && f.segment == 0 && !self.closed {
return false;
}
if i > 0 && f.segment == i - 1 {
f.t *= 0.5;
} else if f.segment == i && i > 0 {
f.segment = i - 1;
f.t = 0.5 + f.t * 0.5;
} else if f.segment > i || (i == 0 && f.segment > 0) {
f.segment -= 1;
}
f.segment < segs.max(1)
});
}
pub fn is_empty(&self) -> bool {
self.vertices.is_empty()
}
@@ -36,6 +100,7 @@ impl ShapePath {
in_tangents: vec![[-rx * K, 0.0], [0.0, -ry * K], [rx * K, 0.0], [0.0, ry * K]],
out_tangents: vec![[rx * K, 0.0], [0.0, ry * K], [-rx * K, 0.0], [0.0, -ry * K]],
closed: true,
feather: Vec::new(),
}
}
fn lerp(&self, o: &ShapePath, t: f64) -> ShapePath {
@@ -48,6 +113,29 @@ impl ShapePath {
in_tangents: l(&self.in_tangents, &o.in_tangents),
out_tangents: l(&self.out_tangents, &o.out_tangents),
closed: self.closed,
// Feather points interpolate when both keys have the same points.
feather: if self.feather.len() == o.feather.len() {
self.feather
.iter()
.zip(&o.feather)
.map(|(a, b)| FeatherPoint {
segment: if t < 1.0 { a.segment } else { b.segment },
t: if a.segment == b.segment {
a.t + (b.t - a.t) * t
} else if t < 1.0 {
a.t
} else {
b.t
},
radius: a.radius + (b.radius - a.radius) * t,
tension: a.tension + (b.tension - a.tension) * t,
})
.collect()
} else if t < 1.0 {
self.feather.clone()
} else {
o.feather.clone()
},
}
}
}