API ReferenceGE Extensionseditor
Editor Windows Manager
Provides a utility window that lists all registered editor windows and allows resetting their positions. Useful when a window is dragged off-screen or lost.
Provides a utility window that lists all registered editor windows and allows resetting their positions. Useful when a window is dragged off-screen or lost.
Public Interface
Editor Hooks
| Hook | Description |
|---|---|
onEditorGui | Draws the "Windows" panel with a searchable list of all editor windows. Each entry has a button to reset that window's position to (0,0). Also performs boundary checking to keep the Windows panel itself on-screen. |
onEditorInitialized | Registers the "Windows" window (800×500) and adds the "Window Position Reset..." menu item. Also registers the assetBrowserEditMode edit mode stub. |
Internal Functions
| Function | Purpose |
|---|---|
windowPosCheck() | Ensures the Windows panel stays within the main viewport bounds. Moves it to (40,40) relative to the viewport if it drifts off-screen. |
onWindowMenuItem() | Callback that shows the window when its menu item is clicked. |
Window Layout
The window displays a two-column table:
- Window Name - The title of each registered editor window
- Action Button - "Set position to 0,0" to reset that window's location
A text filter at the top allows searching by window name.
Usage Example
-- The window is accessed from the editor menu bar:
-- Editor Menu > Window Position Reset...
-- Internally, the window list comes from:
local windowsData = editor.getWindowsState()
-- Returns a table of { [name] = { title = "...", ... }, ... }
-- Each window can be repositioned via ImGui:
im.SetWindowPos2(windowName, im.ImVec2(0, 0))Boundary Check Logic
-- Keeps the Windows panel visible on the main viewport
local function windowPosCheck()
local mainViewport = im.GetMainViewport()
local mVPos = mainViewport.Pos
local mVSize = mainViewport.Size
-- If window is out of bounds in any direction, snap to (40,40)
if windowPos.x + windowSize.x - 40 < mVPos.x
or windowPos.y < mVPos.y
or windowPos.x > mVPos.x + mVSize.x
or windowPos.y > mVPos.y + mVSize.y then
im.SetWindowPos2("Windows", im.ImVec2(mVPos.x + 40, mVPos.y + 40))
end
endAdditional Exports
M.onEditorGuiM.onEditorInitialized
See Also
- Editor AI Tests - Related reference
- Editor AI Visualization - Related reference
- Editor – Assembly Spline Tool - Related reference
- World Editor Guide - Guide