Skip to content

editor: preview assembly motion without changing authored poses - #4876

Merged
jakildev merged 1 commit into
masterfrom
codex/editor-motion-preview
Nov 5, 2026
Merged

jakildev merged 1 commit into
masterfrom
codex/editor-motion-preview

Conversation

@jakildev

@jakildev jakildev commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

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

  • Conflict-resolution pass: rebased the single motion-preview commit onto master at 463814f2a4c18b66360a0a14c516905e8c3ff468; fleet-build --target IRShapeDebug passed on macOS/Metal.
  • Original feature validation: built IRVoxelEditor and IrredenEngineTest on macOS/Metal against the then-combined stack.
  • Focused combined-stack suite: 116 tests, 114 passed, two platform-specific /dev/full skips.
  • Seven spin/preview unit tests passed, including independent voxel storage and deferred detached-canvas teardown. The final shared layout/keyboard/motion run passed 52/52. motion_preview passed 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.

Open and frame Playing Authored assembly restored

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 in updateDocuments: the resolution preserves master's modal-widget restoration and the preview's Escape-consumption state. voxel_editor/CLAUDE.md keeps 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.

@jakildev jakildev added the fleet:author-codex Implementation last authored by Codex; route review to Claude label Nov 2, 2026
@jakildev jakildev added the fleet:authored-on-macos PR was authored and smoke-tested on macOS Metal backend label Nov 2, 2026
@jakildev
jakildev added this pull request to stack #4870 November 2, 2026 07:41
@jakildev jakildev added the fleet:awaiting-upstream-review Stacked PR; reviewer is holding verdict until upstream PR is approved label Nov 2, 2026
@jakildev

jakildev commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Holding review: upstream PR #4875 is not yet approved. This stacked PR will be re-evaluated once the upstream lands an approval label.

@jakildev

jakildev commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Merger: cannot auto-resolve mechanically. The PR has semantic conflicts that need judgement-level resolution.

