feat: Scene | Runtime tabs in the graph during play mode (closes #898)#900
feat: Scene | Runtime tabs in the graph during play mode (closes #898)#900marquezmiguel 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>
|
@marquezmiguel love the way it renders the orignal scene and runtime scene in tabs. I'm reviewing it and trying it. |
I thought it was important to keep the original scene, since there may be people who need to keep it. In the tests I ran, it works pretty well, and both worlds coexist perfectly |
|
@marquezmiguel I totally agree. What is the real usage of having the 2 scenes coexisting ? I really don't use it at all so I need help to understand ^^ |
For projects that build content at runtime it's the only way to see what the game actually created. My world is fully spawned by scripts on Play (thousands of meshes from data files) — those nodes don't exist in the edit scene, so without the Runtime tab I can't select a spawned mesh and check why it looks wrong. And keeping the Scene tab means Play doesn't lock you out of your real scene: you always know your edits land somewhere persistent, not in the runtime copy that dies on Stop. Same idea as Godot's Local/Remote tabs |
I totally understand but what makes the editor useful is the realtime feedback when changing values. In the original scene, when playing, I modify values but I don't see the effect so I don't use it anymore. So my question is how is it useful to have the orignal scene graph still accessible? The rest is really ok for me |
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