editor: scripts docks into the bottom panel, one tab per script - #396
Merged
Conversation
…ript It was a floating window, and floating over the viewport is what was wrong with it: a text box big enough to write in covered the object the script was being written about. It is now the bottom panel's Scripts tab. The bottom panel is a size rather than a constant to make that worth having. EditorSettings::bottomPanelHeight is dragged from the panel's top edge and persisted next to the side panel widths, clamped on read and on drag against bottomHeightLimit() - derived from the window, so a settings file written on a bigger monitor cannot leave a small one with no viewport. drawSplitter grew a horizontal twin; both are one strip implementation now. The grab strip overlays the panel boundary instead of reserving a band above it. A reserved band was a strip of bare viewport between the side panels and the bottom one - a seam across the whole window. And the editor holds as many scripts as you open, one tab each, because the single retargeting buffer made writing two scripts that talk to each other a round trip through the hierarchy. Each keeps its own text, its own syntax error and its own text-box state (PushID per uuid, or ImGui carries one script's cursor and undo stack into the next). Still one script per object - that is ScriptConfig's rule, not this file's. Selecting an object now RAISES its tab if one is open rather than retargeting a buffer onto it, and does nothing at all if none is. On a change of selection, not on a mismatch: a rule that fired whenever the selection and the visible tab disagreed bounced every explicit open straight back on the next frame. The active script is settled at request time too - ImGui applies SetSelected at the following BeginTabBar, so the outgoing tab was writing itself back as active for one frame, undoing the switch and pointing Apply at the script you just left. External sessions sync into their own object's tab rather than whichever is visible, and reopen it unrevealed if it was closed under them. Self-test: 491 checks, covering the dock/panel geometry (dock height tracks the panel, no seam, clamping, collapse) and two scripts open at once (independent buffers, raise-on-selection, explicit-open-outranks-selection, reuse-on-reopen, Apply hitting only the visible one, both surviving play/stop, closing). --screenshot gains _script_editor and _script_editor_two, and both it and the layout pass now put the user's persisted panel height back. Co-Authored-By: Claude Opus 5 <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.
It was a floating window, and floating over the viewport is what was wrong with it: a text box big enough to write in covered the object the script was being written about. It is now the bottom panel's Scripts tab.
The bottom panel is a size rather than a constant to make that worth having. EditorSettings::bottomPanelHeight is dragged from the panel's top edge and persisted next to the side panel widths, clamped on read and on drag against bottomHeightLimit() - derived from the window, so a settings file written on a bigger monitor cannot leave a small one with no viewport. drawSplitter grew a horizontal twin; both are one strip implementation now.
The grab strip overlays the panel boundary instead of reserving a band above it. A reserved band was a strip of bare viewport between the side panels and the bottom one - a seam across the whole window.
And the editor holds as many scripts as you open, one tab each, because the single retargeting buffer made writing two scripts that talk to each other a round trip through the hierarchy. Each keeps its own text, its own syntax error and its own text-box state (PushID per uuid, or ImGui carries one script's cursor and undo stack into the next). Still one script per object - that is ScriptConfig's rule, not this file's.
Selecting an object now RAISES its tab if one is open rather than retargeting a buffer onto it, and does nothing at all if none is. On a change of selection, not on a mismatch: a rule that fired whenever the selection and the visible tab disagreed bounced every explicit open straight back on the next frame. The active script is settled at request time too - ImGui applies SetSelected at the following BeginTabBar, so the outgoing tab was writing itself back as active for one frame, undoing the switch and pointing Apply at the script you just left.
External sessions sync into their own object's tab rather than whichever is visible, and reopen it unrevealed if it was closed under them.