Skip to content

editor: scripts docks into the bottom panel, one tab per script - #396

Merged
markaren merged 1 commit into
devfrom
editor-docked-script-editor
Jul 31, 2026
Merged

editor: scripts docks into the bottom panel, one tab per script#396
markaren merged 1 commit into
devfrom
editor-docked-script-editor

Conversation

@markaren

Copy link
Copy Markdown
Owner

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.

…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>
@markaren
markaren marked this pull request as ready for review July 31, 2026 14:36
@markaren
markaren merged commit de73292 into dev Jul 31, 2026
9 checks passed
@markaren
markaren deleted the editor-docked-script-editor branch August 1, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant