diff --git a/i18n/en/Editor.resx b/i18n/en/Editor.resx index 243ae6ed..4e0abcf9 100644 --- a/i18n/en/Editor.resx +++ b/i18n/en/Editor.resx @@ -13,6 +13,10 @@ Aspect Horizontal centre Vertical centre + Crop bottom + Crop left + Crop right + Crop top Keyframes Keyframe {0} of {1} · {2} {0} keyframe @@ -22,18 +26,30 @@ Remove keyframe Zoom cloud cover % + Flicker + change after correction + frame-to-frame change + 0 % + 100 % + 50 % + Luminance measured luminance Not analysed yet horizontal path vertical path + video frames per photo sky region stars per Mpx exposure steps as received + Chart target curve + Waveform + luma of frame {0} Pick a sequence in the Library This sequence is no longer in the archive.long Jobs cannot run until the archive index is open.long The settings of this sequence cannot be read.long + The settings of this sequence were changed elsewhere at the same time.long about {0} Add to queue Batch… @@ -64,6 +80,7 @@ Render now Resolution Result + show file Save to Sequence exports/ Estimated size @@ -116,6 +133,7 @@ Set hero Warnings Opening sequence + Cut: pause or gap Keyframe Exposure step {0} EV Step {0} EV not received @@ -138,23 +156,30 @@ Preview 10 s Compare Crop mask + Crop result Exit full screen Full screen output {0} {0} of {1} + Pause Play Regions Shot data + This frame cannot be read. Vectors original | corrected Auto Horizon Luminance Render · {0} + Render finished Render queued + Show in folder Render Reset Back to Auto + Changes not saved + Retry Sections f/{0}invariant {0} mminvariant @@ -170,6 +195,7 @@ {0:N0} frame {0:N0} frames {0} s interval + source {0} {0} warning {0} warnings Camera @@ -185,13 +211,19 @@ output {0} % {0:N0} frame → {1} · {2} fpslong {0:N0} frames → {1} · {2} fpslong + Render plan Playback rate source {0} % Adaptive Constant Interpolated Remapped + Discard change + Keep editing + The last change to {0} could not be saved: {1}long + Unsaved change Centred + {0}°invariant {0} EVinvariant {0} fpsinvariant {0:N0} frame diff --git a/i18n/en/Tooltips.resx b/i18n/en/Tooltips.resx index 4709ec9f..80309c18 100644 --- a/i18n/en/Tooltips.resx +++ b/i18n/en/Tooltips.resx @@ -15,7 +15,9 @@ Dismiss Open the folder with the log files Return to the advisor's value - Read every frame again and refresh the analysis; runs as a background job + Read every frame again and refresh the analysis · Ctrl+Shift+A + Read every frame again and refresh the analysis · about {0} · Ctrl+Shift+A + An analysis of this sequence is already queued or running Auto: no advice yet, the engine’s default applies; Analyse lets the advisor decide Back to Library An analysis or render of this sequence is running; settings wait until it ends @@ -23,14 +25,25 @@ Output aspect ratio; a preset with a fixed size uses its own Horizontal centre of the selected keyframe’s view Vertical centre of the selected keyframe’s view + Cuts this share of the frame on that side; aspect and placement then apply inside the crop + Zoom keyframes over the sequence: double-click adds · drag moves · Delete removes · arrows nudge + This frame already has a keyframe; select it on the curve to edit it Virtual-camera keyframes: zoom and framing at chosen frames, eased in between + Select a keyframe on the curve first Moves the crop left or right inside the frame Moves the crop up or down inside the frame Remove the selected keyframe Zoom of the selected keyframe; 1 shows the whole crop, more zooms in and softens + Frame-to-frame brightness change before and after the correction + Measured luminance against the target curve, sky region and exposure steps + Video frames each photo is shown for, cuts marked · click shows that frame + Click or drag to show that frame + Luma waveform of the frame on screen: exposure and clipping at a glance + Luma of the corrected frame across the picture: white at the top, black at the bottom Add this render to the queue and keep editing Apply this sequence preset to every section · {0} Queue every ticked preset as one job; the sequence is prepared once + Tick presets on the cards first Average bit rate; more keeps detail and gradients, files grow Video or image codec; 10-bit HEVC keeps sky gradients clean Rec.709 colour; 10-bit avoids banding in skies, HDR is not offered @@ -41,7 +54,7 @@ Auto: the preset’s {0} fps Return to the preset’s frame rate Output height in pixels; empty follows the width · Enter applies, Esc reverts - Open Jobs to see the renders of this sequence + Open Jobs filtered on this sequence Include this preset when Batch queues the render Tokens: {date} {title} {preset} {codec} {width} {height} {fps} · Enter applies, Esc reverts Render with {0}; editing a value makes it Custom @@ -58,10 +71,12 @@ Frames over which each ISO, shutter or aperture step is spread; 0 keeps the steps Smooths the colour ratios so auto white balance stops flickering while the sunset drift stays Frames used to estimate the flicker-free curve; too short leaves flicker, too long flattens real light changes + Click or drag to show a frame; markers show exposure steps, warnings and keyframes Leave this frame out of every render; the photo is not deleted Show the first frame concerned - Use the frame as the sequence thumbnail + Make this the hero frame; the editor opens on it Use this frame in renders again + Sort by this column; click again to reverse Click a row to show the frame Adds blur along the motion like a slower shutter; costs optical flow on every frame Optical flow precision for blur and synthesised frames; Best is the slowest @@ -85,15 +100,24 @@ Show pixels at 1:1 without interpolation · Ctrl+1; Ctrl+0 fits Play ten seconds of the video’s frames with the current settings Wipe compare: original on the left, corrected on the right; drag the line + Dim what the output cuts (what I lose) Show the whole frame and darken what the output will cut + Hide what the output cuts (how it will look) Close full screen · Esc Full screen at native resolution · Esc closes Show the sky and landscape boundary used by region deflicker Show or hide the shot data Overlay the motion to the next frame measured by the engine + Drag the line to compare · drag to pan · wheel zooms · double-click 1:1 Render with the selected preset; progress in the job bar · Ctrl+R + Fix the file name first: {0} + Every frame is excluded: include some in the Frames tab + The frame size is unknown: the frames could not be read + Working out the render; ready in a moment + Show the rendered file in Explorer Choose another preset Return every control of this section to Auto · Ctrl+Z undoes + Try to save now; saving is also retried automatically Frames combined into each output frame; trails and smoothing grow with it Median and mean remove noise and moving things; star trails keep the brightest pixels Crop, aspect, virtual camera moves @@ -103,9 +127,12 @@ Motion blur, optical flow, stabilisation Median and star-trail stacking Frame rate, timing mode, speed curve + Output time to source position: double-click adds a point · drag moves · Delete removes · arrows nudge Scales the timing so the video lasts this long; off keeps the playback rate Constant: one frame per photo; Adaptive: follows capture time; Interpolated: fills gaps; Remapped: follows the curve Photos shown per second of video; more plays the sequence faster + Close without the change; the stored settings stay as they were + Stay in the editor; saving is retried in the background Stop this job; Retry continues later from its last checkpoint Hide finished jobs from the list; they stay in the history Every job diff --git a/i18n/it/Editor.it.resx b/i18n/it/Editor.it.resx index b4b30d0c..2d7f8f68 100644 --- a/i18n/it/Editor.it.resx +++ b/i18n/it/Editor.it.resx @@ -12,6 +12,10 @@ Formato Centro orizzontale Centro verticale + Ritaglio in basso + Ritaglio a sinistra + Ritaglio a destra + Ritaglio in alto Fotogrammi chiave Chiave {0} di {1} · {2} {0} chiave @@ -21,18 +25,30 @@ Rimuovi chiave Zoom copertura nuvolosa % + Sfarfallio + variazione dopo la correzione + variazione tra fotogrammi + 0% + 100% + 50% + Luminanza luminanza misurata Non ancora analizzata percorso orizzontale percorso verticale + fotogrammi video per foto regione del cielo stelle per Mpx salti di esposizione ricevuti + Grafico curva obiettivo + Forma d’onda + luma del fotogramma {0} Scegli una sequenza in Libreria Questa sequenza non è più nell’archivio. I lavori non possono partire finché l’indice dell’archivio non è aperto. Le impostazioni di questa sequenza non sono leggibili. + Le impostazioni di questa sequenza sono state modificate altrove nello stesso momento. circa {0} Metti in coda In serie… @@ -43,7 +59,7 @@ Encoder Auto Nome file - Fotogrammi al secondo + Fotogrammi/s hardware Altezza Render precedenti: {0} · ultimo {1} @@ -59,6 +75,7 @@ Renderizza ora Risoluzione Risultato + mostra file Salva in exports/ della sequenza Dimensione stimata @@ -75,7 +92,7 @@ Intensità Temperatura colore Transizioni - Bilanciamento del bianco + Bilanciamento uniforme Finestra deflicker Pellicola Bilanciata @@ -108,6 +125,7 @@ Imposta copertina Avvisi Apertura sequenza + Taglio: pausa o vuoto Fotogramma chiave Salto di esposizione {0} EV Salto {0} EV non ricevuto @@ -128,23 +146,30 @@ Anteprima 10 s Confronta Maschera ritaglio + Risultato ritaglio Esci da schermo intero Schermo intero uscita {0} {0} di {1} + Pausa Riproduci Regioni Dati di scatto + Questo fotogramma non si può leggere. Vettori originale | corretto Auto Orizzonte Luminanza Renderizza · {0} + Render completato Render in coda + Mostra nella cartella Renderizza Ripristina Torna ad Auto + Modifiche non salvate + Riprova Sezioni Lunghezza Media @@ -156,6 +181,7 @@ {0:N0} fotogramma {0:N0} fotogrammi intervallo {0} s + sorgente {0} {0} avviso {0} avvisi Inquadratura @@ -171,12 +197,17 @@ uscita {0} % {0:N0} fotogramma → {1} · {2} fps {0:N0} fotogrammi → {1} · {2} fps + Piano di render Velocità sorgente {0} % Adattivo Costante Interpolato Su curva + Scarta modifica + Continua a modificare + L’ultima modifica a {0} non è stata salvata: {1} + Modifica non salvata Centrato {0:N0} fotogramma {0:N0} fotogrammi diff --git a/i18n/it/Tooltips.it.resx b/i18n/it/Tooltips.it.resx index eda5c4e9..37ddddd5 100644 --- a/i18n/it/Tooltips.it.resx +++ b/i18n/it/Tooltips.it.resx @@ -15,7 +15,9 @@ Chiudi Apri la cartella dei file di log Torna al valore consigliato - Rilegge ogni fotogramma e aggiorna l’analisi; gira come lavoro in background + Rilegge ogni fotogramma e aggiorna l’analisi · Ctrl+Maiusc+A + Rilegge ogni fotogramma e aggiorna l’analisi · circa {0} · Ctrl+Maiusc+A + Un’analisi di questa sequenza è già in coda o in corso Auto: ancora nessun consiglio, vale il valore predefinito; Analizza lascia decidere al consulente Torna alla Libreria È in corso un’analisi o un render di questa sequenza; le impostazioni attendono la fine @@ -23,14 +25,25 @@ Formato dell’uscita; un preset con dimensioni fisse usa il proprio Centro orizzontale dell’inquadratura della chiave scelta Centro verticale dell’inquadratura della chiave scelta + Taglia questa parte del fotogramma su quel lato; formato e posizione valgono poi dentro il ritaglio + Fotogrammi chiave dello zoom: doppio clic aggiunge · trascina sposta · Canc rimuove · le frecce spostano di poco + Questo fotogramma ha già un fotogramma chiave; selezionalo sulla curva per modificarlo Chiavi della camera virtuale: zoom e inquadratura in fotogrammi scelti, raccordati tra loro + Seleziona prima un fotogramma chiave sulla curva Sposta il ritaglio a sinistra o a destra nel fotogramma Sposta il ritaglio in alto o in basso nel fotogramma Rimuove la chiave selezionata Zoom della chiave scelta; 1 mostra tutto il ritaglio, di più ingrandisce e ammorbidisce - Mette in coda questo render e continui a modificare + Variazione di luminosità tra fotogrammi prima e dopo la correzione + Luminanza misurata rispetto alla curva obiettivo, regione del cielo e salti di esposizione + Fotogrammi video per ogni foto, con i tagli segnati · un clic mostra quel fotogramma + Clic o trascina per mostrare quel fotogramma + Forma d’onda della luma del fotogramma a schermo: esposizione e clipping a colpo d’occhio + Luma del fotogramma corretto lungo l’immagine: bianco in alto, nero in basso + Mette in coda questo render; puoi continuare a modificare Applica questo preset di sequenza a tutte le sezioni · {0} Mette in coda i preset spuntati come un unico lavoro; la sequenza si prepara una volta + Spunta prima i preset sulle schede Bit rate medio; di più conserva dettagli e sfumature, i file crescono Codec video o immagine; HEVC a 10 bit mantiene pulite le sfumature del cielo Colore Rec.709; 10 bit evitano il banding nel cielo, l’HDR non è disponibile @@ -41,7 +54,7 @@ Auto: i {0} fps del preset Torna ai fotogrammi al secondo del preset Altezza in pixel; vuoto segue la larghezza · Invio applica, Esc annulla - Apre Lavori per vedere i render di questa sequenza + Apre Lavori filtrati su questa sequenza Include questo preset quando In serie mette in coda il render Segnaposto: {date} {title} {preset} {codec} {width} {height} {fps} · Invio applica, Esc annulla Renderizza con {0}; modificare un valore lo rende Personalizzato @@ -58,10 +71,12 @@ Fotogrammi su cui si distribuisce ogni salto di ISO, tempo o diaframma; 0 lascia i salti Smussa i rapporti di colore: il bilanciamento automatico smette di sfarfallare e la deriva del tramonto resta Fotogrammi usati per stimare la curva senza sfarfallio; troppo corta lo lascia, troppo lunga appiattisce i veri cambi di luce + Clic o trascina per mostrare un fotogramma; i segni indicano salti di esposizione, avvisi e fotogrammi chiave Lascia fuori questo fotogramma da ogni render; la foto non viene eliminata Mostra il primo fotogramma interessato - Usa il fotogramma come copertina della sequenza + Rende questo fotogramma la copertina; l’editor si apre qui Usa di nuovo questo fotogramma nei render + Ordina per questa colonna; un altro clic inverte Fai clic su una riga per mostrare il fotogramma Aggiunge mosso lungo il movimento come un tempo più lungo; richiede il flusso ottico su ogni fotogramma Precisione del flusso ottico per mosso e fotogrammi sintetici; Massima è la più lenta @@ -85,15 +100,24 @@ Mostra i pixel 1:1 senza interpolazione · Ctrl+1; Ctrl+0 adatta Riproduce dieci secondi dei fotogrammi del video con le impostazioni attuali Confronto a tendina: originale a sinistra, corretto a destra; trascina la linea + Scurisce ciò che l’uscita taglia (cosa perdo) Mostra tutto il fotogramma e scurisce ciò che l’uscita taglierà + Nasconde ciò che l’uscita taglia (come apparirà) Chiudi schermo intero · Esc Schermo intero alla risoluzione nativa · Esc chiude Mostra il confine tra cielo e paesaggio usato dal deflicker per regioni Mostra o nasconde i dati di scatto Sovrappone il movimento verso il fotogramma successivo misurato dal motore + Trascina la linea per confrontare · trascina per spostare · la rotellina ingrandisce · doppio clic 1:1 Renderizza con il preset scelto; avanzamento nella barra dei lavori · Ctrl+R + Correggi prima il nome del file: {0} + Tutti i fotogrammi sono esclusi: includine alcuni nella scheda Fotogrammi + La dimensione dei fotogrammi è sconosciuta: non è stato possibile leggerli + Calcolo del render in corso; pronto tra un attimo + Mostra il file del render in Esplora file Scegli un altro preset Riporta in Auto ogni controllo di questa sezione · Ctrl+Z annulla + Prova a salvare ora; il salvataggio viene anche ritentato da solo Fotogrammi combinati in ogni fotogramma d’uscita; scie e levigatura crescono con esso Mediana e media tolgono rumore e ciò che si muove; le scie stellari tengono i pixel più luminosi Ritaglio, formato, movimenti della camera virtuale @@ -102,10 +126,13 @@ Tabella dei fotogrammi, avvisi, esclusioni Mosso, flusso ottico, stabilizzazione Stacking a mediana e scie stellari - Velocità, modo dei tempi, curva di velocità + Frequenza fotogrammi, modo dei tempi, curva di velocità + Tempo del video verso posizione nella sequenza: doppio clic aggiunge un punto · trascina sposta · Canc rimuove · le frecce spostano di poco Scala i tempi perché il video duri così; spento mantiene la velocità Costante: un fotogramma per foto; Adattivo: segue l’ora di scatto; Interpolato: riempie i vuoti; Su curva: segue la curva Foto mostrate per secondo di video; di più accelera la sequenza + Chiude senza la modifica; le impostazioni salvate restano com’erano + Resta nell’editor; il salvataggio viene ritentato in background Ferma questa attività; Riprova la continua più tardi dall'ultimo punto di ripresa Nasconde le attività concluse dall'elenco; restano nella cronologia Tutte le attività diff --git a/src/Titano.App/Editor/CameraTab.cs b/src/Titano.App/Editor/CameraTab.cs index dd52d241..0d0f1841 100644 --- a/src/Titano.App/Editor/CameraTab.cs +++ b/src/Titano.App/Editor/CameraTab.cs @@ -8,18 +8,34 @@ using Titano.Core.Localization; using Titano.Core.Mathematics; using Titano.Core.Project; using Titano.Ui.Mvvm; +using Titano.Ui.Visuals; namespace Titano.App.Editor; +/// Margins of the free crop, in the order of CameraTab.Margins (opposites differ in the lowest bit). +public enum CropSide +{ + Left, + Right, + Top, + Bottom, +} + /// -/// Camera (BRIEF §12.3): output aspect and crop placement, and virtual-camera keyframes edited as a zoom curve over the -/// sequence (X = frame, Y = zoom) with the selected keyframe's framing below. +/// Camera (BRIEF §12.3): the free crop of the frame (margins), the output aspect and its placement inside the crop, and +/// virtual-camera keyframes edited as a zoom curve over the sequence (X = frame, Y = zoom) with the selected keyframe's +/// framing below. /// public sealed class CameraTab : EditorTab { /// Zoom at the top of the curve editor. public const double MaxZoom = 4; + /// Largest crop margin; opposite margins together leave at least of the frame. + public const double MaxCropMargin = 0.45; + + public const double MinCropSize = 0.1; + private int _selectedKey = -1; public CameraTab(EditorViewModel editor) @@ -28,6 +44,10 @@ public sealed class CameraTab : EditorTab var s = editor.Session; Rows = [ + CropRow(s, CropSide.Left, "Editor.Camera.CropLeft"), + CropRow(s, CropSide.Right, "Editor.Camera.CropRight"), + CropRow(s, CropSide.Top, "Editor.Camera.CropTop"), + CropRow(s, CropSide.Bottom, "Editor.Camera.CropBottom"), new AutoChoiceRow(s, EditorSettings.Aspect, "Editor.Camera.Aspect", "Tooltips.Editor.Camera.Aspect", [ new Choice("source", "Editor.Aspect.Source"), new Choice("16:9", "Editor.Aspect.Ratio", "16:9"), new Choice("21:9", "Editor.Aspect.Ratio", "21:9"), @@ -35,9 +55,9 @@ public sealed class CameraTab : EditorTab new Choice("9:16", "Editor.Aspect.Ratio", "9:16"), new Choice("4:5", "Editor.Aspect.Ratio", "4:5"), ]), new NumberRow(s, "Editor.Camera.OffsetX", "Tooltips.Editor.Camera.OffsetX", -1, 1, 0.05, p => p.Camera.OffsetX, - (p, v) => p with { Camera = p.Camera with { OffsetX = v } }, Placement), + (p, v) => p with { Camera = p.Camera with { OffsetX = v } }, EditorText.Placement), new NumberRow(s, "Editor.Camera.OffsetY", "Tooltips.Editor.Camera.OffsetY", -1, 1, 0.05, p => p.Camera.OffsetY, - (p, v) => p with { Camera = p.Camera with { OffsetY = v } }, Placement), + (p, v) => p with { Camera = p.Camera with { OffsetY = v } }, EditorText.Placement), ]; AddKeyCommand = new RelayCommand(AddKey, () => !Editor.IsBusy && Keys.All(k => k.Frame != Editor.CurrentIndex)); RemoveKeyCommand = new RelayCommand(RemoveKey, () => !Editor.IsBusy && SelectedKey >= 0); @@ -96,6 +116,12 @@ public sealed class CameraTab : EditorTab public ICommand RemoveKeyCommand { get; } + /// What Add keyframe does, or why it cannot run now. + public string AddKeyToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy" + : Keys.Any(k => k.Frame == Editor.CurrentIndex) ? "Tooltips.Editor.Camera.KeyExists" : "Tooltips.Editor.Camera.AddKey"); + + public string RemoveKeyToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy" : HasSelectedKey ? "Tooltips.Editor.Camera.RemoveKey" : "Tooltips.Editor.Camera.NoKey"); + /// Run by the curve editor after each finished edit. public ICommand CommitCurveCommand { get; } @@ -130,9 +156,38 @@ public sealed class CameraTab : EditorTab Editor.Session.Edit(p => p with { Camera = p.Camera with { Keyframes = [.. keys.DistinctBy(k => k.Frame)] } }); } - public void OnCurrentFrameChanged() => OnPropertyChanged(nameof(Playhead)); + public override void OnCurrentFrameChanged() + { + OnPropertyChanged(nameof(Playhead)); + OnPropertyChanged(nameof(AddKeyToolTip)); + } - private static string Placement(double value) => value == 0 ? Loc.L("Editor.Value.Centred") : value.ToString("+0.00;−0.00", Loc.Culture); + public override void OnBusyChanged() + { + base.OnBusyChanged(); + OnPropertyChanged(nameof(AddKeyToolTip)); + OnPropertyChanged(nameof(RemoveKeyToolTip)); + } + + /// A margin of the free crop (, normalised x, y, width, height); all zero = the whole frame. + private static NumberRow CropRow(EditorSession session, CropSide side, string headerKey) => new(session, headerKey, "Tooltips.Editor.Camera.Crop", 0, + MaxCropMargin, 0.01, p => Margins(p.Camera.Crop)[(int)side], (p, v) => p with { Camera = p.Camera with { Crop = WithMargin(p.Camera.Crop, side, v) } }, + v => Formatting.Percent(v)); + + /// Left, right, top and bottom margins of a crop rectangle. + private static double[] Margins(double[]? crop) => crop is [var x, var y, var w, var h] && new[] { x, y, w, h }.All(double.IsFinite) + ? [double.Clamp(x, 0, 1), double.Clamp(1 - x - w, 0, 1), double.Clamp(y, 0, 1), double.Clamp(1 - y - h, 0, 1)] + : [0, 0, 0, 0]; + + private static double[]? WithMargin(double[]? crop, CropSide side, double value) + { + var margins = Margins(crop); + var opposite = (int)side ^ 1; + margins[(int)side] = double.Clamp(value, 0, double.Min(MaxCropMargin, 1 - MinCropSize - margins[opposite])); + if (margins.All(m => m == 0)) return null; + var (left, right, top, bottom) = (margins[0], margins[1], margins[2], margins[3]); + return [left, top, 1 - left - right, 1 - top - bottom]; + } private Point ToPoint(CameraKey key) => new(Editor.FrameCount > 1 ? (double)key.Frame / (Editor.FrameCount - 1) : 0, (key.Zoom - 1) / (MaxZoom - 1)); @@ -166,6 +221,7 @@ public sealed class CameraTab : EditorTab private void OnSelectedKeyChanged() { OnPropertyChanged(nameof(HasSelectedKey)); + OnPropertyChanged(nameof(RemoveKeyToolTip)); OnPropertyChanged(nameof(SelectedCenterX)); OnPropertyChanged(nameof(SelectedCenterY)); OnPropertyChanged(nameof(SelectedZoom)); @@ -175,13 +231,16 @@ public sealed class CameraTab : EditorTab } /// -/// Time (BRIEF §12.3): timing mode, playback rate, fit-to duration and the time-remap curve (output time → source -/// position, Fritsch–Carlson as the render evaluates it), with the plan in numbers. +/// Time (BRIEF §12.3): timing mode, playback rate, fit-to duration, the plan chart (video frames each photo gets, cuts +/// marked, the plan in numbers) and the time-remap curve (output time → source position, Fritsch–Carlson as the render +/// evaluates it). /// public sealed class TimeTab : EditorTab { private Func? _evaluator; private string? _planText; + private IReadOnlyList _planSeries = []; + private IReadOnlyList _planMarkers = []; public TimeTab(EditorViewModel editor) : base(editor, "Time", AdvisorSection.Timing) @@ -216,6 +275,16 @@ public sealed class TimeTab : EditorTab /// "3,600 frames → 2 min 30 s · 24 fps". public string? PlanText { get => _planText; private set => Set(ref _planText, value); } + /// Video frames each photo is shown for (0 = skipped by a speed-up, gap = excluded), over the sequence. + public IReadOnlyList PlanSeries { get => _planSeries; private set => Set(ref _planSeries, value); } + + /// Cuts of the plan (deliberate pauses, gaps, long exclusion runs). + public IReadOnlyList PlanMarkers { get => _planMarkers; private set => Set(ref _planMarkers, value); } + + public IReadOnlyList PlanLegend { get; } = [new(Loc.L("Editor.Chart.Shown"), "Brush.Accent")]; + + public Func PlanFormatter { get; } = v => v.ToString("0.#", Loc.Culture); + public double Playhead => Editor.FrameCount > 1 ? (double)Editor.CurrentIndex / (Editor.FrameCount - 1) : double.NaN; public Func XFormatter { get; } = x => Loc.L("Editor.Time.Output", (x * 100).ToString("0", Loc.Culture)); @@ -240,11 +309,23 @@ public sealed class TimeTab : EditorTab if (Editor.Plan is not { } plan) { PlanText = null; + PlanSeries = []; + PlanMarkers = []; return; } var render = plan.Setup.Plan; PlanText = Loc.Plural("Editor.Time.Plan", render.Frames.Count, Formatting.Duration(TimeSpan.FromSeconds(render.DurationSeconds)), EditorText.FrameRate(render.FrameRate)); + var shown = new double[Editor.FrameCount]; + Array.Fill(shown, double.NaN); + foreach (var index in render.IncludedFrames) shown[index] = 0; + foreach (var frame in render.Frames) + { + var index = int.Clamp((int)double.Round(frame.SourcePosition), 0, shown.Length - 1); + shown[index] = (double.IsNaN(shown[index]) ? 0 : shown[index]) + frame.Slots; + } + PlanSeries = [new ChartSeries(Loc.L("Editor.Chart.Shown"), shown, "Brush.Accent")]; + PlanMarkers = [.. render.IncludedFrames.Where(render.IsCutBefore).Select(i => new TimelineMarker(i, MarkerKind.Warning, Loc.L("Editor.Marker.Cut")))]; } /// The curve editor finished an edit: the points become the remap curve, and the timing mode follows it. @@ -261,7 +342,7 @@ public sealed class TimeTab : EditorTab }); } - public void OnCurrentFrameChanged() => OnPropertyChanged(nameof(Playhead)); + public override void OnCurrentFrameChanged() => OnPropertyChanged(nameof(Playhead)); private static Func? Spline(IReadOnlyList points) { diff --git a/src/Titano.App/Editor/CardColumns.cs b/src/Titano.App/Editor/CardColumns.cs new file mode 100644 index 00000000..c64190e2 --- /dev/null +++ b/src/Titano.App/Editor/CardColumns.cs @@ -0,0 +1,17 @@ +using System.Globalization; +using System.Windows.Data; + +namespace Titano.App.Editor; + +/// Columns of the Export tab's preset grid: as many as fit at (four at 1440 px, three at 1200 px). +public sealed class CardColumns : IValueConverter +{ + public const double MinCardWidth = 200; + + public static CardColumns Instance { get; } = new(); + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => + value is double width && double.IsFinite(width) ? int.Max(1, (int)(width / MinCardWidth)) : 4; + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotSupportedException(); +} diff --git a/src/Titano.App/Editor/EditorImages.cs b/src/Titano.App/Editor/EditorImages.cs index 95ce23bb..ce709f30 100644 --- a/src/Titano.App/Editor/EditorImages.cs +++ b/src/Titano.App/Editor/EditorImages.cs @@ -19,6 +19,21 @@ public static class EditorImages bitmap.Freeze(); return bitmap; } + + /// A waveform as an opacity mask (white, alpha = density) so the view paints it in a theme brush. + public static BitmapSource ToMask(LumaWaveform waveform) + { + ArgumentNullException.ThrowIfNull(waveform); + var pixels = new byte[waveform.Density.Length * 4]; + for (var i = 0; i < waveform.Density.Length; i++) + { + var alpha = waveform.Density[i]; + pixels[4 * i] = pixels[4 * i + 1] = pixels[4 * i + 2] = pixels[4 * i + 3] = alpha; + } + var bitmap = BitmapSource.Create(waveform.Columns, waveform.Rows, 96, 96, PixelFormats.Pbgra32, null, pixels, waveform.Columns * 4); + bitmap.Freeze(); + return bitmap; + } } /// diff --git a/src/Titano.App/Editor/EditorMeasures.xaml b/src/Titano.App/Editor/EditorMeasures.xaml index 21d43e4f..18fd29c6 100644 --- a/src/Titano.App/Editor/EditorMeasures.xaml +++ b/src/Titano.App/Editor/EditorMeasures.xaml @@ -5,25 +5,81 @@ xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui" xmlns:e="clr-namespace:Titano.App.Editor"> + + + + CurrentIndex="{Binding Editor.CurrentIndex, Mode=TwoWay}" ToolTip="{l:Loc Tooltips.Editor.Chart.Seek}" AutomationProperties.Name="{Binding Header}" /> + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -35,7 +91,7 @@ - + @@ -43,7 +99,7 @@ - + @@ -56,14 +112,22 @@ - - - - - - - - +