Editor Helper
Reference for the editor helper class that provides a rich set of UI elements for editing mission type data in the mission editor. This is the backbone of all mission editor panels.
Reference for the editor helper class that provides a rich set of UI elements for editing mission type data in the mission editor. This is the backbone of all mission editor panels.
Module Export
Returns a constructor function (derivedClass, ...) that creates an editor helper instance with an elements array and autoAdditionalAttributes table.
Class C - Element Factory Methods
| Method | Signature | Description |
|---|---|---|
addNumeric | (label, fieldName, default, displayOptions) | Float input with optional unit display (velocity/distance/time) |
addString | (label, fieldName, default, len, displayOptions) | Text input with optional translation check and dropdown |
addBool | (label, fieldName, default, hideElementList, displayOptions) | Checkbox, can toggle visibility of other elements |
addTransform | (label, fieldName, valueOptions, displayOptions) | Position/rotation/scale with 3D gizmo and draw modes |
addModelConfig | (label, fieldName, defaultModel, defaultConfig, displayOptions) | Vehicle model+config selector |
addFile | (label, fieldName, default, allowedExtensions, displayOptions) | File path input with browse dialog |
addFixedFile | (label, filepathsInMissionfolder, displayOptions) | Fixed file reference (race, sites, prefab, flow, campath) |
addRace | (label, fieldName, default, ...) | File input specialized for .path.json race files |
addSites | (label, fieldName, default) | File input specialized for .sites.json files |
addLeaderboard | (label, fieldName, defaultCount, best, medium, worst) | Leaderboard parameter editor |
addReward | (label, fieldName, default) | Numeric input styled as reward |
addDropdown | (label, fieldName, values, default, tooltips) | Dropdown selector |
addMissionId | (label, fieldName, default, displayOptions) | Searchable mission ID selector |
addSimpleLapConfig | (label, fieldName, displayOptions) | Lap configuration utility |
addCustomElement | (label, getNew, setMission, draw) | Fully custom element with callbacks |
Decorators
| Method | Description |
|---|---|
addDecoHeader(text, color) | Colored section header |
addDecoText(text, tooltip) | Info text with tooltip |
addDecoSeparator() | Horizontal line |
addDecoSpacer() | 4px spacer |
addDecoDummy(height) | Custom height spacer |
Class C - Core Methods
| Method | Signature | Description |
|---|---|---|
getNewData | C:getNewData() → table | Returns default field values for all elements |
setMission | C:setMission(m) | Loads mission data into all element UI states |
checkMission | C:checkMission(m, fix) → issues | Validates mission data; optionally auto-fixes missing/mismatched fields |
draw | C:draw(filterOptions) | Draws all elements with ImGui; handles mouse interaction for transforms |
getAllFieldNames | C:getAllFieldNames() → table | Returns all field names with types for flowgraph integration |
setAutoAdditionalAttributes | C:setAutoAdditionalAttributes(key, auto) | Marks additional attributes for auto-generation |
Transform Draw Modes
| Mode | Description |
|---|---|
sphere | Sphere at position with scale as radius |
sphereDir | Sphere with directional prism indicator |
vehicle | Vehicle-shaped box with direction triangle |
halfBox | Half-size OBB visualization |
fullBox | Full-size OBB visualization |
How It Works
-- In a mission type's editor.lua:
local E = {}
E.__index = E
local helper = gameplay_missions_missions.editorHelper(E)
-- Add elements in init:
function E:init()
self:addDecoHeader("Race Setup")
self:addFile("Race File", "raceFile", "", {{"Race","*.path.json"}})
self:addTransform("Start Position", "start", {defaultPos=vec3()}, {drawMode="vehicle"})
self:addBool("Closed Track", "closed", false)
self:addNumeric("Laps", "laps", 3, {min=1, max=100})
endKey Behaviors
- Issue Detection:
checkMissionfinds missing fields, type mismatches, invalid files/models/configs - Fixed Files: Support context menus for Race Editor, Sites Editor, Flowgraph Editor, Cam Path Editor, and Scenetree
- Mouse Interaction: Clickable transforms can be selected by clicking in the 3D viewport
- Star Association: Elements can be linked to stars via
displayOptions.associatedStars
See Also
- missionTypes/baseMission - Base Mission Type Constructor - Related reference
- missionTypes/flowMission - Flowgraph-Based Mission Type - Related reference
- Gameplay Systems Guide - Guide
Base Mission
Reference for the base mission type, the simplest mission class providing minimal lifecycle hooks. Returned by `gameplay_missions_missions.baseMission()`.
Flow Mission
Reference for the flowgraph mission type, the primary mission class used by most BeamNG missions. Extends `baseMission` with flowgraph manager integration, vehicle/traffic/environment setup modules, c