API ReferenceGE ExtensionseditorvehicleEditor
Vehicle Editor - Toolbar
Main toolbar for the Vehicle Editor providing tabbed switching between Static and Live editor modes, app menus, layout management, vehicle spawn/remove controls, and camera/time-of-day sliders.
Main toolbar for the Vehicle Editor providing tabbed switching between Static and Live editor modes, app menus, layout management, vehicle spawn/remove controls, and camera/time-of-day sliders.
Module Exports
| Export | Type | Description |
|---|---|---|
M.dependencies | table | {'core_environment'} |
M.onEditorGuiToolBar | hook | Renders the main toolbar with tabs and menus |
M.onEditorInitialized | hook | Populates vehicle list and registers toolbar window |
Key Internals
| Variable | Type | Purpose |
|---|---|---|
camSpeedPtr | FloatPtr | Camera speed slider value |
todPtr | FloatPtr | Time of day slider (0–100) |
vehsList | table | Sorted list of Car/Truck vehicles for spawn menu |
layoutName | ArrayChar | Input for saving layout names |
Toolbar Structure
Tab Bar
- Static Editor tab - switches to
EDITOR_MODE_STATIC - Live Editor tab - switches to
EDITOR_MODE_LIVE
Static Editor Toolbar
- Apps menu - lists all static editor menu items
- View menu - layouts management + "Add View" for static render views
Live Editor Toolbar
- Apps menu - lists all live editor menu items
- View menu - layouts management + "Add View" for live scene views
- Vehicles menu:
- Spawn submenu - spawn any Car/Truck at camera position
- Remove submenu - delete individual vehicles by name/ID
- Remove All - delete all vehicles
- Camera speed + Time of day sliders (right-aligned)
Layout Management
- Save Layout - saves current window layout by name
- Delete Layout - removes saved layouts
- Revert to Factory Settings - resets all layouts to default
Lua Code Example
-- The toolbar is registered and shown on editor init:
-- editor.registerWindow(toolbarWindowName)
-- editor.showWindow(toolbarWindowName)
-- Tab switching triggers editor mode change:
-- if im.BeginTabItem("Static Editor") then
-- if vEditor.editorMode ~= vEditor.EDITOR_MODE_STATIC then
-- vEditor.setEditorMode(vEditor.EDITOR_MODE_STATIC)
-- end
-- end
-- Vehicle spawning from toolbar:
-- local spawnPos = core_camera.getPosition()
-- local spawnRot = getCameraQuat()
-- local veh = core_vehicles.spawnNewVehicle(vehData.model.key, {pos = spawnPos, rot = spawnRot})
-- veh:queueLuaCommand("input.event('parkingbrake', 0, 1)")
-- Camera speed slider (range 2–100):
-- if editor.uiSliderFloat("Camera Speed", camSpeedPtr, 2, 100) then
-- editor.setCameraSpeed(camSpeedPtr[0])
-- end
-- Time of day slider (range 0–100):
-- local tod = core_environment.getTimeOfDay()
-- todPtr[0] = tod.time * 100
-- if editor.uiSliderFloat("Time of day", todPtr, 0, 100) then
-- tod.time = todPtr[0] / 100
-- core_environment.setTimeOfDay(tod)
-- end
-- Layout management:
-- editor_layoutManager.saveWindowLayout(name, vEditor.getEditorName())
-- editor_layoutManager.loadWindowLayout(layoutPath)
-- editor_layoutManager.deleteWindowLayout(layoutPath)
-- editor_layoutManager.resetLayouts(vEditor.getEditorName())
-- Vehicle list is built sorted by model key:
-- local unsortedList = {}
-- for k, vehItem in ipairs(core_vehicles.getVehicleList().vehicles) do
-- if vehItem.model.Type == 'Car' or vehItem.model.Type == 'Truck' then
-- unsortedList[vehItem.model.key] = vehItem
-- end
-- end
-- local keysSorted = tableKeysSorted(unsortedList)See Also
- World Editor Guide - Guide
Zone Selector Utility
Zone selection widget for mission/quest editor - loads zones from a sites file and provides UI for selecting initial (spawn) and destination zones.
Node Transformer API
Vehicle editor API for transforming selected nodes using the axis gizmo - translates node positions in local vehicle space.