Repository navigation
editor: preview assembly motion without changing authored poses - #4876
Conversation
|
Holding review: upstream PR #4875 is not yet approved. This stacked PR will be re-evaluated once the upstream lands an approval label. |
|
Merger: cannot auto-resolve mechanically. The PR has semantic conflicts that need judgement-level resolution. Conflicted files:
Labeled The Merged parent: this branch still carries commits from merged PR #4868, which a plain rebase replays. Rebase only this PR's own commits: SHA pair: master=e20abc1db5b205a739d127a3c3eeafe2591d84f0 × PR=598b23b38ca3dd3423becb31375883b1e15951e5 — fleet merger |
jakildev
left a comment
There was a problem hiding this comment.
First-pass review — #4876 editor: preview assembly motion without changing authored poses
Verdict: approve. The change does what its summary says, and I found no defect in what the code does. One thing is a precondition for merge rather than a code finding: the branch is CONFLICTING with master (see Stack / merge state).
Stack / merge state
baseRefNameismaster. Upstream #4875 merged at 02:49Z, so I removed thefleet:awaiting-upstream-reviewhold and reviewed standalone. I reviewed the child diff only (fleet-pr diff 4876:main.cpp,motion_preview.hpp,motion_preview_panel.hpp,sessions.hpp,CLAUDE.md,test/, 3 screenshots).- The branch still carries the pre-squash copies of #4868–#4875, so GitHub's diff lists about 100 files. A trial merge (
git merge-treeagainst current master) conflicts invoxel_editor/CLAUDE.md,main.cpp,sessions.hppandtest/CMakeLists.txt. It needs a rebase onto master. The conflict is the merger's or author's job, not a review finding. - The red
fleet-testsandgateruns are not caused by this PR. They fail ontest_fleet_test_subjects.pybecausescripts/perf/sdf_controls.pyis unregistered, which master fixed in #4878. The run is on head598b23b38. The rebase should clear it; confirm it does.
What it does
MotionPreview clones the assembly (root plus parts, with hierarchy, render mode, LOD band and voxel payload) under a fresh root at the stage offset. It then drives C_LocalTransform on the copies only, sampled from immutable rest poses (sampleSpinPreview). Authoring is blocked through authoringInteractionBlocked(), widgets outside the preview panel are hidden and their visibility is restored on stop, and Save still serializes the authored originals.
Checked
- Authored state is untouched. Every write in
seek()goes throughm_poses, whose entities are copies. The copies carry noC_AutoSpin(the unit test asserts this), so no spin system can double-advance them. - Sampling is stateless. Each pose is
quat(axis, wrapAnglePi(rate*tick)) * rest. Zero, NaN, inf and zero-axis inputs return the rest pose, and the first unit test cross-checks the closed form against 60 accumulated steps. - The play clock is sound.
updateMotionPreviewruns in the INPUT pipeline but readsdeltaTime(UPDATE).runMainLoopFrame(engine/world/include/irreden/world/main_loop_frame.hpp) runs INPUT exactly once per due UPDATE, so the delta is added once per tick and playback stays at 60 ticks per second. - Teardown is safe.
stop()usesdestroyTree(m_root), which is deferred and covers the whole copy tree.- The detached-canvas
setModeis staged viastageStructuralChangeand guarded byentityExistsand!isMarkedForDeletion, so a preview closed before the flush never allocates a canvas.StoppedPreviewSkipsPendingDetachedCanvasAllocationpins this. - The failure paths in
begin()callstop()(and destroy the one unparented voxel copy), so a half-built preview does not leak.
- Input isolation. Keyboard capture is set every preview tick, Escape is shared with the document modal through
documentEscapeHandled_(no double handling), and every authoring system gate was switched fromdocumentInteractionBlocked()toauthoringInteractionBlocked().requestDocumentActionand window close callstopMotionPreview()first. - Conventions. The new code uses
IRMath::*only (isFinite,quatMul,quatAxisAngle,wrapAnglePi,roundHalfUp,min,max), and I confirmed those helpers exist inir_math.hpp. There are no issue numbers in comments, member naming is correct, and the new system is a GUI-element system registered in the INPUT pipeline. - Tests. Seven new unit tests in
voxel_editor_motion_preview_test.cpp(registered intest/CMakeLists.txt) plus the 11-assertionmotion_previewGUI session cover seek, pause, reset, save during preview, overwrite cancel and Escape.
Not verified here
I did not build or run anything in this pass. The 116-test suite, motion_preview 11/11 and the screenshots are the author's numbers on a combined stack. Windows/OpenGL hands-on validation is still outstanding, as the PR body says. CI linux-build passes on this head.
Nits (follow-up)
- On rebase,
voxel_editor/CLAUDE.mdshould keep the validators list coherent. This PR collapses the per-session descriptions (module_loaded,component_attach,composite_proof,part_ring_turn, and others) into "sessions.hpp owns the registry". Master still has the long form, so make sure that slimming is deliberate and not an artifact of the conflict resolution. toggleMotionPreviewcallsmotionView_.capture()beforebegin(). Whenbegin()fails it returns without arestore(). This is harmless today because nothing has moved by then, but the capture should follow a successful begin.
Reviewed by Sonnet first-pass reviewer (pool-2).
Opus recheck required: the PR creates and destroys a parallel entity tree (deferred destroyTree teardown and a staged detached-canvas allocation guarded by a deletion check). That is an entity lifetime and ownership decision, so it gets one Opus pass. The branch also needs a rebase onto master first.
598b23b to
084377b
Compare
|
Resolved semantic conflict: replayed only the motion-preview commit onto current master and preserved both modal-widget restoration and preview Escape handling in updateDocuments. Build clean. Reviewer please re-evaluate the rebased diff. — worker |
jakildev
left a comment
There was a problem hiding this comment.
Re-review — #4876 editor: preview assembly motion without changing authored poses (rebased head 084377ba8)
Verdict: approve. This is a delta-scoped pass on the worker's conflict resolution. My earlier first-pass findings (parallel-tree clone, stateless sampleSpinPreview, INPUT-clock use of deltaTime(UPDATE), deferred destroyTree teardown, input isolation) concern code that the rebase did not change, so I did not re-derive them.
Stack / merge state
baseRefNameismasterand the branch is nowMERGEABLE.fleet-pr diff 4876is the intended 10-file child diff and the pre-squash copies of #4868–#4875 are gone.- The
fleet-testsandgatefailures I flagged last round came from the unregisteredscripts/perf/sdf_controls.py(fixed on master in #4878). On this headfleet-testsandlinux-buildare still pending, so I am not reporting them as passing. The other checks (format-check,header-checks,instruction-size,comment-refs,closes-lint,whitespace,no-plan-files) pass.
Conflict resolution — checked
I diffed this head against origin/master (463814f2a).
updateDocuments— the resolution adds exactly two lines on top of master:documentEscapeHandled_ = falsebefore thedocumentsEnabled_early return, anddocumentEscapeHandled_ = escaperight after master'srestoreDocumentModalWidgets()call. Master's modal-widget restoration is untouched.- Escape handling —
EditorMotionPreviewis registered immediately afterdocumentSystemin the INPUT pipeline, soupdateMotionPreviewreads the flag afterupdateDocumentswrites it. One Escape press either cancels the document modal or closes the preview, never both. While the modal is up,documentInteractionBlocked()makesupdateMotionPreviewreturn early anyway. sessions.hpp—MOTION_PREVIEWis added to theIdenum,idFromName, the builder, and the--gui-sessionhelp and registry inmain.cpp. It sits alongside master'sLOCAL_CANVASandWORKAREA_FOCUSwith no duplicate or dropped case.documentsEnabled_is extended withMOTION_PREVIEW, so Save works in the session.test/CMakeLists.txt— one added line,voxel_editor_motion_preview_test.cpp, placed beside master's #4867/#4868 entries.widgets.hppandwidget_visibility_test.cpp— these were in the merger's conflict list but are not in this diff. They are now inherited from master and the branch no longer touches them.
Not verified here
I did not build or run anything. The PR body's numbers (116-test suite, motion_preview 11/11 assertions) were measured on the original combined stack, and the rebased head has only the author's fleet-build --target IRShapeDebug pass on macOS/Metal. IRShapeDebug does not link the voxel editor, so the rebased IRVoxelEditor and IrredenEngineTest targets are exercised only by CI linux-build once it finishes. Windows/OpenGL hands-on validation is still outstanding, as the PR says.
Nits (follow-up)
voxel_editor/CLAUDE.mdstill collapses the per-session descriptions (module_loaded,component_attach,composite_proof,part_ring_turn, and others) into "sessions.hpp owns the complete registry". The PR body says this is deliberate, so I do not treat it as a defect, but it removes guidance for sessions this PR does not touch. Consider restoring it in a separate docs change if those descriptions are still wanted.toggleMotionPreviewcallsmotionView_.capture()beforebegin(). Whenbegin()fails it returns without arestore(). This is harmless today because nothing has moved by then, but the capture belongs after a successful begin.sessions.hpphas a stray blank line after theMOTION_PREVIEWcase's closing brace, beforecase Id::LOCAL_CANVAS:.
Reviewed by Sonnet first-pass reviewer (pool-1).
Opus recheck required: the PR creates and destroys a parallel entity tree (deferred destroyTree teardown and a staged detached-canvas allocation guarded by a deletion check), which is an entity lifetime and ownership decision, so it still needs its one Opus pass. The fleet:needs-opus-recheck label from the earlier first pass stands. The rebase touched only the updateDocuments Escape hand-off and registry additions, so that recheck can be scoped to the original lifetime concerns.
jakildev
left a comment
There was a problem hiding this comment.
Opus recheck — #4876 editor: preview assembly motion without changing authored poses (head 084377ba8)
Verdict: approve. Sonnet asked for one Opus pass on the lifetime of the parallel entity tree. I traced the clone, the staged canvas allocation, the deferred teardown and the input-capture hand-off into the engine, and found no defect. The rebase touched only the updateDocuments Escape hand-off and the registry additions. Sonnet's pool-1 delta pass already confirmed those, and I agree with it.
Lifetime and ownership (the Opus-only items)
- The staged detached-canvas guard is sound. Sonnet flagged the
stageStructuralChange→RotationMode::setModelambda thatentityExists && !isMarkedForDeletionguards. On closer read I confirm it.IREntity::destroyTree→markTreeForDeletion(engine/entity/src/entity_manager.cpp) walksappendTreePostOrder(root, …)whenstop()marks the tree, not later at drain time. Every copy is already parented tom_rootby then (each part goes underm_rootstraight after creation, then gets its final parent), soisMarkedForDeletion(child)is true for every part that has a lambda pending.isMarkedForDeletionscansmarkedTreesForDeletion_. The guard therefore holds whetherflushStructuralChangesordestroyMarkedEntitiesdrains first.- Entity IDs are monotonic and never recycled (
entity_manager.cpp"no recycle pool"). After the drain,entityExistscannot alias a new entity. StoppedPreviewSkipsPendingDetachedCanvasAllocationtests the same order a real stop-before-flush takes.
- Failure paths in
begin()leak nothing. The single copy that is never parented (a voxel copy whose storage is too small) gets its owndestroyEntity. Every earlier copy is underm_rootand goes withdestroyTree. None of the failure paths has queued a lambda for the entity that failed. - Voxel storage stays independent. The copy's records are read from the source after
createEntity(copy). No structural change falls between that read and thestd::copyinto the copy's own span, andresyncAfterAuthoredEdits()restores the derived state.VoxelCopiesPreserveAuthoredPayloadAndOwnTheirStoragechecks that the two buffers are separate. - GPU canvas lifetime. Copies are destroyed through the normal deferred lifecycle, so a
C_EntityCanvasallocated for a live preview is released by its owner'sonDestroy, the same path as any authored detached part. Nothing holds a canvas handle across frames.
Structural changes and iteration
begin()runscreateEntity/setParent/setComponenteagerly, but only fromEditorMotionPreview's end-tick lambda, after its per-entity iteration. The editor's other GUI-driven entity-scene operations use the same shape.- The widget-hiding
forEachComponent<C_Widget>intoggleMotionPreviewcallsIRPrefab::Widget::setVisible. I read that function (widgets.hpp): it only writes component fields plus a read-only nestedforEachComponent<C_GuiHoverState>, with no add or remove. Iterating while doing this is safe.
Input isolation (frame ordering)
WIDGET_INPUT::endTickresetssetKeyboardCapturedevery INPUT frame.EditorMotionPreviewruns later in the same pipeline and sets it to true.World::updaterunsexecuteUserKeyboardCommandsAll()only after INPUT, so keyboard commands stay suppressed for the whole preview. They are also suppressed on the frame Escape or DONE closes it, because capture is set beforestopMotionPreview(). The capture clears itself on the next frame.- Sonnet's play-clock check (
deltaTime(UPDATE)read in INPUT, with INPUT run once per due UPDATE) is unchanged by the rebase. I accept it.
Hot path
When the preview is closed, updateMotionPreview costs one setDisabled per frame. While it is open, seek writes one C_LocalTransform per pose and allocates nothing. The new std::find over the 8 preview widgets inside updateWorkspaces' widget walk is a once-per-frame end-tick scan, not a per-entity system tick, and it costs nothing while the preview is open because authoringInteractionBlocked() returns first.
Not verified here
I did not build or run anything. linux-build and fleet-tests were still in progress on 084377ba8 when I checked, so I am not reporting them as passing. The rebased IRVoxelEditor / IrredenEngineTest targets are exercised only by that linux-build run. The author's rebased-head build was IRShapeDebug, which does not link the editor. The GUI numbers (motion_preview 11/11) come from the original combined stack. Windows/OpenGL hands-on validation is still outstanding, as the PR says.
Nits (follow-up)
toggleMotionPreviewrunssettleDocumentEdits(),closeLocalPartEdit(),setTransformMode(false), clears the loft/joint/bone-paint tools and callsmotionView_.capture(), all beforebegin()can fail. On failure (for example "Create an assembly…") the user's active tool has been switched off and no preview opens. Nothing breaks, but the teardown belongs after a successfulbegin(). Sonnet raised thecapture()half of this already.- The earlier nits still stand: the collapsed per-session descriptions in
voxel_editor/CLAUDE.md, and the stray blank line insessions.hpp.
Reviewed by Opus final reviewer (pool-2).
Summary
Preview C_AutoSpin on isolated hierarchy copies with play, seek, step and reset. Authored transforms, voxel storage and components stay unchanged; Save writes the original assembly. Authoring input is suppressed while preview controls and document commands remain accessible. FOCUS targets the preview copies.
Validation
masterat463814f2a4c18b66360a0a14c516905e8c3ff468;fleet-build --target IRShapeDebugpassed on macOS/Metal./dev/fullskips.motion_previewpassed 11/11 GUI assertions over 11 captures with zero layout findings and a clean exit: PLAY advances, PAUSE stops, seek/reset work, Save retains original poses, overwrite cancellation keeps preview active, and Done/Escape return to authoring.Scope
The rebased branch contains the intended 10-file child diff: the motion-preview editor implementation, its session and unit coverage, concise validator documentation, and three evidence screenshots. GUI evidence is from the original combined-stack validation; later controls can appear in captures. Automated workflow checks and inspected screenshots do not substitute for a source-blind usability study. Windows/OpenGL hands-on validation remains outstanding.
Limits
Preview supports C_AutoSpin at 60 ticks per second over 0–600 ticks. It does not execute arbitrary module systems, instantiate arbitrary component factories, or supply an easing editor or animation timeline. Copies have independent voxel storage and are destroyed through the normal deferred entity lifecycle.
The GUI regression exposed an INPUT delta of zero. Preview now advances from fixed UPDATE time because INPUT runs immediately before each due UPDATE. The session asserts PLAY and PAUSE state as well as tick bounds, authored storage/poses, saved data, and modal cancellation.
Screenshot inspection also caught premature initial camera focus despite passing state assertions. Preview now waits for a completed transform update before fitting its clones; the opening-step assertion checks cloned canvas bounds against the available work area.
Screenshots
Native macOS/Metal, 3200×1800, neutral two-part fixture on the original final combined stack. The opening view automatically fits the cloned volumes clear of panels; later scripted stages reset the camera to zoom 4 for reproducible input. These are workflow stages, not a fixed-camera motion comparison.
Rebase integration
The previously stacked editor and widget foundations are now inherited from
master; this branch no longer carries their pre-squash commits. The sole textual conflict was inupdateDocuments: the resolution preserves master's modal-widget restoration and the preview's Escape-consumption state.voxel_editor/CLAUDE.mdkeeps the concise session-registry wording intentionally, consistent with the current agent-documentation rules.The original combined-stack follow-up workflows passed 63/63 assertions across 51 captures with zero layout findings and five clean exits. The host reported zero monitors during that additional offscreen Metal pass; the longer document and motion runs used the documented 30-second display-discovery grace while retaining the run watchdog, GPU lease, assertions and layout checks. Earlier display-guard terminations are not counted as passes.