fix(validation): anchor the timecode check on a delivered plate
Deploy / deploy (push) Successful in 6m12s

UNG_110_030_010 v002 failed with a 461614-frame offset on a render whose
timecode was correct. Two causes, both in how the plate reference was
recorded.

The comp held three same-length elements and the timing plate was picked
by duration alone, so a PRERENDER won on layer order. Using a pre-render
as the timecode reference is circular anyway: it was rendered from this
comp, so it can only ever agree with it — including when both are wrong.
Only footage under the Footage Root is now eligible; among those, longest
still wins.

The offset itself came from the plate's frameStart. AE writes renders as
"..._PRERENDER_01001.exr" while delivered plates use "....01001.exr", and
the parser only handled the dot form, so the number fell back to the
comp's frame range — 462615 against a render numbered from 1001. Both
separators now parse, and an unparseable name omits the field rather than
filling it with a number from the wrong coordinate system.

Verified against the real manifest: the BG01 plate is now chosen over
both pre-renders, and all three filenames parse to 1001.

Panel 2.2.1, worker 1.2.1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
twotalesanimation
2026-08-14 08:56:18 +02:00
parent 1163bd6455
commit 991abe072c
5 changed files with 65 additions and 17 deletions
@@ -15,7 +15,7 @@
every change that gets published. publish.ps1 appends the git SHA via
SourceRevisionId, giving "1.1.0+feb1c7b".
-->
<Version>1.2.0</Version>
<Version>1.2.1</Version>
</PropertyGroup>
<ItemGroup>
@@ -409,7 +409,12 @@ public sealed class ValidationStage
var header = File.Exists(local) ? ExrHeader.TryRead(local) : null;
if (header?.Timecode is not null)
{
var frame = SequencePattern.FrameFromName(Path.GetFileName(local)) ?? timing.FrameStart ?? m.FrameStart;
// The plate's own file numbering, never the comp's frame range:
// the render's first frame is in output numbering, so anchoring
// on a comp frame skews the comparison by the gap between them.
var frame = SequencePattern.FrameFromName(Path.GetFileName(local))
?? timing.FrameStart
?? renderFirstFrame;
return new TimecodeReference("manifest", local, header.Timecode.Value, frame, handleFrames);
}
_log.LogWarning("Timing plate from manifest is unreadable: {Path}", local);
@@ -589,7 +594,12 @@ public sealed class SequencePattern
public string Extension { get; private init; } = ".exr";
public int Padding { get; private init; }
private static readonly Regex FrameInName = new(@"\.(\d{2,9})\.[A-Za-z0-9]+$", RegexOptions.Compiled);
// Delivered plates separate the frame number with a dot
// ("..._BG01_TT_v001.01001.exr"); AE-written renders use an underscore
// ("..._PRERENDER_01001.exr"). Both appear as layers in a shot comp, so
// both have to parse — a plate whose number cannot be read gets anchored on
// a fallback, and a wrong anchor silently skews the timecode check.
private static readonly Regex FrameInName = new(@"[._](\d{2,9})\.[A-Za-z0-9]+$", RegexOptions.Compiled);
public static SequencePattern FromOutputPattern(string outputPattern)
{