Merge main into M13.3 (tracking completion)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -36,10 +36,16 @@ pub enum PanelKind {
|
||||
MaskInterpolation,
|
||||
ScriptConsole,
|
||||
EssentialGraphics,
|
||||
LumetriScopes,
|
||||
Footage,
|
||||
MediaBrowser,
|
||||
Metadata,
|
||||
Progress,
|
||||
ContentAwareFill,
|
||||
}
|
||||
|
||||
impl PanelKind {
|
||||
pub const ALL: [PanelKind; 26] = [
|
||||
pub const ALL: [PanelKind; 32] = [
|
||||
PanelKind::Project,
|
||||
PanelKind::EffectControls,
|
||||
PanelKind::Composition,
|
||||
@@ -66,6 +72,12 @@ impl PanelKind {
|
||||
PanelKind::MaskInterpolation,
|
||||
PanelKind::ScriptConsole,
|
||||
PanelKind::EssentialGraphics,
|
||||
PanelKind::LumetriScopes,
|
||||
PanelKind::Footage,
|
||||
PanelKind::MediaBrowser,
|
||||
PanelKind::Metadata,
|
||||
PanelKind::Progress,
|
||||
PanelKind::ContentAwareFill,
|
||||
];
|
||||
pub fn title(self) -> &'static str {
|
||||
match self {
|
||||
@@ -95,6 +107,12 @@ impl PanelKind {
|
||||
PanelKind::MaskInterpolation => "Mask Interpolation",
|
||||
PanelKind::ScriptConsole => "Script Console",
|
||||
PanelKind::EssentialGraphics => "Essential Graphics",
|
||||
PanelKind::LumetriScopes => "Lumetri Scopes",
|
||||
PanelKind::Footage => "Footage",
|
||||
PanelKind::MediaBrowser => "Media Browser",
|
||||
PanelKind::Metadata => "Metadata",
|
||||
PanelKind::Progress => "Progress",
|
||||
PanelKind::ContentAwareFill => "Content-Aware Fill",
|
||||
}
|
||||
}
|
||||
pub fn id(self) -> String {
|
||||
@@ -102,7 +120,7 @@ impl PanelKind {
|
||||
}
|
||||
pub fn from_name(s: &str) -> Option<PanelKind> {
|
||||
let n = s.to_ascii_lowercase().replace([' ', '_', '-', '&'], "");
|
||||
Self::ALL.iter().copied().find(|p| format!("{p:?}").to_ascii_lowercase() == n || p.title().to_ascii_lowercase().replace([' ', '&'], "") == n)
|
||||
Self::ALL.iter().copied().find(|p| format!("{p:?}").to_ascii_lowercase() == n || p.title().to_ascii_lowercase().replace([' ', '&', '-'], "") == n)
|
||||
}
|
||||
/// Window-menu shortcut.
|
||||
pub fn window_shortcut(self) -> Option<&'static str> {
|
||||
@@ -295,7 +313,7 @@ pub fn workspace(name: &str) -> DockNode {
|
||||
hsplit(
|
||||
FixedA(360.0),
|
||||
tabs(&[EffectControls, Project], 0),
|
||||
hsplit(FixedB(300.0), tabs(&[Composition, Layer], 0), right(&[Info, Preview], &[EffectsPresets])),
|
||||
hsplit(FixedB(340.0), tabs(&[Composition, Layer], 0), right(&[LumetriScopes, Info, Preview], &[EffectsPresets])),
|
||||
),
|
||||
tabs(&[Timeline], 0),
|
||||
),
|
||||
@@ -315,17 +333,17 @@ pub fn workspace(name: &str) -> DockNode {
|
||||
Ratio(0.55),
|
||||
hsplit(
|
||||
FixedA(300.0),
|
||||
tabs(&[Project, EffectControls, Flowchart, History], 0),
|
||||
tabs(&[Project, EffectControls, Flowchart, History, MediaBrowser, Metadata], 0),
|
||||
hsplit(
|
||||
FixedB(300.0),
|
||||
tabs(&[Composition, Layer], 0),
|
||||
tabs(&[Composition, Layer, Footage], 0),
|
||||
right(
|
||||
&[Info, Preview, Audio, Align, Character, Paragraph],
|
||||
&[EffectsPresets, Properties, Tracker, Wiggler, Smoother, MotionSketch, Paint, Brushes, Markers],
|
||||
&[Info, Preview, Audio, Align, Character, Paragraph, LumetriScopes],
|
||||
&[EffectsPresets, Properties, Tracker, Wiggler, Smoother, MotionSketch, Paint, Brushes, Markers, ContentAwareFill],
|
||||
),
|
||||
),
|
||||
),
|
||||
tabs(&[Timeline, RenderQueue], 0),
|
||||
tabs(&[Timeline, RenderQueue, Progress], 0),
|
||||
),
|
||||
"Standard" => vsplit(
|
||||
Ratio(0.56),
|
||||
|
||||
@@ -791,6 +791,11 @@ impl EffectcraftApp {
|
||||
self.session.poll_mask_track();
|
||||
ctx.request_repaint_after(std::time::Duration::from_millis(50));
|
||||
}
|
||||
// Background tasks (Content-Aware Fill, Scene Edit Detection).
|
||||
if !self.session.tasks.is_empty() {
|
||||
self.session.poll_jobs();
|
||||
ctx.request_repaint_after(std::time::Duration::from_millis(100));
|
||||
}
|
||||
// Analyses running in a worker (the web app).
|
||||
if !self.session.offloaded.is_empty() {
|
||||
self.session.poll_offload();
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
//! Content-Aware Fill panel (Window ▸ Content-Aware Fill): Fill Target, Alpha Expansion, Fill
|
||||
//! Method (Object / Surface / Edge Blend), Lighting Correction, Range (Work Area / Entire
|
||||
//! Duration), a reference frame from a layer of the comp, and Generate Fill Layer. The settings
|
||||
//! live in `EditorState::content_fill` (`contentFill.set`); the button runs
|
||||
//! `contentFill.generate` as a background job (Window ▸ Progress).
|
||||
|
||||
use egui::{Align2, Rect, pos2, vec2};
|
||||
use serde_json::json;
|
||||
|
||||
use super::panel_kit as kit;
|
||||
use crate::EffectcraftApp;
|
||||
use crate::theme::Tokens;
|
||||
|
||||
const ROW: f32 = 28.0;
|
||||
|
||||
pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
let t = app.tokens;
|
||||
let p = ui.painter().with_clip_rect(rect);
|
||||
p.rect_filled(rect, 0.0, t.panel_bg);
|
||||
let x0 = rect.min.x + 12.0;
|
||||
let xv = x0 + 130.0;
|
||||
let w = (rect.max.x - xv - 12.0).clamp(90.0, 220.0);
|
||||
let mut y = rect.min.y + 10.0;
|
||||
let st = app.session.state.content_fill.clone();
|
||||
let comp = app.session.active_comp().cloned();
|
||||
let layer = comp.as_ref().and_then(|c| app.session.state.selected_layers.first().and_then(|l| c.layer(*l)).cloned());
|
||||
// Fill Target.
|
||||
p.text(pos2(x0, y + 9.0), Align2::LEFT_CENTER, "Fill Target", Tokens::semibold(12.0), t.text);
|
||||
y += ROW - 6.0;
|
||||
let target = match &layer {
|
||||
Some(l) => {
|
||||
let masks = l
|
||||
.masks()
|
||||
.map(|m| {
|
||||
m.groups()
|
||||
.filter(|g| {
|
||||
matches!(
|
||||
g.kind,
|
||||
effectcraft_engine::project::GroupKind::Mask { mode: effectcraft_engine::project::MaskMode::Subtract, .. }
|
||||
| effectcraft_engine::project::GroupKind::Mask { inverted: true, .. }
|
||||
)
|
||||
})
|
||||
.count()
|
||||
})
|
||||
.unwrap_or(0);
|
||||
format!("{} — {masks} subtracting mask(s)", l.name)
|
||||
}
|
||||
None => "Select a layer with a Subtract mask".into(),
|
||||
};
|
||||
p.text(pos2(x0, y + 9.0), Align2::LEFT_CENTER, &target, Tokens::ui(11.5), if layer.is_some() { t.text_dim } else { t.text_faint });
|
||||
app.auto.add("contentFill.target", Rect::from_min_size(pos2(x0, y), vec2(rect.width() - 24.0, 18.0)), &target);
|
||||
y += ROW;
|
||||
let mut set = serde_json::Map::new();
|
||||
// Alpha Expansion.
|
||||
kit::label(ui, pos2(x0, y), "Alpha Expansion:", &t);
|
||||
let a = kit::number(app, ui, pos2(xv, y), "contentFill.alphaExpansion", st.alpha_expansion, 0.2, (0.0, 100.0), 0, " px");
|
||||
if (a - st.alpha_expansion).abs() > 1e-9 {
|
||||
set.insert("alphaExpansion".into(), json!(a.round()));
|
||||
}
|
||||
y += ROW;
|
||||
// Fill Method.
|
||||
kit::label(ui, pos2(x0, y), "Fill Method:", &t);
|
||||
let methods = ["object", "surface", "edgeBlend"];
|
||||
let cur = methods.iter().position(|m| *m == st.method).unwrap_or(0);
|
||||
if let Some(i) = kit::dropdown(app, ui, Rect::from_min_size(pos2(xv, y), vec2(w, 20.0)), "contentFill.method", &["Object", "Surface", "Edge Blend"], cur) {
|
||||
set.insert("method".into(), json!(methods[i]));
|
||||
}
|
||||
y += ROW;
|
||||
// Lighting Correction (Object / Surface).
|
||||
kit::label(ui, pos2(x0, y), "Lighting Correction:", &t);
|
||||
let lights = ["none", "subtle", "moderate", "strong"];
|
||||
let cur = lights.iter().position(|m| *m == st.lighting_correction).unwrap_or(0);
|
||||
if st.method != "edgeBlend"
|
||||
&& let Some(i) =
|
||||
kit::dropdown(app, ui, Rect::from_min_size(pos2(xv, y), vec2(w, 20.0)), "contentFill.lighting", &["None", "Subtle", "Moderate", "Strong"], cur)
|
||||
{
|
||||
set.insert("lightingCorrection".into(), json!(lights[i]));
|
||||
}
|
||||
y += ROW;
|
||||
// Range.
|
||||
kit::label(ui, pos2(x0, y), "Range:", &t);
|
||||
let cur = usize::from(st.range == "entire");
|
||||
if let Some(i) = kit::dropdown(app, ui, Rect::from_min_size(pos2(xv, y), vec2(w, 20.0)), "contentFill.range", &["Work Area", "Entire Duration"], cur) {
|
||||
set.insert("range".into(), json!(if i == 1 { "entire" } else { "workArea" }));
|
||||
}
|
||||
y += ROW;
|
||||
// Reference frame: a layer of the comp at a time.
|
||||
kit::label(ui, pos2(x0, y), "Reference Frame:", &t);
|
||||
if let Some(c) = &comp {
|
||||
let mut names = vec!["None".to_string()];
|
||||
names.extend(c.layers.iter().map(|l| l.name.clone()));
|
||||
let cur = st.reference_layer.and_then(|r| c.layers.iter().position(|l| l.id == r)).map(|i| i + 1).unwrap_or(0);
|
||||
let opts: Vec<&str> = names.iter().map(String::as_str).collect();
|
||||
if let Some(i) = kit::dropdown(app, ui, Rect::from_min_size(pos2(xv, y), vec2(w, 20.0)), "contentFill.referenceLayer", &opts, cur) {
|
||||
set.insert("referenceLayer".into(), if i == 0 { json!(null) } else { json!(c.layers[i - 1].id.0) });
|
||||
}
|
||||
y += ROW;
|
||||
if st.reference_layer.is_some() {
|
||||
let at = st.reference_time.unwrap_or(0.0);
|
||||
p.text(pos2(xv, y + 9.0), Align2::LEFT_CENTER, format!("at {}", kit::seconds(at)), Tokens::ui(11.5), t.text_dim);
|
||||
if kit::button(app, ui, Rect::from_min_size(pos2(xv + 80.0, y), vec2(120.0, 20.0)), "contentFill.referenceHere", "Use Current Time", false) {
|
||||
set.insert("referenceTime".into(), json!(app.session.time().seconds()));
|
||||
}
|
||||
y += ROW;
|
||||
}
|
||||
} else {
|
||||
y += ROW;
|
||||
}
|
||||
if !set.is_empty() {
|
||||
kit::exec(app, "contentFill.set", serde_json::Value::Object(set));
|
||||
}
|
||||
// Generate, or the running job.
|
||||
y += 6.0;
|
||||
let running = app.session.jobs().into_iter().find(|j| j.kind == "contentFill");
|
||||
match running {
|
||||
Some(j) => {
|
||||
let frac = j.fraction.unwrap_or(0.0) as f32;
|
||||
let bar = Rect::from_min_size(pos2(x0, y + 7.0), vec2((rect.width() - 110.0).max(60.0), 6.0));
|
||||
p.rect_filled(bar, 3.0, t.field_bg);
|
||||
p.rect_filled(Rect::from_min_size(bar.min, vec2(bar.width() * frac, 6.0)), 3.0, t.accent);
|
||||
p.text(pos2(x0, y + 24.0), Align2::LEFT_CENTER, format!("{} {:.0} %", j.message, frac * 100.0), Tokens::ui(11.0), t.text_dim);
|
||||
if kit::button(app, ui, Rect::from_min_size(pos2(bar.max.x + 10.0, y), vec2(70.0, 20.0)), "contentFill.cancel", "Cancel", false) {
|
||||
kit::exec(app, "jobs.cancel", json!({"job": j.id}));
|
||||
}
|
||||
ui.ctx().request_repaint_after(std::time::Duration::from_millis(150));
|
||||
}
|
||||
None => {
|
||||
if kit::button(app, ui, Rect::from_min_size(pos2(x0, y), vec2(160.0, 24.0)), "contentFill.generate", "Generate Fill Layer", true) {
|
||||
match &layer {
|
||||
Some(l) => {
|
||||
kit::exec(app, "contentFill.generate", json!({"layer": l.id.0}));
|
||||
}
|
||||
None => app.ui.status = "Select the layer to fill first".into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
//! The Footage panel (double-click footage in the Project panel): the source on its own time
|
||||
//! ruler, play / pause, In and Out marks, and the Edit Target buttons — Overlay Edit and Ripple
|
||||
//! Insert Edit — that cut the marked range into the active composition at its current time.
|
||||
//! Everything runs `footage.*` commands (state in `EditorState::footage_panel`).
|
||||
|
||||
use effectcraft_engine::project::{FootageKind, ItemKind};
|
||||
use effectcraft_engine::time::Tick;
|
||||
use egui::{Align2, Color32, Rect, Sense, Stroke, pos2, vec2};
|
||||
use serde_json::json;
|
||||
|
||||
use super::panel_kit as kit;
|
||||
use crate::EffectcraftApp;
|
||||
use crate::theme::Tokens;
|
||||
|
||||
pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
let t = app.tokens;
|
||||
let ctx = ui.ctx().clone();
|
||||
let p = ui.painter().with_clip_rect(rect);
|
||||
p.rect_filled(rect, 0.0, t.pasteboard);
|
||||
let Some(view) = app.session.state.footage_panel.clone() else {
|
||||
p.text(rect.center(), Align2::CENTER_CENTER, "Double-click footage in the Project panel to open it here", Tokens::ui(12.0), t.text_faint);
|
||||
app.auto.add("footage.empty", rect, "Footage panel (empty)");
|
||||
return;
|
||||
};
|
||||
let Some(item) = app.session.project.item(view.item).cloned() else {
|
||||
app.session.state.footage_panel = None;
|
||||
return;
|
||||
};
|
||||
let footage = match &item.kind {
|
||||
ItemKind::Footage(f) => Some(f.clone()),
|
||||
_ => None,
|
||||
};
|
||||
let (dur, fr) = match &footage {
|
||||
Some(f) if f.kind != FootageKind::Still && f.duration > Tick::ZERO => (f.duration, f.frame_rate),
|
||||
Some(f) => (Tick::from_seconds_f64(10.0), f.frame_rate),
|
||||
None => (Tick::from_seconds_f64(10.0), effectcraft_engine::time::FrameRate::FPS_30),
|
||||
};
|
||||
// Title strip.
|
||||
let top = Rect::from_min_size(rect.min, vec2(rect.width(), 24.0));
|
||||
p.rect_filled(top, 0.0, t.panel_bg);
|
||||
p.text(pos2(top.min.x + 10.0, top.center().y), Align2::LEFT_CENTER, format!("Footage: {}", item.name), Tokens::semibold(12.0), t.text);
|
||||
app.auto.add("footage.title", top, &item.name);
|
||||
// Bottom: ruler and controls.
|
||||
// Rows, bottom up: Edit Target buttons, transport, ruler.
|
||||
let edit_row = Rect::from_min_max(pos2(rect.min.x, rect.max.y - 30.0), rect.max);
|
||||
let bar = Rect::from_min_max(pos2(rect.min.x, edit_row.min.y - 28.0), pos2(rect.max.x, edit_row.min.y));
|
||||
let ruler = Rect::from_min_max(pos2(rect.min.x + 10.0, bar.min.y - 26.0), pos2(rect.max.x - 10.0, bar.min.y - 4.0));
|
||||
p.rect_filled(Rect::from_min_max(pos2(rect.min.x, ruler.min.y - 4.0), rect.max), 0.0, t.panel_bg);
|
||||
// Canvas.
|
||||
let area = Rect::from_min_max(pos2(rect.min.x, top.max.y), pos2(rect.max.x, ruler.min.y - 4.0));
|
||||
if let Some(f) = &footage
|
||||
&& f.has_video
|
||||
{
|
||||
let key = (view.item.0, view.time.0, app.session.revision);
|
||||
let tid = egui::Id::new("footage-panel-tex");
|
||||
let cached: Option<((u64, i64, u64), egui::TextureHandle, [u32; 2])> = ctx.data(|d| d.get_temp(tid));
|
||||
let tex = match cached {
|
||||
Some((k, tex, size)) if k == key => Some((tex, size)),
|
||||
_ => app.session.footage.frame(view.item, f, view.time).map(|img| {
|
||||
let ci = egui::ColorImage::from_rgba_unmultiplied([img.width as usize, img.height as usize], &img.to_rgba8());
|
||||
let tex = ctx.load_texture("footage-panel", ci, egui::TextureOptions::LINEAR);
|
||||
ctx.data_mut(|d| d.insert_temp(tid, (key, tex.clone(), [img.width, img.height])));
|
||||
(tex, [img.width, img.height])
|
||||
}),
|
||||
};
|
||||
if let Some((tex, [w, h])) = tex {
|
||||
let s = ((area.width() - 20.0) / w as f32).min((area.height() - 20.0) / h as f32).max(0.01);
|
||||
let r = Rect::from_center_size(area.center(), vec2(w as f32 * s, h as f32 * s));
|
||||
super::viewer::checker(&p.with_clip_rect(area), r);
|
||||
p.image(tex.id(), r, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE);
|
||||
}
|
||||
} else if let ItemKind::Solid(so) = &item.kind {
|
||||
let c = so.color;
|
||||
p.rect_filled(area.shrink(20.0), 0.0, Color32::from_rgb((c[0] * 255.0) as u8, (c[1] * 255.0) as u8, (c[2] * 255.0) as u8));
|
||||
} else {
|
||||
p.text(area.center(), Align2::CENTER_CENTER, "No video", Tokens::ui(12.0), t.text_faint);
|
||||
}
|
||||
// Ruler: ticks, In/Out span, CTI; click or drag to scrub.
|
||||
let x_of = |tt: Tick| ruler.min.x + (tt.seconds() / dur.seconds().max(1e-9)) as f32 * ruler.width();
|
||||
p.rect_filled(ruler, 2.0, t.tl_ruler_bg);
|
||||
let secs = dur.seconds().max(0.001);
|
||||
let step = [0.04, 0.2, 1.0, 5.0, 10.0, 30.0, 60.0, 300.0].into_iter().find(|s| (secs / s) as f32 * 50.0 < ruler.width()).unwrap_or(600.0);
|
||||
let mut k = 0.0;
|
||||
while k <= secs {
|
||||
let x = ruler.min.x + (k / secs) as f32 * ruler.width();
|
||||
p.line_segment([pos2(x, ruler.max.y - 6.0), pos2(x, ruler.max.y)], Stroke::new(1.0, t.tl_ruler_tick));
|
||||
p.text(pos2(x + 2.0, ruler.min.y + 1.0), Align2::LEFT_TOP, kit::seconds(k), Tokens::ui(9.0), t.tl_ruler_text);
|
||||
k += step;
|
||||
}
|
||||
let (a, b) = (view.in_point.unwrap_or(Tick::ZERO), view.out_point.unwrap_or(dur));
|
||||
p.rect_filled(Rect::from_min_max(pos2(x_of(a), ruler.max.y - 4.0), pos2(x_of(b), ruler.max.y)), 0.0, t.work_area);
|
||||
let cx = x_of(view.time);
|
||||
p.line_segment([pos2(cx, ruler.min.y), pos2(cx, ruler.max.y)], Stroke::new(1.5, t.cti));
|
||||
let resp = ui.interact(ruler, egui::Id::new("footage-ruler"), Sense::click_and_drag());
|
||||
app.auto.add("footage.ruler", ruler, "Time ruler");
|
||||
if (resp.clicked() || resp.dragged())
|
||||
&& let Some(pt) = resp.interact_pointer_pos()
|
||||
{
|
||||
let s = ((pt.x - ruler.min.x) / ruler.width()).clamp(0.0, 1.0) as f64 * dur.seconds();
|
||||
kit::exec(app, "footage.setTime", json!({"time": s}));
|
||||
}
|
||||
// Playback.
|
||||
let play_id = egui::Id::new("footage-playing");
|
||||
let playing: bool = ctx.data(|d| d.get_temp(play_id).unwrap_or(false));
|
||||
if playing {
|
||||
let dt = ctx.input(|i| i.stable_dt).min(0.1) as f64;
|
||||
let next = view.time.seconds() + dt;
|
||||
let next = if next >= dur.seconds() - fr.frame_duration().seconds() { 0.0 } else { next };
|
||||
let _ = app.session.execute("footage.setTime", json!({"time": next}));
|
||||
ctx.request_repaint();
|
||||
}
|
||||
// Controls.
|
||||
let y = bar.min.y + 5.0;
|
||||
let mut x = bar.min.x + 10.0;
|
||||
p.text(
|
||||
pos2(x, bar.center().y),
|
||||
Align2::LEFT_CENTER,
|
||||
effectcraft_engine::time::format_timecode_ae(fr.frame_at(view.time), fr, false),
|
||||
Tokens::mono(12.0),
|
||||
t.timecode,
|
||||
);
|
||||
x += 92.0;
|
||||
if kit::button(app, ui, Rect::from_min_size(pos2(x, y), vec2(54.0, 20.0)), "footage.play", if playing { "Pause" } else { "Play" }, false) {
|
||||
ctx.data_mut(|d| d.insert_temp(play_id, !playing));
|
||||
}
|
||||
x += 60.0;
|
||||
if kit::button(app, ui, Rect::from_min_size(pos2(x, y), vec2(28.0, 20.0)), "footage.setIn", "{", false) {
|
||||
kit::exec(app, "footage.setIn", json!({}));
|
||||
}
|
||||
x += 32.0;
|
||||
if kit::button(app, ui, Rect::from_min_size(pos2(x, y), vec2(28.0, 20.0)), "footage.setOut", "}", false) {
|
||||
kit::exec(app, "footage.setOut", json!({}));
|
||||
}
|
||||
x += 36.0;
|
||||
let span = format!("Δ {}", kit::seconds((b - a).seconds()));
|
||||
p.text(pos2(x, bar.center().y), Align2::LEFT_CENTER, span, Tokens::ui(11.0), t.text_dim);
|
||||
let comp_ok = app.session.active_comp_id().is_some();
|
||||
let target = app.session.active_comp_id().and_then(|c| app.session.project.item(c)).map(|i| i.name.clone()).unwrap_or_default();
|
||||
let ey = edit_row.min.y + 5.0;
|
||||
let bx = (edit_row.max.x - 238.0).max(edit_row.min.x + 10.0);
|
||||
if !target.is_empty() && bx > edit_row.min.x + 140.0 {
|
||||
p.text(pos2(bx - 8.0, edit_row.center().y), Align2::RIGHT_CENTER, format!("Edit Target: {target}"), Tokens::ui(11.0), t.text_dim);
|
||||
}
|
||||
if kit::button(app, ui, Rect::from_min_size(pos2(bx, ey), vec2(110.0, 20.0)), "footage.rippleInsertEdit", "Ripple Insert Edit", false) && comp_ok {
|
||||
kit::exec(app, "footage.rippleInsertEdit", json!({}));
|
||||
}
|
||||
if kit::button(app, ui, Rect::from_min_size(pos2(bx + 116.0, ey), vec2(110.0, 20.0)), "footage.overlayEdit", "Overlay Edit", true) && comp_ok {
|
||||
kit::exec(app, "footage.overlayEdit", json!({}));
|
||||
}
|
||||
}
|
||||
@@ -397,6 +397,60 @@ pub fn open_form(app: &mut EffectcraftApp, id: &str, p: &Value) -> bool {
|
||||
],
|
||||
)
|
||||
}
|
||||
"layer.autoTrace" if !has(p, &["channel", "timeSpan", "threshold"]) => (
|
||||
"Auto-trace".into(),
|
||||
vec![
|
||||
Field::choice("timeSpan", "Time Span", &[("Current Frame", json!("currentFrame")), ("Work Area", json!("workArea"))], 0),
|
||||
Field::choice(
|
||||
"channel",
|
||||
"Channel",
|
||||
&[("Alpha", json!("alpha")), ("Red", json!("red")), ("Green", json!("green")), ("Blue", json!("blue")), ("Luminance", json!("luminance"))],
|
||||
0,
|
||||
),
|
||||
Field::bool("invert", "Invert", false),
|
||||
Field::num("blur", "Blur (pixels before auto-trace)", 1.0),
|
||||
Field::num("tolerance", "Tolerance (pixels)", 1.0),
|
||||
Field::num("threshold", "Threshold (%)", 50.0),
|
||||
Field::num("minimumArea", "Minimum Area (pixels)", 10.0),
|
||||
Field::num("cornerRoundness", "Corner Roundness (%)", 50.0),
|
||||
Field::bool("applyToNewLayer", "Apply To New Layer", false),
|
||||
],
|
||||
),
|
||||
"layer.sceneEditDetection" if !has(p, &["mode"]) => (
|
||||
"Scene Edit Detection".into(),
|
||||
vec![
|
||||
Field::choice(
|
||||
"mode",
|
||||
"Action",
|
||||
&[("Create Markers", json!("markers")), ("Split Layers", json!("split")), ("Split and Precompose", json!("splitPrecompose"))],
|
||||
0,
|
||||
),
|
||||
Field::num("threshold", "Sensitivity threshold (0–1, lower finds more)", 0.25),
|
||||
],
|
||||
),
|
||||
"layer.alignVideoToData" if !has(p, &["data", "videoStart"]) => {
|
||||
let data: Vec<(String, Value)> = s
|
||||
.project
|
||||
.items
|
||||
.values()
|
||||
.filter(|i| matches!(&i.kind, effectcraft_engine::project::ItemKind::Footage(f) if f.kind == effectcraft_engine::project::FootageKind::Data))
|
||||
.map(|i| (i.name.clone(), json!(i.id.0)))
|
||||
.collect();
|
||||
if data.is_empty() {
|
||||
info(app, "Align Video to Data", "Import a data file (JSON, CSV or TSV with a time column) first: File ▸ Import.");
|
||||
return true;
|
||||
}
|
||||
let opts: Vec<(&str, Value)> = data.iter().map(|(n, v)| (n.as_str(), v.clone())).collect();
|
||||
(
|
||||
"Align Video to Data".into(),
|
||||
vec![
|
||||
Field::choice("data", "Data", &opts, 0),
|
||||
Field::text("key", "Time field (empty: automatic)", ""),
|
||||
Field::text("videoStart", "Video start (ISO date-time, hh:mm:ss, timecode; empty: file date)", ""),
|
||||
Field::num("dataStart", "First sample at (comp seconds)", 0.0),
|
||||
],
|
||||
)
|
||||
}
|
||||
"file.importPlaceholder" | "file.replaceWithPlaceholder" if p.as_object().is_none_or(|m| m.is_empty()) => (
|
||||
"New Placeholder".into(),
|
||||
vec![
|
||||
|
||||
@@ -0,0 +1,368 @@
|
||||
//! Media Browser, Metadata and Progress panels (Window menu).
|
||||
//!
|
||||
//! - **Media Browser**: favourites and the folder tree on the left, the folder's files on the
|
||||
//! right with thumbnails (images and video, decoded through the media layer's probe), double-
|
||||
//! click to open a folder or import a file, drag files into the Project panel or the timeline.
|
||||
//! Desktop only (the web build has no file system to browse).
|
||||
//! - **Metadata**: what we read from the selected item's file (codec, size, rate, duration,
|
||||
//! colour profile, dates) and the project's, with editable item and project comments.
|
||||
//! - **Progress**: every background job (render queue, track / mask track / Warp Stabilizer /
|
||||
//! 3D Camera Tracker / Roto Brush analyses, Content-Aware Fill, Scene Edit Detection) with a
|
||||
//! progress bar and a cancel button, and the recently finished ones.
|
||||
|
||||
use effectcraft_engine::media_browser as mb;
|
||||
use effectcraft_engine::project::ItemId;
|
||||
use egui::{Align2, Color32, Rect, Sense, Stroke, pos2, vec2};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::DragPayload;
|
||||
use super::panel_kit as kit;
|
||||
use crate::EffectcraftApp;
|
||||
use crate::theme::Tokens;
|
||||
|
||||
// ---------------------------------------------------------------- Media Browser
|
||||
|
||||
type Thumb = Option<(egui::TextureHandle, [u32; 2])>;
|
||||
|
||||
/// Thumbnail of a file (cached per path; `None` while not decoded or not decodable).
|
||||
fn thumbnail(app: &EffectcraftApp, ctx: &egui::Context, path: &str, budget: &mut u32) -> Thumb {
|
||||
let id = egui::Id::new(("mb-thumb", path));
|
||||
if let Some(t) = ctx.data(|d| d.get_temp::<Thumb>(id)) {
|
||||
return t;
|
||||
}
|
||||
if *budget == 0 {
|
||||
return None;
|
||||
}
|
||||
*budget -= 1;
|
||||
let thumb = (|| {
|
||||
let imp = app.session.importer.clone()?;
|
||||
let f = imp.probe(path).ok()?;
|
||||
if !f.has_video {
|
||||
return None;
|
||||
}
|
||||
// A synthetic item id keyed by the path (the frame cache keys on the path).
|
||||
let hid = path.bytes().fold(0xcbf2_9ce4_8422_2325u64, |h, b| (h ^ b as u64).wrapping_mul(0x100_0000_01b3)) | (1 << 62);
|
||||
let img = app.session.footage.frame(ItemId(hid), &f, effectcraft_engine::time::Tick::ZERO)?;
|
||||
let step = (img.width.max(img.height) as f32 / 128.0).ceil().max(1.0) as u32;
|
||||
let (w, h) = (img.width.div_ceil(step), img.height.div_ceil(step));
|
||||
let full = img.to_rgba8();
|
||||
let mut px = Vec::with_capacity((w * h * 4) as usize);
|
||||
for y in 0..h {
|
||||
for x in 0..w {
|
||||
let i = (((y * step) * img.width + x * step) * 4) as usize;
|
||||
px.extend_from_slice(&full[i..i + 4]);
|
||||
}
|
||||
}
|
||||
let tex = ctx.load_texture(format!("mb-{path}"), egui::ColorImage::from_rgba_unmultiplied([w as usize, h as usize], &px), egui::TextureOptions::LINEAR);
|
||||
Some((tex, [w, h]))
|
||||
})();
|
||||
ctx.data_mut(|d| d.insert_temp(id, thumb.clone()));
|
||||
thumb
|
||||
}
|
||||
|
||||
pub fn media_browser(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
let t = app.tokens;
|
||||
let ctx = ui.ctx().clone();
|
||||
let p = ui.painter().with_clip_rect(rect);
|
||||
p.rect_filled(rect, 0.0, t.panel_bg);
|
||||
if !mb::available() {
|
||||
p.text(rect.center(), Align2::CENTER_CENTER, "The Media Browser needs the desktop app (use File ▸ Import here)", Tokens::ui(12.0), t.text_faint);
|
||||
app.auto.add("mediaBrowser.unavailable", rect, "Media Browser unavailable");
|
||||
return;
|
||||
}
|
||||
let st = app.session.state.media_browser.clone();
|
||||
let dir = st.folder.clone().unwrap_or_else(mb::home);
|
||||
// Listing cached per folder for a second.
|
||||
let lid = egui::Id::new(("mb-list", dir.clone(), st.importable_only));
|
||||
let now = ctx.input(|i| i.time);
|
||||
let listing: Option<(f64, Result<Vec<mb::Entry>, String>)> = ctx.data(|d| d.get_temp(lid));
|
||||
let entries = match listing {
|
||||
Some((at, l)) if now - at < 1.0 => l,
|
||||
_ => {
|
||||
let l = mb::list(&dir, st.importable_only);
|
||||
ctx.data_mut(|d| d.insert_temp(lid, (now, l.clone())));
|
||||
l
|
||||
}
|
||||
};
|
||||
// Toolbar: up, home, path, favourite, importable only.
|
||||
let y = rect.min.y + 6.0;
|
||||
let mut x = rect.min.x + 8.0;
|
||||
if kit::button(app, ui, Rect::from_min_size(pos2(x, y), vec2(30.0, 20.0)), "mediaBrowser.up", "↑", false) {
|
||||
kit::exec(app, "mediaBrowser.go", json!({"path": ".."}));
|
||||
}
|
||||
x += 34.0;
|
||||
if kit::button(app, ui, Rect::from_min_size(pos2(x, y), vec2(48.0, 20.0)), "mediaBrowser.home", "Home", false) {
|
||||
kit::exec(app, "mediaBrowser.go", json!({}));
|
||||
}
|
||||
x += 54.0;
|
||||
let fav = st.favorites.contains(&dir);
|
||||
if kit::button(app, ui, Rect::from_min_size(pos2(x, y), vec2(24.0, 20.0)), "mediaBrowser.favorite", if fav { "★" } else { "☆" }, false) {
|
||||
kit::exec(app, if fav { "mediaBrowser.removeFavorite" } else { "mediaBrowser.addFavorite" }, json!({"path": dir}));
|
||||
}
|
||||
x += 30.0;
|
||||
let only = kit::checkbox(app, ui, pos2(x, y + 2.0), "mediaBrowser.importableOnly", "Media only", st.importable_only);
|
||||
if only != st.importable_only {
|
||||
kit::exec(app, "mediaBrowser.go", json!({"path": dir, "importableOnly": only}));
|
||||
}
|
||||
// The path on its own row.
|
||||
let _ = x;
|
||||
let py = y + 24.0;
|
||||
p.text(pos2(rect.min.x + 10.0, py + 9.0), Align2::LEFT_CENTER, &dir, Tokens::ui(11.5), t.text_dim);
|
||||
app.auto.add("mediaBrowser.path", Rect::from_min_max(pos2(rect.min.x + 8.0, py), pos2(rect.max.x - 8.0, py + 18.0)), &dir);
|
||||
// Left column: favourites.
|
||||
let side = Rect::from_min_max(pos2(rect.min.x, rect.min.y + 54.0), pos2(rect.min.x + 160.0_f32.min(rect.width() * 0.3), rect.max.y));
|
||||
p.line_segment([side.right_top(), side.right_bottom()], Stroke::new(1.0, t.separator));
|
||||
p.text(pos2(side.min.x + 10.0, side.min.y + 10.0), Align2::LEFT_CENTER, "Favorites", Tokens::semibold(11.5), t.text_dim);
|
||||
let mut fy = side.min.y + 22.0;
|
||||
let mut places: Vec<(String, String)> = vec![("Home".into(), mb::home())];
|
||||
places.extend(
|
||||
st.favorites.iter().map(|f| (std::path::Path::new(f).file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_else(|| f.clone()), f.clone())),
|
||||
);
|
||||
for (i, (name, path)) in places.iter().enumerate() {
|
||||
let r = Rect::from_min_size(pos2(side.min.x, fy), vec2(side.width(), 20.0));
|
||||
let resp = ui.interact(r, egui::Id::new(("mb-fav", i)), Sense::click());
|
||||
if *path == dir {
|
||||
p.rect_filled(r, 0.0, t.row_selected);
|
||||
} else if resp.hovered() {
|
||||
p.rect_filled(r, 0.0, t.hover);
|
||||
}
|
||||
p.text(pos2(r.min.x + 14.0, r.center().y), Align2::LEFT_CENTER, name, Tokens::ui(12.0), t.text);
|
||||
app.auto.add(&format!("mediaBrowser.place.{i}"), r, name);
|
||||
if resp.clicked() {
|
||||
kit::exec(app, "mediaBrowser.go", json!({"path": path}));
|
||||
}
|
||||
fy += 20.0;
|
||||
}
|
||||
// Files.
|
||||
let list = Rect::from_min_max(pos2(side.max.x + 1.0, side.min.y), rect.max);
|
||||
let entries = match entries {
|
||||
Ok(e) => e,
|
||||
Err(e) => {
|
||||
p.text(list.center(), Align2::CENTER_CENTER, e, Tokens::ui(12.0), t.danger);
|
||||
return;
|
||||
}
|
||||
};
|
||||
let tile = vec2(140.0, 112.0);
|
||||
let cols = ((list.width() - 8.0) / tile.x).floor().max(1.0) as usize;
|
||||
let mut budget = 2u32;
|
||||
let scroll_id = egui::Id::new("mb-scroll");
|
||||
let mut scroll: f32 = ctx.data(|d| d.get_temp(scroll_id).unwrap_or(0.0));
|
||||
if ui.rect_contains_pointer(list) {
|
||||
scroll -= ctx.input(|i| i.smooth_scroll_delta.y);
|
||||
}
|
||||
let rows = entries.len().div_ceil(cols);
|
||||
scroll = scroll.clamp(0.0, (rows as f32 * tile.y - list.height() + 8.0).max(0.0));
|
||||
ctx.data_mut(|d| d.insert_temp(scroll_id, scroll));
|
||||
let lp = p.with_clip_rect(list);
|
||||
let mut actions: Vec<(&str, Value)> = vec![];
|
||||
for (i, e) in entries.iter().enumerate() {
|
||||
let r = Rect::from_min_size(
|
||||
pos2(list.min.x + 8.0 + (i % cols) as f32 * tile.x, list.min.y + 8.0 + (i / cols) as f32 * tile.y - scroll),
|
||||
tile - vec2(8.0, 8.0),
|
||||
);
|
||||
if !r.intersects(list) {
|
||||
continue;
|
||||
}
|
||||
let resp = ui.interact(r.intersect(list), egui::Id::new(("mb-entry", &e.path)), Sense::click_and_drag());
|
||||
app.auto.add(&format!("mediaBrowser.entry.{}", e.name), r, &e.name);
|
||||
lp.rect_filled(r, 4.0, if resp.hovered() { t.hover } else { t.row });
|
||||
let thumb = Rect::from_min_max(r.min + vec2(6.0, 6.0), pos2(r.max.x - 6.0, r.max.y - 26.0));
|
||||
lp.rect_filled(thumb, 3.0, Color32::from_rgb(0x18, 0x18, 0x18));
|
||||
let kind = if e.is_dir { "Folder" } else { e.kind.unwrap_or("File") };
|
||||
match (e.is_dir, e.kind) {
|
||||
(false, Some("image" | "video")) => match thumbnail(app, &ctx, &e.path, &mut budget) {
|
||||
Some((tex, [w, h])) => {
|
||||
let s = (thumb.width() / w as f32).min(thumb.height() / h as f32);
|
||||
lp.image(
|
||||
tex.id(),
|
||||
Rect::from_center_size(thumb.center(), vec2(w as f32 * s, h as f32 * s)),
|
||||
Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)),
|
||||
Color32::WHITE,
|
||||
);
|
||||
}
|
||||
None => {
|
||||
lp.text(thumb.center(), Align2::CENTER_CENTER, kind, Tokens::ui(11.0), t.text_faint);
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
lp.text(thumb.center(), Align2::CENTER_CENTER, if e.is_dir { "▣" } else { kind }, Tokens::ui(if e.is_dir { 28.0 } else { 11.0 }), t.text_faint);
|
||||
}
|
||||
}
|
||||
let name = if e.name.chars().count() > 20 { format!("{}…", e.name.chars().take(19).collect::<String>()) } else { e.name.clone() };
|
||||
lp.text(pos2(r.min.x + 8.0, r.max.y - 12.0), Align2::LEFT_CENTER, name, Tokens::ui(11.5), t.text);
|
||||
if resp.double_clicked() {
|
||||
if e.is_dir {
|
||||
actions.push(("mediaBrowser.go", json!({"path": e.path})));
|
||||
} else if e.kind.is_some() {
|
||||
actions.push(("mediaBrowser.import", json!({"paths": [e.path]})));
|
||||
}
|
||||
}
|
||||
if resp.drag_started() && !e.is_dir && e.kind.is_some() {
|
||||
egui::DragAndDrop::set_payload(&ctx, DragPayload::Files(vec![e.path.clone()]));
|
||||
}
|
||||
resp.context_menu(|ui| {
|
||||
if !e.is_dir && ui.button("Import").clicked() {
|
||||
actions.push(("mediaBrowser.import", json!({"paths": [e.path]})));
|
||||
ui.close();
|
||||
}
|
||||
if !e.is_dir && ui.button("Import and Add to Composition").clicked() {
|
||||
actions.push(("mediaBrowser.import", json!({"paths": [e.path], "addToComp": true})));
|
||||
ui.close();
|
||||
}
|
||||
if e.is_dir && ui.button("Add to Favorites").clicked() {
|
||||
actions.push(("mediaBrowser.addFavorite", json!({"path": e.path})));
|
||||
ui.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
if entries.is_empty() {
|
||||
lp.text(list.center(), Align2::CENTER_CENTER, "Empty folder", Tokens::ui(12.0), t.text_faint);
|
||||
}
|
||||
if budget == 0 {
|
||||
ctx.request_repaint();
|
||||
}
|
||||
for (id, p) in actions {
|
||||
kit::exec(app, id, p);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- Metadata
|
||||
|
||||
fn rows_of(v: &Value) -> Vec<(String, String)> {
|
||||
let Some(o) = v.as_object() else { return vec![] };
|
||||
o.iter()
|
||||
.filter(|(k, v)| !v.is_null() && !matches!(k.as_str(), "comment" | "id"))
|
||||
.map(|(k, v)| {
|
||||
let s = match v {
|
||||
Value::String(s) => s.clone(),
|
||||
Value::Number(n) => n.as_f64().map(|f| if f.fract() == 0.0 { format!("{f:.0}") } else { format!("{f:.3}") }).unwrap_or_default(),
|
||||
other => other.to_string(),
|
||||
};
|
||||
(k.clone(), s)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// An editable comment field; returns the edited text when it changes.
|
||||
fn comment_field(ui: &mut egui::Ui, r: Rect, id: &str, text: &str) -> Option<String> {
|
||||
let key = egui::Id::new(("meta-comment", id));
|
||||
let mut buf: String = ui.data(|d| d.get_temp(key)).unwrap_or_else(|| text.to_string());
|
||||
let mut child = ui.new_child(egui::UiBuilder::new().max_rect(r));
|
||||
let resp = child.add(egui::TextEdit::multiline(&mut buf).desired_width(r.width()).desired_rows(2).hint_text("Add a comment"));
|
||||
if resp.has_focus() || resp.changed() {
|
||||
ui.data_mut(|d| d.insert_temp(key, buf.clone()));
|
||||
} else {
|
||||
ui.data_mut(|d| d.remove::<String>(key));
|
||||
}
|
||||
(resp.lost_focus() && buf != text).then_some(buf)
|
||||
}
|
||||
|
||||
pub fn metadata(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
let t = app.tokens;
|
||||
let p = ui.painter().with_clip_rect(rect);
|
||||
p.rect_filled(rect, 0.0, t.panel_bg);
|
||||
let Ok(v) = app.session.execute("item.metadata", json!({})) else { return };
|
||||
let mut y = rect.min.y + 8.0;
|
||||
let x0 = rect.min.x + 12.0;
|
||||
let xv = x0 + 120.0;
|
||||
let section = |p: &egui::Painter, y: &mut f32, title: &str| {
|
||||
p.text(pos2(x0, *y + 8.0), Align2::LEFT_CENTER, title, Tokens::semibold(12.0), t.text);
|
||||
*y += 22.0;
|
||||
};
|
||||
if let Some(item) = v.get("item").filter(|i| !i.is_null()) {
|
||||
let name = item["name"].as_str().unwrap_or_default().to_string();
|
||||
let id = item["id"].as_u64().unwrap_or(0);
|
||||
section(&p, &mut y, &format!("{name} ({})", item["type"].as_str().unwrap_or("")));
|
||||
kit::label(ui, pos2(x0, y), "Comment", &t);
|
||||
let r = Rect::from_min_size(pos2(xv, y), vec2((rect.max.x - xv - 12.0).max(80.0), 40.0));
|
||||
app.auto.add("metadata.itemComment", r, item["comment"].as_str().unwrap_or(""));
|
||||
if let Some(c) = comment_field(ui, r, &format!("item{id}"), item["comment"].as_str().unwrap_or("")) {
|
||||
kit::exec(app, "project.setComment", json!({"items": [id], "comment": c}));
|
||||
}
|
||||
y += 48.0;
|
||||
for (k, val) in rows_of(item) {
|
||||
if matches!(k.as_str(), "name" | "type") {
|
||||
continue;
|
||||
}
|
||||
p.text(pos2(x0, y + 8.0), Align2::LEFT_CENTER, &k, Tokens::ui(11.5), t.text_dim);
|
||||
p.text(pos2(xv, y + 8.0), Align2::LEFT_CENTER, &val, Tokens::ui(11.5), t.text);
|
||||
app.auto.add(&format!("metadata.item.{k}"), Rect::from_min_size(pos2(xv, y), vec2(200.0, 16.0)), &val);
|
||||
y += 18.0;
|
||||
}
|
||||
y += 10.0;
|
||||
} else {
|
||||
p.text(pos2(x0, y + 8.0), Align2::LEFT_CENTER, "Select an item in the Project panel", Tokens::ui(12.0), t.text_faint);
|
||||
y += 28.0;
|
||||
}
|
||||
let proj = v["project"].clone();
|
||||
section(&p, &mut y, "Project");
|
||||
kit::label(ui, pos2(x0, y), "Comment", &t);
|
||||
let r = Rect::from_min_size(pos2(xv, y), vec2((rect.max.x - xv - 12.0).max(80.0), 40.0));
|
||||
app.auto.add("metadata.projectComment", r, proj["comment"].as_str().unwrap_or(""));
|
||||
if let Some(c) = comment_field(ui, r, "project", proj["comment"].as_str().unwrap_or("")) {
|
||||
kit::exec(app, "project.setProjectComment", json!({"comment": c}));
|
||||
}
|
||||
y += 48.0;
|
||||
for (k, val) in rows_of(&proj) {
|
||||
p.text(pos2(x0, y + 8.0), Align2::LEFT_CENTER, &k, Tokens::ui(11.5), t.text_dim);
|
||||
p.text(pos2(xv, y + 8.0), Align2::LEFT_CENTER, &val, Tokens::ui(11.5), t.text);
|
||||
y += 18.0;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- Progress
|
||||
|
||||
pub fn progress(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
let t = app.tokens;
|
||||
let p = ui.painter().with_clip_rect(rect);
|
||||
p.rect_filled(rect, 0.0, t.panel_bg);
|
||||
if !app.session.tasks.is_empty() {
|
||||
app.session.poll_jobs();
|
||||
}
|
||||
let jobs = app.session.jobs();
|
||||
let mut y = rect.min.y + 8.0;
|
||||
let x0 = rect.min.x + 12.0;
|
||||
let w = (rect.width() - 24.0).max(60.0);
|
||||
if jobs.is_empty() {
|
||||
p.text(pos2(x0, y + 10.0), Align2::LEFT_CENTER, "No background jobs running", Tokens::ui(12.0), t.text_faint);
|
||||
y += 28.0;
|
||||
} else {
|
||||
ui.ctx().request_repaint_after(std::time::Duration::from_millis(150));
|
||||
}
|
||||
for j in &jobs {
|
||||
p.text(pos2(x0, y + 8.0), Align2::LEFT_CENTER, &j.label, Tokens::medium(12.0), t.text);
|
||||
let frac = j.fraction.unwrap_or(0.0) as f32;
|
||||
let pct = j.fraction.map(|f| format!("{:.0} %", f * 100.0)).unwrap_or_else(|| "…".into());
|
||||
p.text(pos2(x0 + w - 70.0, y + 8.0), Align2::RIGHT_CENTER, format!("{pct} {}", j.message), Tokens::ui(11.0), t.text_dim);
|
||||
let bar = Rect::from_min_size(pos2(x0, y + 20.0), vec2(w - 76.0, 6.0));
|
||||
p.rect_filled(bar, 3.0, t.field_bg);
|
||||
p.rect_filled(Rect::from_min_size(bar.min, vec2(bar.width() * frac.clamp(0.0, 1.0), bar.height())), 3.0, t.accent);
|
||||
app.auto.add(&format!("progress.job.{}", j.id), Rect::from_min_size(pos2(x0, y), vec2(w, 28.0)), &j.label);
|
||||
if j.cancellable
|
||||
&& kit::button(app, ui, Rect::from_min_size(pos2(x0 + w - 64.0, y + 12.0), vec2(64.0, 18.0)), &format!("progress.cancel.{}", j.id), "Cancel", false)
|
||||
{
|
||||
kit::exec(app, "jobs.cancel", json!({"job": j.id}));
|
||||
}
|
||||
y += 38.0;
|
||||
}
|
||||
if !app.session.job_log.is_empty() {
|
||||
p.line_segment([pos2(x0, y), pos2(x0 + w, y)], Stroke::new(1.0, t.separator));
|
||||
y += 6.0;
|
||||
p.text(pos2(x0, y + 8.0), Align2::LEFT_CENTER, "Finished", Tokens::semibold(11.5), t.text_dim);
|
||||
y += 20.0;
|
||||
for r in app.session.job_log.iter().rev().take(20) {
|
||||
let col = match r.status.as_str() {
|
||||
"done" => t.text,
|
||||
"cancelled" => t.text_dim,
|
||||
_ => t.danger,
|
||||
};
|
||||
let msg = if r.message.is_empty() { format!("{} · {:.1} s", r.status, r.seconds) } else { format!("{} · {}", r.status, r.message) };
|
||||
p.text(pos2(x0, y + 8.0), Align2::LEFT_CENTER, &r.label, Tokens::ui(11.5), col);
|
||||
p.text(pos2(x0 + w, y + 8.0), Align2::RIGHT_CENTER, msg, Tokens::ui(11.0), t.text_faint);
|
||||
y += 18.0;
|
||||
if y > rect.max.y {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
pub mod anim_tools;
|
||||
pub mod camera_tracker_ui;
|
||||
pub mod comp_settings;
|
||||
pub mod content_fill_panel;
|
||||
pub mod dialogs;
|
||||
pub mod dialogs_3d;
|
||||
pub mod effect_controls;
|
||||
@@ -11,6 +12,7 @@ pub mod essential;
|
||||
pub mod expr_bar;
|
||||
pub mod expr_editor;
|
||||
pub mod flowchart;
|
||||
pub mod footage_panel;
|
||||
pub mod forms;
|
||||
pub mod fx_widgets;
|
||||
pub mod graph;
|
||||
@@ -21,14 +23,17 @@ pub mod key_dialogs;
|
||||
pub mod layer_panel;
|
||||
pub mod layer_styles_dialog;
|
||||
pub mod markers_ui;
|
||||
pub mod media_panels;
|
||||
pub mod misc;
|
||||
pub mod paint_panels;
|
||||
pub mod panel_kit;
|
||||
pub mod precomp;
|
||||
pub mod project;
|
||||
pub mod properties;
|
||||
pub mod puppet_tool;
|
||||
pub mod render_queue;
|
||||
pub mod roto_tool;
|
||||
pub mod scopes_panel;
|
||||
pub mod script_console;
|
||||
pub mod settings;
|
||||
pub mod shortcut_editor;
|
||||
@@ -58,6 +63,8 @@ pub enum DragPayload {
|
||||
Effect(String),
|
||||
/// A property dragged from the timeline (to the Essential Graphics panel).
|
||||
Property { layer: u64, prop: u64 },
|
||||
/// Files from the Media Browser (import; into the timeline: import and add).
|
||||
Files(Vec<String>),
|
||||
}
|
||||
|
||||
/// The current time formatted per project settings (timecode with `;` for drop-frame, frames
|
||||
@@ -100,6 +107,12 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, p: PanelKind, rect: Rec
|
||||
PanelKind::Brushes => paint_panels::brushes(app, ui, rect),
|
||||
PanelKind::EssentialGraphics => essential::show(app, ui, rect),
|
||||
PanelKind::Flowchart => flowchart::show(app, ui, rect),
|
||||
PanelKind::LumetriScopes => scopes_panel::show(app, ui, rect),
|
||||
PanelKind::Footage => footage_panel::show(app, ui, rect),
|
||||
PanelKind::MediaBrowser => media_panels::media_browser(app, ui, rect),
|
||||
PanelKind::Metadata => media_panels::metadata(app, ui, rect),
|
||||
PanelKind::Progress => media_panels::progress(app, ui, rect),
|
||||
PanelKind::ContentAwareFill => content_fill_panel::show(app, ui, rect),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
//! Small immediate-mode controls shared by the Lumetri Scopes, Footage, Media Browser, Metadata,
|
||||
//! Progress and Content-Aware Fill panels. Each registers its automation id.
|
||||
|
||||
use egui::{Align2, Rect, pos2, vec2};
|
||||
|
||||
use crate::theme::Tokens;
|
||||
use crate::{EffectcraftApp, widgets};
|
||||
|
||||
/// A dropdown; returns the newly chosen index.
|
||||
pub fn dropdown(app: &mut EffectcraftApp, ui: &mut egui::Ui, r: Rect, auto: &str, options: &[&str], cur: usize) -> Option<usize> {
|
||||
let t = app.tokens;
|
||||
let id = egui::Id::new(("kit-dd", auto));
|
||||
let text = options.get(cur).copied().unwrap_or("");
|
||||
if widgets::dropdown(ui, r, text, &t, id).clicked() {
|
||||
widgets::open_popup(ui, id);
|
||||
}
|
||||
app.auto.add(auto, r, text);
|
||||
let opts: Vec<String> = options.iter().map(|s| s.to_string()).collect();
|
||||
widgets::popup_menu(ui, id, r.left_bottom(), &opts, Some(cur)).filter(|i| *i != cur)
|
||||
}
|
||||
|
||||
/// A checkbox with a label; returns the new state.
|
||||
pub fn checkbox(app: &mut EffectcraftApp, ui: &mut egui::Ui, at: egui::Pos2, auto: &str, text: &str, on: bool) -> bool {
|
||||
let t = app.tokens;
|
||||
let r = Rect::from_min_size(at, vec2(16.0, 16.0));
|
||||
let clicked = widgets::checkbox(ui, r, on, &t, egui::Id::new(("kit-cb", auto))).clicked();
|
||||
ui.painter().text(pos2(r.max.x + 6.0, r.center().y), Align2::LEFT_CENTER, text, Tokens::ui(12.0), t.text);
|
||||
let full = Rect::from_min_size(at, vec2(22.0 + text.len() as f32 * 6.5, 16.0));
|
||||
app.auto.add(auto, full, text);
|
||||
if clicked { !on } else { on }
|
||||
}
|
||||
|
||||
/// A text button; true when clicked.
|
||||
pub fn button(app: &mut EffectcraftApp, ui: &mut egui::Ui, r: Rect, auto: &str, text: &str, primary: bool) -> bool {
|
||||
let t = app.tokens;
|
||||
let clicked = widgets::text_button(ui, r, text, primary, &t, egui::Id::new(("kit-btn", auto))).clicked();
|
||||
app.auto.add(auto, r, text);
|
||||
clicked
|
||||
}
|
||||
|
||||
/// A dimmed label at (x, y-row).
|
||||
pub fn label(ui: &egui::Ui, at: egui::Pos2, text: &str, t: &Tokens) {
|
||||
ui.painter().text(pos2(at.x, at.y + 9.0), Align2::LEFT_CENTER, text, Tokens::ui(12.0), t.text_dim);
|
||||
}
|
||||
|
||||
/// A draggable number; returns the new value.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn number(app: &mut EffectcraftApp, ui: &mut egui::Ui, at: egui::Pos2, auto: &str, v: f64, speed: f64, range: (f64, f64), dec: usize, suffix: &str) -> f64 {
|
||||
let t = app.tokens;
|
||||
let (r, nv, _) = widgets::hot_number_at(ui, at, egui::Id::new(("kit-n", auto)), v, speed, range, dec, suffix, &t);
|
||||
app.auto.add(auto, r, &format!("{v}"));
|
||||
nv.unwrap_or(v)
|
||||
}
|
||||
|
||||
/// Run a command, reporting errors in the status bar.
|
||||
pub fn exec(app: &mut EffectcraftApp, id: &str, p: serde_json::Value) -> Option<serde_json::Value> {
|
||||
match app.session.execute(id, p) {
|
||||
Ok(v) => Some(v),
|
||||
Err(e) => {
|
||||
app.ui.status = e.to_string();
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Format seconds as `m:ss.ff`.
|
||||
pub fn seconds(s: f64) -> String {
|
||||
let m = (s / 60.0).floor();
|
||||
format!("{}:{:05.2}", m as i64, s - m * 60.0)
|
||||
}
|
||||
@@ -481,6 +481,11 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
ItemKind::Folder if !app.ui.project_open_folders.remove(&id.0) => {
|
||||
app.ui.project_open_folders.insert(id.0);
|
||||
}
|
||||
// Footage (not data) and solids open in the Footage panel.
|
||||
ItemKind::Footage(f) if f.kind != effectcraft_engine::project::FootageKind::Data => {
|
||||
actions.push(("footage.open".into(), json!({"item": id.0})))
|
||||
}
|
||||
ItemKind::Solid(_) => actions.push(("footage.open".into(), json!({"item": id.0}))),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@@ -539,6 +544,16 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
egui::DragAndDrop::clear_payload(&ctx);
|
||||
}
|
||||
}
|
||||
// Files dragged from the Media Browser: import.
|
||||
if let Some(DragPayload::Files(paths)) = egui::DragAndDrop::payload::<DragPayload>(&ctx).as_deref()
|
||||
&& hover_y.is_some()
|
||||
{
|
||||
lp.rect_stroke(list.shrink(1.0), 0.0, Stroke::new(1.0, t.accent.gamma_multiply(0.6)), egui::StrokeKind::Inside);
|
||||
if ctx.input(|i| i.pointer.any_released()) {
|
||||
actions.push(("mediaBrowser.import".into(), json!({"paths": paths})));
|
||||
egui::DragAndDrop::clear_payload(&ctx);
|
||||
}
|
||||
}
|
||||
// Drag ghost.
|
||||
if let Some(DragPayload::Item(iid)) = egui::DragAndDrop::payload::<DragPayload>(&ctx).as_deref()
|
||||
&& let Some(pos) = ctx.pointer_hover_pos()
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
//! Lumetri Scopes panel (Window ▸ Lumetri Scopes): waveform (RGB / Luma / YC), vectorscope
|
||||
//! (YUV / HLS), histogram and parade (RGB / YUV) of the active composition's frame at the current
|
||||
//! time, with the colour standard (Rec. 601 / 709 / 2020), 8-bit or float scale and clamp. The
|
||||
//! maths is `effectcraft_raster::scopes`; agents read the same numbers with `scopes.analyze`.
|
||||
|
||||
use effectcraft_engine::commands::panels_cmds::scope_frame;
|
||||
use effectcraft_engine::raster::scopes::{self, ColorStandard, Scope, ScopeKind, ScopeOpts};
|
||||
use egui::{Align2, Color32, Rect, Stroke, pos2, vec2};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::panel_kit as kit;
|
||||
use crate::EffectcraftApp;
|
||||
use crate::theme::Tokens;
|
||||
|
||||
/// Panel options (serde in the UI state).
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct ScopesState {
|
||||
pub scope: String,
|
||||
pub standard: String,
|
||||
pub float: bool,
|
||||
pub clamp: bool,
|
||||
}
|
||||
|
||||
impl Default for ScopesState {
|
||||
fn default() -> Self {
|
||||
ScopesState { scope: "waveformRgb".into(), standard: "rec709".into(), float: false, clamp: true }
|
||||
}
|
||||
}
|
||||
|
||||
const STANDARDS: [&str; 3] = ["Rec. 601", "Rec. 709", "Rec. 2020"];
|
||||
|
||||
#[derive(Clone)]
|
||||
struct Cached {
|
||||
key: (u64, u64, i64, String, u32),
|
||||
scope: Scope,
|
||||
tex: Option<egui::TextureHandle>,
|
||||
}
|
||||
|
||||
pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
let t = app.tokens;
|
||||
let p = ui.painter().with_clip_rect(rect);
|
||||
p.rect_filled(rect, 0.0, t.panel_bg);
|
||||
let mut st = app.ui.scopes.clone();
|
||||
let kind = ScopeKind::from_name(&st.scope).unwrap_or(ScopeKind::WaveformRgb);
|
||||
let standard = ColorStandard::from_name(&st.standard).unwrap_or_default();
|
||||
// Top bar: scope, standard, 8-bit / float, clamp.
|
||||
let mut x = rect.min.x + 8.0;
|
||||
let y = rect.min.y + 6.0;
|
||||
let labels: Vec<&str> = ScopeKind::ALL.iter().map(|k| k.label()).collect();
|
||||
let cur = ScopeKind::ALL.iter().position(|k| *k == kind).unwrap_or(0);
|
||||
if let Some(i) = kit::dropdown(app, ui, Rect::from_min_size(pos2(x, y), vec2(150.0, 20.0)), "scopes.kind", &labels, cur) {
|
||||
st.scope = ScopeKind::ALL[i].name().into();
|
||||
}
|
||||
x += 158.0;
|
||||
let si = ColorStandard::ALL.iter().position(|c| *c == standard).unwrap_or(1);
|
||||
if let Some(i) = kit::dropdown(app, ui, Rect::from_min_size(pos2(x, y), vec2(90.0, 20.0)), "scopes.standard", &STANDARDS, si) {
|
||||
st.standard = ColorStandard::ALL[i].name().into();
|
||||
}
|
||||
x += 98.0;
|
||||
if let Some(i) = kit::dropdown(app, ui, Rect::from_min_size(pos2(x, y), vec2(70.0, 20.0)), "scopes.scale", &["8 Bit", "Float"], usize::from(st.float)) {
|
||||
st.float = i == 1;
|
||||
}
|
||||
x += 78.0;
|
||||
// Narrow panels: Clamp Signal on a second row.
|
||||
let (cx, cy, top) = if x + 110.0 > rect.max.x { (rect.min.x + 8.0, y + 26.0, 60.0) } else { (x, y, 34.0) };
|
||||
st.clamp = kit::checkbox(app, ui, pos2(cx, cy + 2.0), "scopes.clamp", "Clamp Signal", st.clamp);
|
||||
if st != app.ui.scopes {
|
||||
app.ui.scopes = st.clone();
|
||||
}
|
||||
let area = Rect::from_min_max(pos2(rect.min.x + 8.0, rect.min.y + top), pos2(rect.max.x - 8.0, rect.max.y - 8.0));
|
||||
if area.width() < 40.0 || area.height() < 40.0 {
|
||||
return;
|
||||
}
|
||||
p.rect_filled(area, 2.0, Color32::from_rgb(0x10, 0x10, 0x10));
|
||||
app.auto.add("scopes.plot", area, kind.label());
|
||||
let Some(cid) = app.session.active_comp_id() else {
|
||||
p.text(area.center(), Align2::CENTER_CENTER, "Open a composition to see its scopes", Tokens::ui(12.0), t.text_faint);
|
||||
return;
|
||||
};
|
||||
// Plot rectangle: square for vectorscopes.
|
||||
let plot = if kind.is_vectorscope() {
|
||||
let s = area.width().min(area.height()) - 16.0;
|
||||
Rect::from_center_size(area.center(), vec2(s, s))
|
||||
} else {
|
||||
Rect::from_min_max(area.min + vec2(34.0, 8.0), area.max - vec2(8.0, 8.0))
|
||||
};
|
||||
let size = (plot.width().max(plot.height()) as u32).clamp(64, 512);
|
||||
let o = ScopeOpts {
|
||||
standard,
|
||||
float: st.float,
|
||||
clamp: st.clamp,
|
||||
width: if kind.is_vectorscope() { size } else { (plot.width() as u32).clamp(64, 768) },
|
||||
height: if kind.is_vectorscope() { size } else { (plot.height() as u32).clamp(32, 512) },
|
||||
};
|
||||
let time = app.session.time();
|
||||
let key = (app.session.revision, cid.0, time.0, format!("{}{}{}{}{}x{}", st.scope, st.standard, st.float, st.clamp, o.width, o.height), 0);
|
||||
let ctx = ui.ctx().clone();
|
||||
let id = egui::Id::new("scopes-cache");
|
||||
let cached: Option<Cached> = ctx.data(|d| d.get_temp(id));
|
||||
let cached = match cached {
|
||||
Some(c) if c.key == key => c,
|
||||
_ => {
|
||||
let Some(frame) = scope_frame(&app.session, cid, time, 480) else { return };
|
||||
let scope = scopes::compute(&frame, kind, &o);
|
||||
let tex = (kind != ScopeKind::Histogram).then(|| {
|
||||
let mono = matches!(kind, ScopeKind::WaveformLuma | ScopeKind::VectorscopeYuv | ScopeKind::VectorscopeHls);
|
||||
let img = egui::ColorImage::from_rgba_unmultiplied([scope.width as usize, scope.height as usize], &tint(&scope, mono));
|
||||
ctx.load_texture("lumetri-scope", img, egui::TextureOptions::LINEAR)
|
||||
});
|
||||
let c = Cached { key, scope, tex };
|
||||
ctx.data_mut(|d| d.insert_temp(id, c.clone()));
|
||||
c
|
||||
}
|
||||
};
|
||||
graticule(&p, plot, kind, &o, &t);
|
||||
if let Some(tex) = &cached.tex {
|
||||
p.image(tex.id(), plot, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE);
|
||||
} else {
|
||||
histogram(&p, plot, &cached.scope);
|
||||
}
|
||||
}
|
||||
|
||||
/// Trace colours: green-tinted mono for luma/vectorscope, per-channel colours otherwise.
|
||||
fn tint(s: &Scope, mono: bool) -> Vec<u8> {
|
||||
let n = s.width as usize * s.height as usize;
|
||||
let mut out = vec![0u8; n * 4];
|
||||
for i in 0..n {
|
||||
let (r, g, b) = (s.planes[0][i], s.planes[1][i], s.planes[2][i]);
|
||||
let (r, g, b) = if mono {
|
||||
let m = r.max(g).max(b);
|
||||
(m * 0.75, m, m * 0.75)
|
||||
} else {
|
||||
(r, g, b)
|
||||
};
|
||||
let a = r.max(g).max(b).min(1.0);
|
||||
out[i * 4] = (r.min(1.0) * 255.0) as u8;
|
||||
out[i * 4 + 1] = (g.min(1.0) * 255.0) as u8;
|
||||
out[i * 4 + 2] = (b.min(1.0) * 255.0) as u8;
|
||||
out[i * 4 + 3] = (a * 255.0) as u8;
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
fn graticule(p: &egui::Painter, plot: Rect, kind: ScopeKind, o: &ScopeOpts, t: &Tokens) {
|
||||
let line = Stroke::new(1.0, Color32::from_rgba_unmultiplied(255, 255, 255, 28));
|
||||
if kind.is_vectorscope() {
|
||||
let c = plot.center();
|
||||
for r in [0.25f32, 0.5, 0.75, 1.0] {
|
||||
p.circle_stroke(c, plot.width() / 2.0 * r, line);
|
||||
}
|
||||
p.line_segment([pos2(plot.min.x, c.y), pos2(plot.max.x, c.y)], line);
|
||||
p.line_segment([pos2(c.x, plot.min.y), pos2(c.x, plot.max.y)], line);
|
||||
for (name, [u, v]) in scopes::vector_targets(o.standard, kind == ScopeKind::VectorscopeHls) {
|
||||
let q = pos2(plot.min.x + (u + 0.5) * plot.width(), plot.min.y + (0.5 - v) * plot.height());
|
||||
p.rect_stroke(Rect::from_center_size(q, vec2(8.0, 8.0)), 0.0, Stroke::new(1.0, Color32::from_rgb(0xc8, 0x6a, 0x6a)), egui::StrokeKind::Middle);
|
||||
p.text(q + vec2(7.0, -7.0), Align2::LEFT_BOTTOM, name, Tokens::ui(10.0), t.text_dim);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if kind == ScopeKind::Histogram {
|
||||
return;
|
||||
}
|
||||
let (lo, hi) = o.range();
|
||||
let marks: &[f32] = if o.float { &[-0.25, 0.0, 0.25, 0.5, 0.75, 1.0, 1.25] } else { &[0.0, 0.25, 0.5, 0.75, 1.0] };
|
||||
for v in marks {
|
||||
let y = plot.max.y - (v - lo) / (hi - lo) * plot.height();
|
||||
p.line_segment([pos2(plot.min.x, y), pos2(plot.max.x, y)], line);
|
||||
let label = if o.float { format!("{v:.2}") } else { format!("{}", (v * 255.0).round() as i32) };
|
||||
p.text(pos2(plot.min.x - 4.0, y), Align2::RIGHT_CENTER, label, Tokens::ui(9.5), t.text_faint);
|
||||
}
|
||||
if matches!(kind, ScopeKind::ParadeRgb | ScopeKind::ParadeYuv) {
|
||||
for k in 1..3 {
|
||||
let x = plot.min.x + plot.width() * k as f32 / 3.0;
|
||||
p.line_segment([pos2(x, plot.min.y), pos2(x, plot.max.y)], line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn histogram(p: &egui::Painter, plot: Rect, s: &Scope) {
|
||||
let bars = scopes::histogram_bars(s);
|
||||
let max = bars.iter().flat_map(|b| b.iter()).copied().max().unwrap_or(1).max(1) as f32;
|
||||
let cols = [
|
||||
Color32::from_rgba_unmultiplied(230, 70, 70, 150),
|
||||
Color32::from_rgba_unmultiplied(70, 220, 90, 150),
|
||||
Color32::from_rgba_unmultiplied(80, 120, 255, 150),
|
||||
];
|
||||
let n = bars[0].len().max(1) as f32;
|
||||
for (c, b) in bars.iter().enumerate() {
|
||||
let pts: Vec<egui::Pos2> =
|
||||
b.iter().enumerate().map(|(i, v)| pos2(plot.min.x + i as f32 / n * plot.width(), plot.max.y - (*v as f32 / max).sqrt() * plot.height())).collect();
|
||||
for (i, q) in pts.iter().enumerate() {
|
||||
p.line_segment([pos2(q.x, plot.max.y), *q], Stroke::new((plot.width() / n).max(1.0), cols[c].gamma_multiply(0.5)));
|
||||
if i > 0 {
|
||||
p.line_segment([pts[i - 1], *q], Stroke::new(1.0, cols[c]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1988,6 +1988,7 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
actions.push(("effect.apply".into(), json!({"effect": e, "layers": [l.0]})));
|
||||
}
|
||||
}
|
||||
crate::panels::DragPayload::Files(paths) => actions.push(("mediaBrowser.import".into(), json!({"paths": paths, "addToComp": true}))),
|
||||
crate::panels::DragPayload::Property { .. } => {}
|
||||
}
|
||||
egui::DragAndDrop::clear_payload(&ctx);
|
||||
|
||||
@@ -612,6 +612,9 @@ pub struct UiState {
|
||||
/// Flowchart panel options (layers, effects, solids, direction, root comp).
|
||||
#[serde(default)]
|
||||
pub flowchart: crate::panels::flowchart::FlowOptions,
|
||||
/// Lumetri Scopes panel options.
|
||||
#[serde(default)]
|
||||
pub scopes: crate::panels::scopes_panel::ScopesState,
|
||||
}
|
||||
|
||||
impl Default for UiState {
|
||||
@@ -665,6 +668,7 @@ impl Default for UiState {
|
||||
anim_tools: AnimToolsState::default(),
|
||||
mini_flowchart: None,
|
||||
flowchart: Default::default(),
|
||||
scopes: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user