M6.6: mask tracking + mask interpolation; M12.5: Warp Stabilizer
Mask tracking (track.mask, background job with progress/cancel, one undo step, Mask Path keys; Tracker panel mask mode; Layer > Mask > Track Mask), Mask Interpolation panel + mask.interpolate, and the Warp Stabilizer effect (Effect > Distort, AE parameter groups, warp.analyze/cancel/status, analysis stored in the effect, invalidation on source/in/out/remap edits, viewer banner, crop/auto-scale/synthesize edges, track points). Adds the effects -> track same-layer edge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4bcf1f447c
commit
9645ff9a66
@@ -33,10 +33,11 @@ pub enum PanelKind {
|
||||
Flowchart,
|
||||
History,
|
||||
Markers,
|
||||
MaskInterpolation,
|
||||
}
|
||||
|
||||
impl PanelKind {
|
||||
pub const ALL: [PanelKind; 23] = [
|
||||
pub const ALL: [PanelKind; 24] = [
|
||||
PanelKind::Project,
|
||||
PanelKind::EffectControls,
|
||||
PanelKind::Composition,
|
||||
@@ -60,6 +61,7 @@ impl PanelKind {
|
||||
PanelKind::Flowchart,
|
||||
PanelKind::History,
|
||||
PanelKind::Markers,
|
||||
PanelKind::MaskInterpolation,
|
||||
];
|
||||
pub fn title(self) -> &'static str {
|
||||
match self {
|
||||
@@ -86,6 +88,7 @@ impl PanelKind {
|
||||
PanelKind::Flowchart => "Flowchart",
|
||||
PanelKind::History => "History",
|
||||
PanelKind::Markers => "Markers",
|
||||
PanelKind::MaskInterpolation => "Mask Interpolation",
|
||||
}
|
||||
}
|
||||
pub fn id(self) -> String {
|
||||
|
||||
@@ -718,6 +718,15 @@ impl EffectcraftApp {
|
||||
self.session.poll_track();
|
||||
ctx.request_repaint_after(std::time::Duration::from_millis(50));
|
||||
}
|
||||
if self.session.mask_job.is_some() {
|
||||
self.session.poll_mask_track();
|
||||
ctx.request_repaint_after(std::time::Duration::from_millis(50));
|
||||
}
|
||||
// Warp Stabilizer: finish analyses and start queued (re-)analyses in the background.
|
||||
if self.session.warp_job.is_some() || !self.session.warp_pending.is_empty() {
|
||||
self.session.poll_warp(true);
|
||||
ctx.request_repaint_after(std::time::Duration::from_millis(100));
|
||||
}
|
||||
self.apply_prefs(&ctx);
|
||||
self.handle_events(&ctx);
|
||||
self.tick_autosave(&ctx);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Wiggler, Smoother and Motion Sketch panels (Window menu). Their settings live in
|
||||
//! Wiggler, Smoother, Motion Sketch and Mask Interpolation panels (Window menu). Their settings live in
|
||||
//! [`crate::state::AnimToolsState`] (serde, so agents can read and set them); Apply runs the
|
||||
//! engine commands `keys.wiggle`, `keys.smooth` and `motion.sketch`.
|
||||
//!
|
||||
@@ -294,3 +294,111 @@ pub fn sketch_overlay(app: &mut EffectcraftApp, ui: &mut egui::Ui) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Mask Interpolation panel: Keyframe Rate / Fields, Linear Vertex Paths, Bending Resistance,
|
||||
/// Quality, Add Mask Shape Vertices, Matching Method, 1:1 Vertex Matches, First Vertices Match;
|
||||
/// Apply runs `mask.interpolate` on the selected Mask Path keyframes. The options live in the
|
||||
/// editor state (`mask.interpolationOptions`).
|
||||
pub fn mask_interpolation(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
let t = app.tokens;
|
||||
let p = ui.painter().with_clip_rect(rect);
|
||||
let x0 = rect.min.x + 12.0;
|
||||
let xv = x0 + 130.0;
|
||||
let w = (rect.max.x - xv - 12.0).clamp(80.0, 200.0);
|
||||
let mut y = rect.min.y + 10.0;
|
||||
let o = app.session.state.mask_interp.clone();
|
||||
let mut changes = serde_json::Map::new();
|
||||
label(&p, x0, y, "Keyframe Rate:", &t);
|
||||
let auto = o.keyframe_rate.is_none();
|
||||
if let Some(i) = choice(app, ui, Rect::from_min_size(pos2(xv, y), vec2(70.0, 20.0)), "maskInterp.rateMode", &["Auto", "Custom"], usize::from(!auto)) {
|
||||
let fps = app.session.active_comp().map(|c| c.frame_rate.as_f64()).unwrap_or(30.0);
|
||||
changes.insert("keyframeRate".into(), if i == 0 { json!("auto") } else { json!(fps) });
|
||||
}
|
||||
if let Some(r) = o.keyframe_rate {
|
||||
let nr = number(app, ui, pos2(xv + 78.0, y), "maskInterp.rate", r, 0.5, (0.1, 1000.0), 1, " per second");
|
||||
if (nr - r).abs() > 1e-9 {
|
||||
changes.insert("keyframeRate".into(), json!(nr));
|
||||
}
|
||||
} else {
|
||||
p.text(pos2(xv + 78.0, y + 9.0), Align2::LEFT_CENTER, "per second", Tokens::ui(12.0), t.text_dim);
|
||||
}
|
||||
y += ROW;
|
||||
let mut check = |app: &mut EffectcraftApp, y: f32, key: &str, text: &str, on: bool| {
|
||||
if checkbox(app, ui, pos2(x0, y + 2.0), &format!("maskInterp.{key}"), text, on) != on {
|
||||
changes.insert(key.into(), json!(!on));
|
||||
}
|
||||
};
|
||||
check(app, y, "keyframeFields", "Keyframe Fields (doubles rate)", o.keyframe_fields);
|
||||
y += ROW;
|
||||
check(app, y, "linearVertexPaths", "Use \"Linear\" Vertex Paths", o.linear_vertex_paths);
|
||||
y += ROW;
|
||||
label(&p, x0, y, "Bending Resistance:", &t);
|
||||
let br = number(app, ui, pos2(xv, y), "maskInterp.bendingResistance", o.bending_resistance, 0.5, (0.0, 100.0), 0, "");
|
||||
if (br - o.bending_resistance).abs() > 1e-9 {
|
||||
changes.insert("bendingResistance".into(), json!(br));
|
||||
}
|
||||
y += ROW;
|
||||
label(&p, x0, y, "Quality:", &t);
|
||||
let q = number(app, ui, pos2(xv, y), "maskInterp.quality", o.quality, 0.5, (0.0, 100.0), 0, "");
|
||||
if (q - o.quality).abs() > 1e-9 {
|
||||
changes.insert("quality".into(), json!(q));
|
||||
}
|
||||
y += ROW;
|
||||
let add_on = o.add_vertices.is_some();
|
||||
if checkbox(app, ui, pos2(x0, y + 2.0), "maskInterp.addVerticesOn", "Add Mask Shape Vertices", add_on) != add_on {
|
||||
changes.insert("addVertices".into(), if add_on { json!(false) } else { json!(5.0) });
|
||||
}
|
||||
y += ROW;
|
||||
if let Some(v) = o.add_vertices {
|
||||
let nv = number(app, ui, pos2(x0 + 22.0, y), "maskInterp.addVertices", v, 0.2, (0.1, 2000.0), 1, "");
|
||||
if (nv - v).abs() > 1e-9 {
|
||||
changes.insert("addVertices".into(), json!(nv));
|
||||
}
|
||||
let units = ["pixels", "total", "percent"];
|
||||
let cur = units.iter().position(|u| *u == o.add_vertices_unit).unwrap_or(0);
|
||||
if let Some(i) = choice(
|
||||
app,
|
||||
ui,
|
||||
Rect::from_min_size(pos2(xv, y), vec2(w, 20.0)),
|
||||
"maskInterp.addVerticesUnit",
|
||||
&["Pixels Between Vertices", "Total Vertices", "Percentage of Outline"],
|
||||
cur,
|
||||
) {
|
||||
changes.insert("addVerticesUnit".into(), json!(units[i]));
|
||||
}
|
||||
}
|
||||
y += ROW;
|
||||
label(&p, x0, y, "Matching Method:", &t);
|
||||
let methods = ["auto", "curve", "polyline"];
|
||||
let cur = methods.iter().position(|m| *m == o.matching_method).unwrap_or(0);
|
||||
if let Some(i) = choice(app, ui, Rect::from_min_size(pos2(xv, y), vec2(w, 20.0)), "maskInterp.matchingMethod", &["Auto", "Curve", "Polyline"], cur) {
|
||||
changes.insert("matchingMethod".into(), json!(methods[i]));
|
||||
}
|
||||
y += ROW;
|
||||
let mut check = |app: &mut EffectcraftApp, y: f32, key: &str, text: &str, on: bool| {
|
||||
if checkbox(app, ui, pos2(x0, y + 2.0), &format!("maskInterp.{key}"), text, on) != on {
|
||||
changes.insert(key.into(), json!(!on));
|
||||
}
|
||||
};
|
||||
check(app, y, "oneToOne", "Use 1:1 Vertex Matches", o.one_to_one);
|
||||
y += ROW;
|
||||
check(app, y, "firstVerticesMatch", "First Vertices Match", o.first_vertices_match);
|
||||
y += ROW + 8.0;
|
||||
if !changes.is_empty()
|
||||
&& let Err(e) = app.session.execute("mask.interpolationOptions", serde_json::Value::Object(changes))
|
||||
{
|
||||
app.ui.status = e.to_string();
|
||||
}
|
||||
let b = Rect::from_min_size(pos2(rect.max.x - 92.0, y), vec2(80.0, 24.0));
|
||||
let enabled = app.session.state.selected_keys.len() >= 2;
|
||||
if widgets::text_button(ui, b, "Apply", enabled, &t, egui::Id::new("mi-apply")).clicked() {
|
||||
match app.session.execute("mask.interpolate", json!({})) {
|
||||
Ok(r) => app.ui.status = format!("Mask Interpolation: {} keyframes added ({} vertices)", r["keys"], r["vertices"]),
|
||||
Err(e) => app.ui.status = e.to_string(),
|
||||
}
|
||||
}
|
||||
app.auto.add("maskInterp.apply", b, "Apply");
|
||||
let msg = if enabled { "Applies to the selected Mask Path keyframes" } else { "Select two or more Mask Path keyframes" };
|
||||
p.text(pos2(x0, b.max.y + 16.0), Align2::LEFT_CENTER, msg, Tokens::ui(11.0), t.text_faint);
|
||||
let _ = (Color32::WHITE, Sense::hover(), Stroke::NONE);
|
||||
}
|
||||
|
||||
@@ -510,6 +510,33 @@ fn group_rows(
|
||||
}
|
||||
}
|
||||
|
||||
/// Warp Stabilizer's Analyze / Cancel buttons and analysis status.
|
||||
fn warp_editor(app: &mut EffectcraftApp, ui: &mut egui::Ui, p: &egui::Painter, layer: &Layer, g: &PropGroup, r: Rect, actions: &mut Actions) {
|
||||
let t = app.tokens;
|
||||
let running = app.session.warp_target().is_some_and(|(_, l, u)| l == layer.id && u == g.uid) && app.session.is_warp_analyzing();
|
||||
let busy = app.session.is_warp_analyzing();
|
||||
let b1 = Rect::from_min_size(pos2(r.min.x + 24.0, r.min.y + 4.0), vec2(84.0, 22.0));
|
||||
let b2 = Rect::from_min_size(pos2(b1.max.x + 8.0, b1.min.y), vec2(84.0, 22.0));
|
||||
if widgets::text_button(ui, b1, "Analyze", false, &t, egui::Id::new(("warp-analyze", g.uid))).clicked() && !busy {
|
||||
actions.push(("warp.analyze".into(), json!({"layer": layer.id.0, "effect": g.uid})));
|
||||
}
|
||||
app.auto.add(&format!("effectControls.warp.{}.analyze", g.uid), b1, "Analyze");
|
||||
if running {
|
||||
if widgets::text_button(ui, b2, "Cancel", false, &t, egui::Id::new(("warp-cancel", g.uid))).clicked() {
|
||||
actions.push(("warp.cancel".into(), json!({})));
|
||||
}
|
||||
app.auto.add(&format!("effectControls.warp.{}.cancel", g.uid), b2, "Cancel");
|
||||
}
|
||||
let analysed = matches!(g.get(effectcraft_engine::effects::warp_stab::ANALYSIS).map(|p| &p.value), Some(Value::Str(s)) if !s.is_empty());
|
||||
let status = match app.session.warp_progress() {
|
||||
Some(pr) if running => pr.banner(),
|
||||
_ if analysed => "Analysis complete".to_string(),
|
||||
_ if app.session.warp_pending.iter().any(|(_, l, u)| *l == layer.id && *u == g.uid) => "Waiting to analyze".to_string(),
|
||||
_ => "Not analyzed: click Analyze".to_string(),
|
||||
};
|
||||
p.text(pos2(r.min.x + 24.0, r.min.y + 38.0), Align2::LEFT_CENTER, status, Tokens::ui(11.5), t.text_dim);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Curves / Levels editors
|
||||
|
||||
@@ -517,6 +544,7 @@ fn group_rows(
|
||||
fn editor_height(effect: &str, width: f32) -> f32 {
|
||||
match effect {
|
||||
"ec.color.curves" => 34.0 + curves_size(width) + 26.0,
|
||||
effectcraft_engine::effects::warp_stab::ID => 50.0,
|
||||
"ec.color.levels" | "ec.color.levelsic" => 34.0 + 80.0 + 58.0,
|
||||
"ec.color.autolevels" | "ec.color.autocontrast" | "ec.color.autocolor" => 24.0 + 80.0 + 12.0,
|
||||
_ => 0.0,
|
||||
@@ -891,6 +919,7 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
if er.max.y >= body.min.y && er.min.y <= body.max.y {
|
||||
match effect.as_str() {
|
||||
"ec.color.curves" => curves_editor(app, ui, &bp, &layer, g, &ectx, er, &mut actions),
|
||||
effectcraft_engine::effects::warp_stab::ID => warp_editor(app, ui, &bp, &layer, g, er, &mut actions),
|
||||
"ec.color.levels" | "ec.color.levelsic" => levels_editor(app, ui, &bp, &layer, g, effect, &ectx, er, &mut actions),
|
||||
_ => histogram_only(app, ui, &bp, g, er),
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, p: PanelKind, rect: Rec
|
||||
PanelKind::Audio => misc::audio(app, ui, rect),
|
||||
PanelKind::History => misc::history(app, ui, rect),
|
||||
PanelKind::Markers => misc::markers(app, ui, rect),
|
||||
PanelKind::MaskInterpolation => anim_tools::mask_interpolation(app, ui, rect),
|
||||
PanelKind::Wiggler => anim_tools::wiggler(app, ui, rect),
|
||||
PanelKind::Smoother => anim_tools::smoother(app, ui, rect),
|
||||
PanelKind::MotionSketch => anim_tools::motion_sketch(app, ui, rect),
|
||||
|
||||
@@ -133,12 +133,15 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
// Track Camera / Warp Stabilizer (not available) and Track Motion / Stabilize Motion.
|
||||
let r1 = Rect::from_min_size(pos2(x0, y), vec2(half, 22.0));
|
||||
let r2 = Rect::from_min_size(pos2(x0 + half + 6.0, y), vec2(half, 22.0));
|
||||
let src_p = source.map(|l| json!({"layer": l.0})).unwrap_or_else(|| json!({}));
|
||||
button(app, ui, r1, "Track Camera", false, "tracker.trackCamera");
|
||||
button(app, ui, r2, "Warp Stabilizer", false, "tracker.warpStabilizer");
|
||||
let can_warp = app.session.is_enabled("track.warpStabilizer") && !app.session.is_warp_analyzing();
|
||||
if button(app, ui, r2, "Warp Stabilizer", can_warp, "tracker.warpStabilizer") {
|
||||
run(app, &ctx, "track.warpStabilizer", json!({}));
|
||||
}
|
||||
y += 28.0;
|
||||
let r1 = Rect::from_min_size(pos2(x0, y), vec2(half, 22.0));
|
||||
let r2 = Rect::from_min_size(pos2(x0 + half + 6.0, y), vec2(half, 22.0));
|
||||
let src_p = source.map(|l| json!({"layer": l.0})).unwrap_or_else(|| json!({}));
|
||||
if button(app, ui, r1, "Track Motion", can_track, "tracker.trackMotion") {
|
||||
run(app, &ctx, "track.motion", src_p.clone());
|
||||
}
|
||||
@@ -150,6 +153,11 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
p.text(pos2(x0, y + 8.0), Align2::LEFT_CENTER, "Open a composition to track motion.", Tokens::ui(12.0), t.text_faint);
|
||||
return;
|
||||
};
|
||||
// A selected mask switches the panel to mask tracking.
|
||||
if let Some((ml, mu)) = effectcraft_engine::commands::mask_interp::selected_mask(&app.session) {
|
||||
mask_mode(app, ui, &ctx, &p, rect, y, ml, mu);
|
||||
return;
|
||||
}
|
||||
let field_x = x0 + 100.0;
|
||||
let field_w = (w - 100.0).max(80.0);
|
||||
|
||||
@@ -334,6 +342,84 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
}
|
||||
}
|
||||
|
||||
/// The Tracker panel in mask mode: Method and the four track buttons (◀| ◀ ▶ |▶).
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn mask_mode(app: &mut EffectcraftApp, ui: &mut egui::Ui, ctx: &egui::Context, p: &egui::Painter, rect: Rect, mut y: f32, layer: LayerId, mask: Uid) {
|
||||
use effectcraft_engine::mask_track::MaskMethod;
|
||||
let t = app.tokens;
|
||||
let x0 = rect.min.x + 10.0;
|
||||
let w = (rect.width() - 20.0).max(120.0);
|
||||
let field_x = x0 + 100.0;
|
||||
let field_w = (w - 100.0).max(80.0);
|
||||
let name = app
|
||||
.session
|
||||
.active_comp()
|
||||
.and_then(|c| c.layer(layer))
|
||||
.and_then(|l| l.props.find_group(mask).map(|g| format!("{} ({})", g.name, l.name)))
|
||||
.unwrap_or_default();
|
||||
label(p, pos2(x0, y + 10.0), "Track Mask:", &t);
|
||||
p.text(pos2(field_x, y + 10.0), Align2::LEFT_CENTER, name, Tokens::ui(12.0), t.text);
|
||||
y += ROW;
|
||||
label(p, pos2(x0, y + 10.0), "Method:", &t);
|
||||
let method = app.session.state.mask_track_method;
|
||||
let dd = Rect::from_min_size(pos2(field_x, y), vec2(field_w, 20.0));
|
||||
let did = egui::Id::new("tracker-mask-method-dd");
|
||||
if widgets::dropdown(ui, dd, method.label(), &t, did).clicked() {
|
||||
widgets::open_popup(ui, did);
|
||||
}
|
||||
app.auto.add("tracker.mask.method", dd, "Method");
|
||||
let labels: Vec<String> = MaskMethod::ALL.iter().map(|m| m.label().to_string()).collect();
|
||||
if let Some(i) = widgets::popup_menu(ui, did, dd.left_bottom(), &labels, MaskMethod::ALL.iter().position(|m| *m == method)) {
|
||||
run(app, ctx, "track.maskMethod", json!({"method": MaskMethod::ALL[i].id()}));
|
||||
}
|
||||
y += ROW + 6.0;
|
||||
label(p, pos2(x0, y + 11.0), "Track:", &t);
|
||||
let running = app.session.is_mask_tracking();
|
||||
let running_dir = app.session.mask_job.as_ref().map(|j| j.direction);
|
||||
let mut bx = field_x;
|
||||
for (dir, fwd, frame, id, tip) in [
|
||||
(effectcraft_engine::tracking::Direction::FrameBackward, false, true, "frameBackward", "Track selected masks 1 frame backward"),
|
||||
(effectcraft_engine::tracking::Direction::Backward, false, false, "backward", "Track selected masks backward"),
|
||||
(effectcraft_engine::tracking::Direction::Forward, true, false, "forward", "Track selected masks forward"),
|
||||
(effectcraft_engine::tracking::Direction::FrameForward, true, true, "frameForward", "Track selected masks 1 frame forward"),
|
||||
] {
|
||||
let r = Rect::from_min_size(pos2(bx, y), vec2(30.0, 22.0));
|
||||
let resp = ui.interact(r, egui::Id::new(("tracker-mask-track", id)), Sense::click()).on_hover_text(tip);
|
||||
let stop = running && running_dir == Some(dir) && !frame;
|
||||
let on = !running || stop;
|
||||
p.rect_filled(r, 4.0, if resp.hovered() && on { t.hover } else { t.field_bg });
|
||||
p.rect_stroke(r, 4.0, Stroke::new(1.0, t.field_border), StrokeKind::Inside);
|
||||
analyze_glyph(p, r, fwd, frame, stop, if on { t.text } else { t.text_faint });
|
||||
app.auto.add(&format!("tracker.mask.track.{id}"), r, tip);
|
||||
if resp.clicked() && on {
|
||||
if stop {
|
||||
run(app, ctx, "track.stop", json!({}));
|
||||
} else {
|
||||
run(app, ctx, "track.mask", json!({"layer": layer.0, "mask": mask, "direction": id}));
|
||||
}
|
||||
}
|
||||
bx += 34.0;
|
||||
}
|
||||
y += 34.0;
|
||||
if let Some(pr) = app.session.mask_track_progress() {
|
||||
let bar = Rect::from_min_size(pos2(x0, y), vec2(w, 6.0));
|
||||
p.rect_filled(bar, 3.0, t.field_bg);
|
||||
let f = if pr.total > 0 { pr.done as f32 / pr.total as f32 } else { 0.0 };
|
||||
p.rect_filled(Rect::from_min_size(bar.min, vec2(bar.width() * f.clamp(0.0, 1.0), 6.0)), 3.0, t.accent);
|
||||
app.auto.add("tracker.mask.progress", bar, "Mask tracking progress");
|
||||
p.text(
|
||||
pos2(x0, y + 18.0),
|
||||
Align2::LEFT_CENTER,
|
||||
format!("Tracking {} / {} frames ({:.0} fps)", pr.done, pr.total, pr.fps),
|
||||
Tokens::ui(11.0),
|
||||
t.text_dim,
|
||||
);
|
||||
ctx.request_repaint_after(std::time::Duration::from_millis(50));
|
||||
} else {
|
||||
p.text(pos2(x0, y + 8.0), Align2::LEFT_CENTER, "Tracks the pixels inside the mask and keys its Mask Path.", Tokens::ui(11.0), t.text_faint);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- dialogs
|
||||
|
||||
pub fn open_options(app: &mut EffectcraftApp) -> Result<(), String> {
|
||||
|
||||
@@ -562,6 +562,26 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
track_hits = super::tracker::draw_overlay(app, &painter, &map, &m, layer, tu, time);
|
||||
}
|
||||
|
||||
// Warp Stabilizer banner over the layer being analysed ("Analyzing in background (step 1
|
||||
// of 2)…" / "Stabilizing…").
|
||||
if let Some((wc, wl, _)) = app.session.warp_target()
|
||||
&& wc == cid
|
||||
&& let Some(pr) = app.session.warp_progress()
|
||||
&& let Some(layer) = comp.layer(wl)
|
||||
&& layer.is_active_at(time)
|
||||
{
|
||||
let (m, _) = l2c(&ectx, layer);
|
||||
let (w, h) = effectcraft_engine::render::source_size(&app.session.project, layer);
|
||||
let c = m.apply(effectcraft_engine::geom::vec2(w as f64 / 2.0, h as f64 / 2.0));
|
||||
let at = map.to_screen([c.x, c.y]);
|
||||
let text = pr.banner();
|
||||
let galley = painter.layout_no_wrap(text.clone(), Tokens::medium(13.0), Color32::WHITE);
|
||||
let r = Rect::from_center_size(at, galley.size() + vec2(28.0, 14.0)).intersect(map.area);
|
||||
painter.rect_filled(r, 3.0, Color32::from_rgba_unmultiplied(0x1d, 0x4f, 0x9c, 0xe0));
|
||||
painter.galley(pos2(r.center().x - galley.size().x / 2.0, r.center().y - galley.size().y / 2.0), galley, Color32::WHITE);
|
||||
app.auto.add("viewer.warpBanner", r, &text);
|
||||
}
|
||||
|
||||
// Free transform box of a path (double-click a path with the Selection tool).
|
||||
let ft = ov::draw_free_transform(app, &ctx, &painter, &map, &paths);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user