fix(app): busy reasons on frame actions and curves; shot data lifts above the tools
- Exclude, Set hero and the curve editors say why they wait while a job runs. - The preview's shot data moves just above the tools when both do not fit in one row (1200 px window with labelled tools) instead of overlapping them. - The measuring preparation reads luminance only when the deep analysis has it or a module needs it, so an unanalysed sequence with no module on decodes nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
7 files changed
+84
-26
No files matched your search
@@ -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");
|
||||
|
||||
/// <summary>How to edit the keyframe curve, or why it waits.</summary>
|
||||
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");
|
||||
|
||||
/// <summary>Run by the curve editor after each finished edit.</summary>
|
||||
@@ -153,6 +156,7 @@ public sealed class CameraTab : EditorTab
|
||||
base.OnBusyChanged();
|
||||
OnPropertyChanged(nameof(AddKeyToolTip));
|
||||
OnPropertyChanged(nameof(RemoveKeyToolTip));
|
||||
OnPropertyChanged(nameof(CurveToolTip));
|
||||
}
|
||||
|
||||
/// <summary>A margin of the free crop (<see cref="CropMargins"/>); all zero = the whole frame.</summary>
|
||||
@@ -243,6 +247,9 @@ public sealed class TimeTab : EditorTab
|
||||
/// <summary>Run by the curve editor after each finished edit.</summary>
|
||||
public ICommand CommitCurveCommand { get; }
|
||||
|
||||
/// <summary>How to edit the remap curve, or why it waits.</summary>
|
||||
public string CurveToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy" : "Tooltips.Editor.Time.Curve");
|
||||
|
||||
/// <summary>"3,600 frames → 2 min 30 s · 24 fps".</summary>
|
||||
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<double, double>? Spline(IReadOnlyList<Point> points)
|
||||
{
|
||||
if (points.Count < 2) return null;
|
||||
|
||||
@@ -156,10 +156,11 @@
|
||||
<TextBlock Grid.Column="6" Style="{StaticResource Text.Cell}" Text="{Binding Tier}" Margin="10,0,0,0" />
|
||||
<TextBlock x:Name="Flags" Grid.Column="7" Style="{StaticResource Text.Cell}" Text="{Binding Flags}" Margin="10,0,0,0" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
<StackPanel x:Name="Actions" Grid.Column="8" Orientation="Horizontal" HorizontalAlignment="Right" Visibility="Hidden">
|
||||
<Button Style="{StaticResource Button.Row}" Content="{Binding ExcludeText}" ToolTip="{Binding ExcludeToolTip}"
|
||||
<Button Style="{StaticResource Button.Row}" Content="{Binding ExcludeText}" ToolTip="{Binding ExcludeToolTip}" ToolTipService.ShowOnDisabled="True"
|
||||
Command="{Binding DataContext.ToggleExcludeCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter="{Binding}" />
|
||||
<Button Style="{StaticResource Button.Row}" Width="26" MinWidth="26" Padding="0" Margin="0" ui:ButtonIcon.Glyph="{StaticResource Icon.Hero}"
|
||||
ToolTip="{l:Loc Tooltips.Editor.Frames.Hero}" AutomationProperties.Name="{l:Loc Editor.Frames.SetHero}"
|
||||
ToolTip="{Binding DataContext.HeroToolTip, RelativeSource={RelativeSource AncestorType=ListBox}}" ToolTipService.ShowOnDisabled="True"
|
||||
AutomationProperties.Name="{l:Loc Editor.Frames.SetHero}"
|
||||
Command="{Binding DataContext.SetHeroCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter="{Binding}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -186,7 +187,7 @@
|
||||
<Border Style="{StaticResource Border.Panel}" Padding="10" Margin="0,10,0,0">
|
||||
<v:CurveEditor Points="{Binding KeyPoints}" Mode="Keyframes" SelectedIndex="{Binding SelectedKey, Mode=TwoWay}" PlayheadPosition="{Binding Playhead}"
|
||||
XLabelFormatter="{Binding XFormatter}" YLabelFormatter="{Binding YFormatter}" e:CurveCommit.Command="{Binding CommitCurveCommand}"
|
||||
IsEnabled="{Binding Editor.IsEditable}" ToolTip="{l:Loc Tooltips.Editor.Camera.Curve}" ToolTipService.ShowOnDisabled="True"
|
||||
IsEnabled="{Binding Editor.IsEditable}" ToolTip="{Binding CurveToolTip}" ToolTipService.ShowOnDisabled="True"
|
||||
AutomationProperties.Name="{l:Loc Editor.Camera.Curve}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
@@ -209,7 +210,7 @@
|
||||
<TextBlock DockPanel.Dock="Top" Text="{l:Loc Editor.Time.Curve}" Style="{StaticResource Text.Header}" Margin="0,0,0,6" />
|
||||
<v:CurveEditor Points="{Binding RemapPoints}" Mode="TimeRemap" Evaluator="{Binding Evaluator}" ShowDiagonal="True" PlayheadPosition="{Binding Playhead}"
|
||||
XLabelFormatter="{Binding XFormatter}" YLabelFormatter="{Binding YFormatter}" e:CurveCommit.Command="{Binding CommitCurveCommand}"
|
||||
IsEnabled="{Binding Editor.IsEditable}" ToolTip="{l:Loc Tooltips.Editor.Time.Curve}" ToolTipService.ShowOnDisabled="True"
|
||||
IsEnabled="{Binding Editor.IsEditable}" ToolTip="{Binding CurveToolTip}" ToolTipService.ShowOnDisabled="True"
|
||||
AutomationProperties.Name="{l:Loc Editor.Time.Curve}" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
|
||||
@@ -228,7 +228,7 @@
|
||||
<TextBlock Text="{l:Loc Editor.Frames.HeroLabel}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.RowValue}" Text="{Binding HeroText}" Margin="8,0" />
|
||||
<Button Grid.Column="2" Style="{StaticResource Button.Icon}" ui:ButtonIcon.Glyph="{StaticResource Icon.Hero}" Command="{Binding SetHeroCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Editor.Frames.Hero}" AutomationProperties.Name="{l:Loc Editor.Frames.SetHero}" />
|
||||
ToolTip="{Binding HeroToolTip}" ToolTipService.ShowOnDisabled="True" AutomationProperties.Name="{l:Loc Editor.Frames.SetHero}" />
|
||||
</Grid>
|
||||
<Grid MinHeight="32" Margin="0,0,0,14">
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -239,7 +239,8 @@
|
||||
<TextBlock Text="{l:Loc Editor.Frames.ExcludedLabel}" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Text="{Binding ExcludedText}" Style="{StaticResource Text.Secondary}" TextTrimming="CharacterEllipsis" />
|
||||
</StackPanel>
|
||||
<Button Grid.Column="1" Content="{Binding CurrentExcludeText}" Command="{Binding ToggleExcludeCommand}" ToolTip="{Binding CurrentExcludeToolTip}" Margin="8,0,0,0" />
|
||||
<Button Grid.Column="1" Content="{Binding CurrentExcludeText}" Command="{Binding ToggleExcludeCommand}" ToolTip="{Binding CurrentExcludeToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True" Margin="8,0,0,0" />
|
||||
</Grid>
|
||||
<TextBlock Text="{l:Loc Editor.Frames.Warnings}" Style="{StaticResource Text.Section}" Margin="0,0,0,8" />
|
||||
<TextBlock Text="{l:Loc Editor.Frames.NoWarnings}" Style="{StaticResource Text.Secondary}"
|
||||
|
||||
@@ -89,7 +89,10 @@ public sealed class FrameRow(FramesTab owner, Frame frame, int index) : Observab
|
||||
|
||||
public string ExcludeText => 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");
|
||||
|
||||
/// <summary>A job of the sequence started or ended: the action tooltips say why they wait.</summary>
|
||||
public void RefreshBusy() => OnPropertyChanged(nameof(ExcludeToolTip));
|
||||
|
||||
/// <summary>The project's exclusions or hero changed.</summary>
|
||||
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");
|
||||
|
||||
/// <summary>What Set hero does, or why it waits.</summary>
|
||||
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;
|
||||
|
||||
@@ -175,20 +175,32 @@ public sealed class PreviewRenderer(SequenceContent content, ISequenceSource sou
|
||||
}.ToJson();
|
||||
|
||||
/// <summary>Cache key of the measuring preparation: the settings that change what is measured, resolved as the preparation resolves them.</summary>
|
||||
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) => (
|
||||
/// <summary>
|
||||
/// What the measuring preparation measures for <paramref name="project"/>: luminance when the deep analysis has it
|
||||
/// (free) or a module needs it, colour means for white-balance smoothing, the stabilisation path.
|
||||
/// </summary>
|
||||
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));
|
||||
|
||||
/// <summary>The deep analysis describes the current frames (its luminance is reused).</summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// Luminance (deflicker forced on so it is always there), colour means and the stabilisation path for the project's
|
||||
/// exclusions, prepared once per <see cref="MeasureKey"/>.
|
||||
/// 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 <see cref="MeasureKey"/>.
|
||||
/// </summary>
|
||||
private async Task<RenderCorrections> 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;
|
||||
}
|
||||
|
||||
/// <summary>The measured series a re-solve reuses.</summary>
|
||||
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)
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/// <summary>The shot data pill sits beside the tools at the bottom, and moves to the top when both do not fit in one row.</summary>
|
||||
/// <summary>The shot data pill sits beside the tools at the bottom, and just above them when both do not fit in one row.</summary>
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user