Merge pull request #1142 from FredApps/fix/1118-video-preview-off-notice
This commit is contained in:
@@ -1138,6 +1138,14 @@ impl EffectcraftApp {
|
||||
true
|
||||
}
|
||||
|
||||
/// A preview plays with Video off in the Preview panel (audio only): the current time stays
|
||||
/// put, so the viewer and Timeline say so instead of looking stuck (#1118). The frame under
|
||||
/// the audible sample, when one is known.
|
||||
pub fn video_preview_off(&self) -> Option<Option<i64>> {
|
||||
let p = self.playback.plan.filter(|_| self.playback.playing)?;
|
||||
(!p.video).then_some(self.playback.audio_frame)
|
||||
}
|
||||
|
||||
/// The viewer shows grids, guides and safe margins (hidden while a preview without
|
||||
/// Include Overlays plays).
|
||||
pub fn overlays_visible(&self) -> bool {
|
||||
|
||||
@@ -1483,7 +1483,15 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
} else {
|
||||
effectcraft_engine::time::format_timecode_ae(fr.frame_at(time + comp.display_start), fr, false)
|
||||
};
|
||||
p.text(pos2(tc_rect.min.x, tc_rect.max.y + 8.0), Align2::LEFT_CENTER, format!("{other} ({:.2} fps)", fr.as_f64()), Tokens::ui(10.5), t.text_faint);
|
||||
// Audio-only preview (Video off in the Preview panel): the current time stays put, so that
|
||||
// line says why and where the sound is instead (#1118).
|
||||
if let Some(af) = app.video_preview_off() {
|
||||
let at = af.map(|f| format!(" · {}", effectcraft_engine::time::format_timecode_ae(f + fr.frame_at(comp.display_start), fr, false))).unwrap_or_default();
|
||||
let msg = format!("{}{at}", crate::i18n::tr("Video preview off: audio only"));
|
||||
p.text(pos2(tc_rect.min.x, tc_rect.max.y + 8.0), Align2::LEFT_CENTER, msg, Tokens::ui(10.5), t.cache_green);
|
||||
} else {
|
||||
p.text(pos2(tc_rect.min.x, tc_rect.max.y + 8.0), Align2::LEFT_CENTER, format!("{other} ({:.2} fps)", fr.as_f64()), Tokens::ui(10.5), t.text_faint);
|
||||
}
|
||||
app.auto.add("timeline.timecode", tc_rect, &tc);
|
||||
super::toggle_time_display(app, &tc_resp);
|
||||
if tc_resp.dragged() {
|
||||
|
||||
@@ -2018,6 +2018,12 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
painter.rect_filled(r, 11.0, Color32::from_black_alpha(170));
|
||||
painter.text(r.center(), Align2::CENTER_CENTER, crate::i18n::tr("Caching frames…"), Tokens::ui(11.5), t.cache_green);
|
||||
}
|
||||
if app.video_preview_off().is_some() {
|
||||
let r = Rect::from_min_size(area.min + vec2(10.0, 10.0), vec2(330.0, 22.0));
|
||||
painter.rect_filled(r, 11.0, Color32::from_black_alpha(190));
|
||||
painter.text(r.center(), Align2::CENTER_CENTER, crate::i18n::tr("Video preview is off (Preview panel): audio only"), Tokens::ui(11.5), t.timecode);
|
||||
ui.ctx().data_mut(|d| d.insert_temp(egui::Id::new("viewer-video-off-chip"), r));
|
||||
}
|
||||
|
||||
vt::draw_snap(&ctx, &painter, &map, &ectx);
|
||||
vt::rulers(app, ui, &map, outer, area);
|
||||
|
||||
Reference in New Issue
Block a user