Skip to content

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

Merge main into #2245; no conflicts; layer_fill_stroke's EvalCtx built with ..EvalCtx::new

bflatastic47709b4afcfa
diff --cc crates/ui-egui/src/panels/text_panels.rs
index 33e9703b0,2e7e62a08..beadf1f53
--- a/crates/ui-egui/src/panels/text_panels.rs
+++ b/crates/ui-egui/src/panels/text_panels.rs
@@@ -227,36 -205,6 +227,27 @@@ fn line_join_field(app: &mut Effectcraf
}
}
+/// Sets the layer's More Options > Fill & Stroke to `v` together with the per-character order
+/// it changes, as one undo step.
+fn apply_layer_fill_stroke(app: &mut EffectcraftApp, ctx: &egui::Context, tt: &TextTarget, v: u32, actions: Vec<serde_json::Value>) {
+ let set = json!({"command": "prop.set", "params": {"layer": tt.layer, "path": "text/moreOptions/fillStroke", "value": v}});
+ let steps: Vec<serde_json::Value> =
+ std::iter::once(set).chain(actions.into_iter().map(|a| json!({"command": "layer.setText", "params": tt.params(a)}))).collect();
+ if let Err(e) = crate::menus::invoke(app, ctx, "engine.batch", json!({"steps": steps, "label": "Stroke Order"})) {
+ app.ui.status = e;
+ }
+}
+
+/// A text layer's More Options > Fill & Stroke in the active comp: 0 per character palette,
+/// 1 all fills over all strokes, 2 all strokes over all fills.
+fn layer_fill_stroke(app: &EffectcraftApp, layer: u64) -> u32 {
+ let (Some(comp), Some(cid)) = (app.session.active_comp(), app.session.active_comp_id()) else { return 0 };
+ let Some(l) = comp.layer(effectcraft_engine::project::LayerId(layer)) else { return 0 };
+ let Some(more) = l.props.sub("text").and_then(|t| t.sub("moreOptions")) else { return 0 };
- let ectx = EvalCtx {
- project: &app.session.project,
- comp_id: cid,
- comp,
- time: app.session.time(),
- expr: app.session.expr.as_deref(),
- footage: None,
- property_overrides: &[],
- media_overrides: &[],
- };
++ let ectx = EvalCtx { expr: app.session.expr.as_deref(), ..EvalCtx::new(&app.session.project, cid, comp, app.session.time()) };
+ ectx.e(l, more, "fillStroke")
+}
+
/// The Character panel for the text being edited (or the selected text layer): font family and
/// style, size, leading, tracking, stroke, scale, baseline shift and other numeric fields, kerning,
/// fill/stroke colours with eyedroppers, style toggles, OpenType features and variable-font axes.