feat: Scene | Runtime tabs in the graph during play mode (closes #898)#900
Open
marquezmiguel wants to merge 1 commit into
Open
feat: Scene | Runtime tabs in the graph during play mode (closes #898)#900marquezmiguel wants to merge 1 commit into
marquezmiguel wants to merge 1 commit into
Conversation
While playing, the graph shows two tabs following the editor's tabs pattern: "Scene" keeps the edited scene fully editable exactly as before (undo/redo, context menu, drag and drop, save), and "Runtime" shows the live hierarchy of the play scene — script-created objects appear as they spawn, can be selected and tweaked in the inspector (volatile changes, lost on stop). The play scene lives in a separate tree state so id collisions with the exported scene never leak selection or expansion between tabs, and preservation matching is indexed by id so large runtime scenes (tens of thousands of nodes) refresh in milliseconds. Structural operations are guarded per object instead of globally, undo/redo registration classifies items by the scene the edited object belongs to, and the play lifecycle is hardened against re-entrance and stop-during-loading races. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #898: while playing, the graph now shows two tabs following the inspector's tabs pattern — Scene keeps the edited scene fully editable exactly as before (undo/redo, context menu, drag and drop, save), and Runtime shows the live hierarchy of the play scene: objects created by scripts appear as they spawn, can be selected and inspected, and tweaked through the inspector (volatile changes, lost on stop). This mirrors the Local/Remote workflow of other editors for data-driven games where most content is spawned at runtime.
When the game is not playing, behavior is byte-equivalent to the current editor: no tabs, no guards, nothing changes.
Changes made
registerUndoRedoitems now carry an optionalobjectused by a volatile predicate installed during play — edits on edited scene objects keep recording history, edits on play scene objects execute without polluting the stack (they would reference disposed objects after stop).forceCompileAllSceneMaterialsresolves when its scene is disposed mid-compilation instead of hanging forever.tools/scene/play/runtime.tshelpers (isScenePlaying,getObjectScene,isPlaySceneObject) shared by all the guards, with unit tests. Existing behavior is preserved by 72 passing tests.Benefits
Follow-ups (out of scope, happy to discuss)
Note for reviewers: future
registerUndoRedocall sites should passobjectwhen reachable during play; items without it fall back to the inspector's edited object to classify volatility.🤖 Generated with Claude Code