Repository navigation
fix(studio): a press on an animated layer in a sealed preview starts at once - #9121
Conversation
…at once A drawn motion path asks the frame where it starts every frame. That ask counted as a change to the frame, so the read a press starts from was thrown away every frame and each press on an animated layer waited for the frame. On a busy machine the first move showed a step behind the pointer. motion-path-home, assets-unloaded and stage-measure only read the frame; they join the list of read-only requests.
terencecho
left a comment
There was a problem hiding this comment.
All three requests read frame state. A delayed gesture-start reply stayed usable across those reads and became stale after a draft write. The named regression passed and failed when motion-path-home was removed from the read list.
105 Studio tests, 232 Core tests, and the Chromium motion-path test passed. The sealed rotate case passed locally with no press jump. Merge-queue timing remains unverified.
— tai (automated review)
Edit accuracy: accurate 275 (base branch 273), smooth 51 of thoseThe gate passes. Newly passing (2)
Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)
Quarantined, measured but not gated (0) |
|
Correction to this PR's description, from the merge queue's own runs: it lowers the sealed first-frame misses, it does not remove their cause. I counted the sealed edit accuracy gate's unstable cases in 8 queue runs before this and #9126 (both merged within a minute, so the runs do not tell them apart) and 8 after, 751 cases each:
The same 16 runs unsealed had no lagging frame, no error and no lost crop. So a sealed-only cause of the lagging frame is still open, and the lost crop is untouched by either PR. The runs are on the same day and the runners vary, so the size of the drop is approximate. "Gate: ... removes the cause of the sealed-only first-frame misses" should read "removes one cause". |
What
A press on an animated layer in a sealed preview starts its gesture at once again, as it does unsealed. Studio keeps a read of the selected layer's gesture start ready, so a press need not ask the frame first. Asking where a drawn motion path starts counted as a change to the frame, and a drawn motion path asks every frame, so that ready read was thrown away every frame. Each press on an animated layer then waited for the frame to answer. On a busy machine the wait outlasted the first move, so the first frame of a rotate or a resize showed the box one step behind the pointer.
rotate-keys-px-r30-root-z50-midin 2 of its 3 runs in the merge queue and dropped pull requests that changed sealed preview paths.Why
The sealed preview may only become the default once it behaves as the unsealed one does. In one merge queue run, 10 of 516 sealed drags showed their first tracked frame exactly one step behind (4.64 px for a rotate step, 3 px for a resize step) and none of 492 unsealed drags did. 9 of the 10 were in the first, full run of a shard.
Related work
Follow-up to #9068 and #9089 (the sealed edit accuracy run and its gate) and #9107.
How
player/lib/frameFacts.ts:motion-path-homejoins the requests that only read the frame. The frame's handler (core/src/runtime/editing/motionPathHome.ts) only measures the layer. Two more reads that were missing join it:assets-unloaded(core/src/lottieReadiness.ts, which only checks media and Lottie load state) andstage-measure(stageMeasure.ts, which Studio itself does not send today).resolve-canvas-key-actionputs back deleted nodes, so it is a write.color-grading-previewsrenders through the grading runtime, which I have not shown leaves the frame unchanged, so it stays a write.Test plan
fails without the fix: "starts a press at once while a drawn motion path keeps asking the frame where it starts" (
packages/studio/src/components/editor/gestureStartReadAhead.sealed.test.ts) asks the frame where the selected layer's motion path starts, then presses. Without the fix the press waits on the frame and no gesture starts.frameFacts.test.tsnow also sends the three kinds and hears no change.The 17 Studio test files that use the frame facts, the read made before a press, the motion path data or the asset check: 197 of 197, 3 runs in a row.
tsc --noEmitinpackages/studio: exit 0.Edit accuracy bench, sealed build, the 25 cases of the merge queue's shard 3 with a log of each press: before, 17, 19, 18 and 18 of 26, 26, 26 and 22 presses started from the read made before them, and every miss was that read thrown away by a frame change. In a separate logged run of the two rotate cases, 618 of the 809 requests counted as frame changes were motion path asks. After (a build with
motion-path-homeandstage-measureadded, beforeassets-unloadedwas), 24 and 25 of 26, and each miss followed an edit's save in a sequence case. The first-frame miss itself shows only on the merge queue's runners, so it is not measured here.Unit tests added/updated
Manual testing performed
Documentation updated (if applicable)
Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug
No visible change
The sealed preview is not on by default. In a sealed preview, the first frame of a drag on an animated layer now follows the pointer as it does unsealed.