Conflicted files:

  • creations/editors/voxel_editor/CLAUDE.md — master: ef48a2e0d editor: frame selected volumes clear of visible authoring panels (#4873); PR: 176efec2e editor: preview assembly motion without changing authored poses
  • creations/editors/voxel_editor/main.cpp — master: ef48a2e0d editor: frame selected volumes clear of visible authoring panels (#4873); PR: 176efec2e editor: preview assembly motion without changing authored poses
  • creations/editors/voxel_editor/sessions.hpp — master: ef48a2e0d editor: frame selected volumes clear of visible authoring panels (#4873); PR: 176efec2e editor: preview assembly motion without changing authored poses
  • engine/prefabs/irreden/render/widgets.hpp — master: 4e8e10656 editor: establish sculpt, hierarchy and save workflows (#4868); PR: a93a6d692 widgets: persist visibility and disable hidden hitboxes
  • test/CMakeLists.txt — master: 5fc547d38 render: clear the sun depth-slab planes with device fills and census the splat footprint (#4867); PR: 176efec2e editor: preview assembly motion without changing authored poses
  • … and 1 more (test/render/widget_visibility_test.cpp).

Labeled fleet:semantic-conflict — a worker will attempt resolution on its next iteration (rebase, manually resolve, build, push). If the worker also cannot resolve, it will escalate to human:needs-fix.

The fleet:approved label has been removed if it was set — the PR no longer represents a reviewed state.

Merged parent: this branch still carries commits from merged PR #4868, which a plain rebase replays. fleet-pr fork-of 4876 reports:
merged-parent: 4868 a93a6d6

Rebase only this PR's own commits:
git fetch origin
git rebase --onto origin/codex/editor-text-input-viewport a93a6d6 codex/editor-motion-preview

SHA pair: master=e20abc1db5b205a739d127a3c3eeafe2591d84f0 × PR=598b23b38ca3dd3423becb31375883b1e15951e5

— fleet merger

@jakildev jakildev added fleet:semantic-conflict Merger hit non-mechanical conflict; opus-worker resolves or escalates fleet:merger-cooldown Merger touched this PR this iteration; skip next iteration labels Nov 5, 2026

@jakildev jakildev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • baseRefName is master. Upstream #4875 merged at 02:49Z, so I removed the fleet:awaiting-upstream-review hold 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-tree against current master) conflicts in voxel_editor/CLAUDE.md, main.cpp, sessions.hpp and test/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-tests and gate runs are not caused by this PR. They fail on test_fleet_test_subjects.py because scripts/perf/sdf_controls.py is unregistered, which master fixed in #4878. The run is on head 598b23b38. 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 through m_poses, whose entities are copies. The copies carry no C_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. updateMotionPreview runs in the INPUT pipeline but reads deltaTime(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() uses destroyTree(m_root), which is deferred and covers the whole copy tree.
    • The detached-canvas setMode is staged via stageStructuralChange and guarded by entityExists and !isMarkedForDeletion, so a preview closed before the flush never allocates a canvas. StoppedPreviewSkipsPendingDetachedCanvasAllocation pins this.
    • The failure paths in begin() call stop() (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 from documentInteractionBlocked() to authoringInteractionBlocked(). requestDocumentAction and window close call stopMotionPreview() first.
  • Conventions. The new code uses IRMath::* only (isFinite, quatMul, quatAxisAngle, wrapAnglePi, roundHalfUp, min, max), and I confirmed those helpers exist in ir_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 in test/CMakeLists.txt) plus the 11-assertion motion_preview GUI 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.md should 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.
  • toggleMotionPreview calls motionView_.capture() before begin(). When begin() fails it returns without a restore(). 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.

@jakildev jakildev added fleet:needs-opus-recheck Sonnet flagged this PR for Opus recheck before merge and removed fleet:awaiting-upstream-review Stacked PR; reviewer is holding verdict until upstream PR is approved fleet:reviewing-mac-pool-2 labels Nov 5, 2026
@jakildev
jakildev force-pushed the codex/editor-motion-preview branch from 598b23b to 084377b Compare November 5, 2026 02:59
@jakildev jakildev added fleet:changes-made Agent addressed human feedback — ready for human re-review and removed fleet:semantic-conflict Merger hit non-mechanical conflict; opus-worker resolves or escalates labels Nov 5, 2026
@jakildev

jakildev commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

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 jakildev removed fleet:merger-cooldown Merger touched this PR this iteration; skip next iteration fleet:resolving-mac-pool-1 labels Nov 5, 2026

@jakildev jakildev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • baseRefName is master and the branch is now MERGEABLE. fleet-pr diff 4876 is the intended 10-file child diff and the pre-squash copies of #4868–#4875 are gone.
  • The fleet-tests and gate failures I flagged last round came from the unregistered scripts/perf/sdf_controls.py (fixed on master in #4878). On this head fleet-tests and linux-build are 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_ = false before the documentsEnabled_ early return, and documentEscapeHandled_ = escape right after master's restoreDocumentModalWidgets() call. Master's modal-widget restoration is untouched.
  • Escape handling — EditorMotionPreview is registered immediately after documentSystem in the INPUT pipeline, so updateMotionPreview reads the flag after updateDocuments writes it. One Escape press either cancels the document modal or closes the preview, never both. While the modal is up, documentInteractionBlocked() makes updateMotionPreview return early anyway.
  • sessions.hpp — MOTION_PREVIEW is added to the Id enum, idFromName, the builder, and the --gui-session help and registry in main.cpp. It sits alongside master's LOCAL_CANVAS and WORKAREA_FOCUS with no duplicate or dropped case. documentsEnabled_ is extended with MOTION_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.hpp and widget_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.md still 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.
  • toggleMotionPreview calls motionView_.capture() before begin(). When begin() fails it returns without a restore(). This is harmless today because nothing has moved by then, but the capture belongs after a successful begin.
  • sessions.hpp has a stray blank line after the MOTION_PREVIEW case's closing brace, before case 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 jakildev removed the fleet:changes-made Agent addressed human feedback — ready for human re-review label Nov 5, 2026

@jakildev jakildev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::setMode lambda that entityExists && !isMarkedForDeletion guards. On closer read I confirm it.
    • IREntity::destroyTree → markTreeForDeletion (engine/entity/src/entity_manager.cpp) walks appendTreePostOrder(root, …) when stop() marks the tree, not later at drain time. Every copy is already parented to m_root by then (each part goes under m_root straight after creation, then gets its final parent), so isMarkedForDeletion(child) is true for every part that has a lambda pending.
    • isMarkedForDeletion scans markedTreesForDeletion_. The guard therefore holds whether flushStructuralChanges or destroyMarkedEntities drains first.
    • Entity IDs are monotonic and never recycled (entity_manager.cpp "no recycle pool"). After the drain, entityExists cannot alias a new entity.
    • StoppedPreviewSkipsPendingDetachedCanvasAllocation tests 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 own destroyEntity. Every earlier copy is under m_root and goes with destroyTree. 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 the std::copy into the copy's own span, and resyncAfterAuthoredEdits() restores the derived state. VoxelCopiesPreserveAuthoredPayloadAndOwnTheirStorage checks that the two buffers are separate.
  • GPU canvas lifetime. Copies are destroyed through the normal deferred lifecycle, so a C_EntityCanvas allocated for a live preview is released by its owner's onDestroy, the same path as any authored detached part. Nothing holds a canvas handle across frames.

Structural changes and iteration

  • begin() runs createEntity / setParent / setComponent eagerly, but only from EditorMotionPreview'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> in toggleMotionPreview calls IRPrefab::Widget::setVisible. I read that function (widgets.hpp): it only writes component fields plus a read-only nested forEachComponent<C_GuiHoverState>, with no add or remove. Iterating while doing this is safe.

Input isolation (frame ordering)

  • WIDGET_INPUT::endTick resets setKeyboardCaptured every INPUT frame. EditorMotionPreview runs later in the same pipeline and sets it to true. World::update runs executeUserKeyboardCommandsAll() 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 before stopMotionPreview(). 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)

  • toggleMotionPreview runs settleDocumentEdits(), closeLocalPartEdit(), setTransformMode(false), clears the loft/joint/bone-paint tools and calls motionView_.capture(), all before begin() 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 successful begin(). Sonnet raised the capture() half of this already.
  • The earlier nits still stand: the collapsed per-session descriptions in voxel_editor/CLAUDE.md, and the stray blank line in sessions.hpp.

Reviewed by Opus final reviewer (pool-2).

@jakildev jakildev added fleet:approved Fleet reviewer approved — ready for human merge and removed fleet:needs-opus-recheck Sonnet flagged this PR for Opus recheck before merge fleet:reviewing-mac-pool-2 labels Nov 5, 2026
@jakildev
jakildev merged commit 89b2107 into master Nov 5, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fleet:approved Fleet reviewer approved — ready for human merge fleet:author-codex Implementation last authored by Codex; route review to Claude fleet:authored-on-macos PR was authored and smoke-tested on macOS Metal backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant