diff --git a/src/Titano.App/Editor/CameraTab.cs b/src/Titano.App/Editor/CameraTab.cs
index b964b43a..b346e4ca 100644
--- a/src/Titano.App/Editor/CameraTab.cs
+++ b/src/Titano.App/Editor/CameraTab.cs
@@ -106,6 +106,9 @@ public sealed class CameraTab : EditorTab
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");
+ /// How to edit the keyframe curve, or why it waits.
+ public string CurveToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy" : "Tooltips.Editor.Camera.Curve");
+
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.
@@ -153,6 +156,7 @@ public sealed class CameraTab : EditorTab
base.OnBusyChanged();
OnPropertyChanged(nameof(AddKeyToolTip));
OnPropertyChanged(nameof(RemoveKeyToolTip));
+ OnPropertyChanged(nameof(CurveToolTip));
}
/// A margin of the free crop (); all zero = the whole frame.
@@ -243,6 +247,9 @@ public sealed class TimeTab : EditorTab
/// Run by the curve editor after each finished edit.
public ICommand CommitCurveCommand { get; }
+ /// How to edit the remap curve, or why it waits.
+ public string CurveToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy" : "Tooltips.Editor.Time.Curve");
+
/// "3,600 frames → 2 min 30 s · 24 fps".
public string? PlanText { get => _planText; private set => Set(ref _planText, value); }
@@ -315,6 +322,12 @@ public sealed class TimeTab : EditorTab
public override void OnCurrentFrameChanged() => OnPropertyChanged(nameof(Playhead));
+ public override void OnBusyChanged()
+ {
+ base.OnBusyChanged();
+ OnPropertyChanged(nameof(CurveToolTip));
+ }
+
private static Func? Spline(IReadOnlyList points)
{
if (points.Count < 2) return null;
diff --git a/src/Titano.App/Editor/EditorMeasures.xaml b/src/Titano.App/Editor/EditorMeasures.xaml
index 18fd29c6..3486ba0c 100644
--- a/src/Titano.App/Editor/EditorMeasures.xaml
+++ b/src/Titano.App/Editor/EditorMeasures.xaml
@@ -156,10 +156,11 @@
-
@@ -186,7 +187,7 @@
@@ -209,7 +210,7 @@
diff --git a/src/Titano.App/Editor/EditorPanels.xaml b/src/Titano.App/Editor/EditorPanels.xaml
index 75dfd482..0ce71b18 100644
--- a/src/Titano.App/Editor/EditorPanels.xaml
+++ b/src/Titano.App/Editor/EditorPanels.xaml
@@ -228,7 +228,7 @@
+ ToolTip="{Binding HeroToolTip}" ToolTipService.ShowOnDisabled="True" AutomationProperties.Name="{l:Loc Editor.Frames.SetHero}" />
@@ -239,7 +239,8 @@
-
+
Loc.L(IsExcluded ? "Editor.Frames.Include" : "Editor.Frames.Exclude");
- public string ExcludeToolTip => Loc.L(IsExcluded ? "Tooltips.Editor.Frames.Include" : "Tooltips.Editor.Frames.Exclude");
+ public string ExcludeToolTip => Loc.L(owner.Editor.IsBusy ? "Tooltips.Editor.Busy" : IsExcluded ? "Tooltips.Editor.Frames.Include" : "Tooltips.Editor.Frames.Exclude");
+
+ /// A job of the sequence started or ended: the action tooltips say why they wait.
+ public void RefreshBusy() => OnPropertyChanged(nameof(ExcludeToolTip));
/// The project's exclusions or hero changed.
public void Refresh()
@@ -176,7 +179,10 @@ public sealed class FramesTab : EditorTab
public string CurrentExcludeText => Loc.L(IsCurrentExcluded ? "Editor.Frames.IncludeFrame" : "Editor.Frames.ExcludeFrame");
- public string CurrentExcludeToolTip => Loc.L(IsCurrentExcluded ? "Tooltips.Editor.Frames.Include" : "Tooltips.Editor.Frames.Exclude");
+ public string CurrentExcludeToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy" : IsCurrentExcluded ? "Tooltips.Editor.Frames.Include" : "Tooltips.Editor.Frames.Exclude");
+
+ /// What Set hero does, or why it waits.
+ public string HeroToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy" : "Tooltips.Editor.Frames.Hero");
public override bool CanReset => false;
@@ -224,6 +230,14 @@ public sealed class FramesTab : EditorTab
base.OnContentChanged();
}
+ public override void OnBusyChanged()
+ {
+ base.OnBusyChanged();
+ OnPropertyChanged(nameof(HeroToolTip));
+ OnPropertyChanged(nameof(CurrentExcludeToolTip));
+ foreach (var row in _rows) row.RefreshBusy();
+ }
+
public override void OnCurrentFrameChanged()
{
var index = Editor.CurrentIndex;
diff --git a/src/Titano.App/Editor/PreviewRenderer.cs b/src/Titano.App/Editor/PreviewRenderer.cs
index b31bfbfe..55e317fe 100644
--- a/src/Titano.App/Editor/PreviewRenderer.cs
+++ b/src/Titano.App/Editor/PreviewRenderer.cs
@@ -175,20 +175,32 @@ public sealed class PreviewRenderer(SequenceContent content, ISequenceSource sou
}.ToJson();
/// Cache key of the measuring preparation: the settings that change what is measured, resolved as the preparation resolves them.
- internal static string MeasureKey(ProjectSettings project)
+ private string MeasureKey(ProjectSettings project)
{
- var (whiteBalance, stabilize, smoothing) = Measured(project);
- return string.Join('|', whiteBalance, stabilize, smoothing.ToString("R", CultureInfo.InvariantCulture), string.Join(',', project.ExcludedFrames));
+ var (luminance, whiteBalance, stabilize, smoothing) = Measured(project);
+ return string.Join('|', luminance, whiteBalance, stabilize, smoothing.ToString("R", CultureInfo.InvariantCulture), string.Join(',', project.ExcludedFrames));
}
- private static (bool WhiteBalance, bool Stabilize, double Smoothing) Measured(ProjectSettings project) => (
+ ///
+ /// What the measuring preparation measures for : luminance when the deep analysis has it
+ /// (free) or a module needs it, colour means for white-balance smoothing, the stabilisation path.
+ ///
+ private (bool Luminance, bool WhiteBalance, bool Stabilize, double Smoothing) Measured(ProjectSettings project) => (
+ HasDeepAnalysis || project.Exposure.Deflicker.Resolve(false) || project.Exposure.HolyGrail.Resolve(false),
project.Exposure.WhiteBalanceSmoothing.Resolve(false),
project.Motion.Stabilize.Resolve(false),
project.Motion.StabilizeSmoothing.Resolve(new StabilizerOptions().SmoothingSigma));
+ /// The deep analysis describes the current frames (its luminance is reused).
+ private bool HasDeepAnalysis => content.Deep is { } deep && deep.FrameCount == content.Count;
+
+ private PrecomputedAnalysis? DeepLuminance => HasDeepAnalysis
+ ? new PrecomputedAnalysis { LogLuminance = [.. content.Deep!.Frames.LogLuminance.Select(v => v ?? double.NaN)] }
+ : null;
+
///
- /// Luminance (deflicker forced on so it is always there), colour means and the stabilisation path for the project's
- /// exclusions, prepared once per .
+ /// Luminance (deflicker forced on while it is wanted, so it is measured or taken from the deep analysis), colour
+ /// means and the stabilisation path for the project's exclusions, prepared once per .
///
private async Task MeasureAsync(ProjectSettings project, CancellationToken cancellationToken)
{
@@ -197,30 +209,27 @@ public sealed class PreviewRenderer(SequenceContent content, ISequenceSource sou
{
if (_measured is { } measured && measured.Key == key) return measured.Corrections;
}
- var (whiteBalance, stabilize, smoothing) = Measured(project);
+ var (luminance, whiteBalance, stabilize, smoothing) = Measured(project);
var basis = new ProjectSettings();
var measuring = basis with
{
Exposure = basis.Exposure with
{
- Deflicker = basis.Exposure.Deflicker.WithManual(true),
+ Deflicker = basis.Exposure.Deflicker.WithManual(luminance),
WhiteBalanceSmoothing = basis.Exposure.WhiteBalanceSmoothing.WithManual(whiteBalance),
},
Motion = basis.Motion with { Stabilize = basis.Motion.Stabilize.WithManual(stabilize), StabilizeSmoothing = basis.Motion.StabilizeSmoothing.WithManual(smoothing) },
ExcludedFrames = project.ExcludedFrames,
};
- var analysis = content.Deep is { } deep && deep.FrameCount == content.Count
- ? new PrecomputedAnalysis { LogLuminance = [.. deep.Frames.LogLuminance.Select(v => v ?? double.NaN)] }
- : null;
- var corrections = await RenderPreparation.PrepareAsync(Input(measuring, analysis), Options, null, cancellationToken).ConfigureAwait(false);
+ var corrections = await RenderPreparation.PrepareAsync(Input(measuring, DeepLuminance), Options, null, cancellationToken).ConfigureAwait(false);
lock (_gate) _measured = (key, corrections);
return corrections;
}
/// The measured series a re-solve reuses.
- private static PrecomputedAnalysis Reuse(RenderCorrections measured, ProjectSettings project) => new()
+ private PrecomputedAnalysis Reuse(RenderCorrections measured, ProjectSettings project) => new()
{
- LogLuminance = measured.MeasuredLogLuminance,
+ LogLuminance = Measured(project).Luminance ? measured.MeasuredLogLuminance : null,
Stabilization = measured.Stabilization is { } corrections
// The zoom is 1 / max(crop scale, 0.75), so its inverse is the crop scale the render zooms by.
? new StabilizationResult([], [], [], corrections, measured.Report.ShakeRms ?? 0, 1 / measured.StabilizationZoom, false)
diff --git a/src/Titano.Ui/Visuals/PreviewViewport.cs b/src/Titano.Ui/Visuals/PreviewViewport.cs
index 50bfb31b..5c25cd31 100644
--- a/src/Titano.Ui/Visuals/PreviewViewport.cs
+++ b/src/Titano.Ui/Visuals/PreviewViewport.cs
@@ -112,6 +112,7 @@ public class PreviewViewport : Control
private PreviewSurface? _surface;
private FrameworkElement? _tools;
private FrameworkElement? _info;
+ private Thickness _infoMargin;
private ViewTransform _view = new(1, 0, 0);
private Size _imageSize = Size.Empty;
private bool _syncingZoom;
@@ -200,6 +201,7 @@ public class PreviewViewport : Control
base.OnApplyTemplate();
_tools = GetTemplateChild(PartTools) as FrameworkElement;
_info = GetTemplateChild(PartInfo) as FrameworkElement;
+ if (_info is not null) _infoMargin = _info.Margin;
_surface = GetTemplateChild(PartSurface) as PreviewSurface;
if (_surface is null) return;
_surface.Owner = this;
@@ -208,15 +210,15 @@ public class PreviewViewport : Control
ApplyZoomMode();
}
- /// The shot data pill sits beside the tools at the bottom, and moves to the top when both do not fit in one row.
+ /// The shot data pill sits beside the tools at the bottom, and just above them when both do not fit in one row.
protected override Size ArrangeOverride(Size arrangeBounds)
{
var size = base.ArrangeOverride(arrangeBounds);
if (_tools is not null && _info is not null)
{
- var needed = _tools.DesiredSize.Width + _info.DesiredSize.Width;
- var place = needed > arrangeBounds.Width ? VerticalAlignment.Top : VerticalAlignment.Bottom;
- if (_info.VerticalAlignment != place) _info.VerticalAlignment = place;
+ var lifted = _tools.DesiredSize.Width + _info.DesiredSize.Width > arrangeBounds.Width;
+ var margin = lifted ? _infoMargin with { Bottom = _tools.DesiredSize.Height - _tools.Margin.Top + 6 } : _infoMargin;
+ if (_info.Margin != margin) _info.Margin = margin;
}
return size;
}
diff --git a/tests/Titano.App.Tests/Editor/PreviewRendererTests.cs b/tests/Titano.App.Tests/Editor/PreviewRendererTests.cs
index 1362e8ba..f27a214f 100644
--- a/tests/Titano.App.Tests/Editor/PreviewRendererTests.cs
+++ b/tests/Titano.App.Tests/Editor/PreviewRendererTests.cs
@@ -119,6 +119,24 @@ public sealed class PreviewRendererTests
Assert.Equal(decodes, source.Decodes, "a strength or transition change re-solves from the measured series");
}
+ [Test]
+ public async Task WithoutAnalysisNothingIsMeasuredUntilAModuleNeedsIt()
+ {
+ var content = EditorFixture.Content(EditorFixture.Sunset, deep: false);
+ var source = new FakeSequenceSource(EditorFixture.Sunset, content);
+ var renderer = new PreviewRenderer(content, source);
+ await renderer.PrepareAsync(new ProjectSettings(), CancellationToken.None);
+ Assert.Equal(0, source.Decodes, "no module on, nothing to measure");
+
+ var project = Deflickered();
+ await renderer.PrepareAsync(project, CancellationToken.None);
+ var decodes = source.Decodes;
+ Assert.GreaterOrEqual(decodes, EditorFixture.Sunset.Count, "deflicker measures the luminance once");
+ await renderer.PrepareAsync(project with { Exposure = project.Exposure with { DeflickerStrength = project.Exposure.DeflickerStrength.WithManual(0.4) } },
+ CancellationToken.None);
+ Assert.Equal(decodes, source.Decodes);
+ }
+
[Test]
public async Task AReSolveMatchesAFreshPreparation()
{