API ReferenceGE Extensionseditorutil
Vehicle Select Utility
Vehicle model/config/paint selector widget for ImGui - provides dropdowns for vehicle type, model, config, paint layers, and optional custom config paths.
Vehicle model/config/paint selector widget for ImGui - provides dropdowns for vehicle type, model, config, paint layers, and optional custom config paths.
Class: C (returned by factory function)
Core Methods
| Method | Signature | Description |
|---|---|---|
C:init(name, data) | data: {model, config, customConfigPath, customConfigActive, paintName, paintName2, paintName3} | Initialises selections from optional data |
C:setModel(model) | model: string (key) | Sets the model by key; looks up name and type |
C:setConfig(config) | config: string (key) | Sets the config by key (model must be set first) |
C:setOptions(data) | {enableConfigs, enablePaints, enableCustomConfig, paintLayers, columnWidth} | Configures which UI sections are shown |
C:resetModel() | - | Clears model selection and cached model list |
C:resetConfig() | - | Clears config selection and custom config path |
C:resetPaint() | - | Clears paint selection |
C:resetSelections() | - | Resets all selections (type, model, config, paint) |
C:resetOptions() | - | Resets options to defaults; sets allowed types/subtypes |
C:fetchData() | - | Lazy-loads model/config/paint data from core_vehicles |
C:widget() | - | Renders the full selector UI; returns update reason string or nil |
C:getPaintPtr(paintTbl) | - | Converts paint data to ImGui float4 pointer for colour preview |
Properties
| Property | Type | Description |
|---|---|---|
model | string | Selected model key |
modelName | string | Display name of selected model |
config | string | Selected config key |
configName | string | Display name of selected config |
configPath | string | Path to config .pc file |
vehType | string | Selected vehicle type (Car, Truck, etc.) |
customConfigPath | string | Optional custom .pc file path |
customConfigActive | bool | Whether custom config is being used |
paintName / paintName2 / paintName3 | string | Selected paint names per layer |
allowedTypes | table | Vehicle types shown in type dropdown |
modelBlacklist | table | Models excluded from selection {[key]=true} |
configBlacklist | table | Configs excluded {[model]={[key]=true}} |
Usage Example
local vehicleSelectUtil = require('/lua/ge/extensions/editor/util/vehicleSelectUtil')
-- Create a selector with preset data
local selector = vehicleSelectUtil("Player Vehicle", {
model = "vivace",
config = "Base"
})
-- Enable paint selection (3 layers)
selector:setOptions({
enableConfigs = true,
enablePaints = true,
enableCustomConfig = true,
paintLayers = 3,
columnWidth = 100
})
-- Restrict to cars only
selector.allowedTypes = {"Car"}
selector.modelBlacklist = {propcar = true}
-- In editor GUI:
local updateReason = selector:widget()
if updateReason then
log("I", "", "Changed: " .. updateReason)
log("I", "", "Model: " .. tostring(selector.model))
log("I", "", "Config: " .. tostring(selector.config))
log("I", "", "Paint: " .. tostring(selector.paintName))
if selector.customConfigActive then
log("I", "", "Custom config: " .. selector.customConfigPath)
end
end
-- Update reasons: "type", "model", "config", "customConfig",
-- "paintName", "paintName2", "paintName3"Stub/TODO Methods
| Method | Signature | Status |
|---|---|---|
C:setModelListByField(key, value, disallow) | - | TODO (not implemented) |
C:setConfigListByField(model, key, value, disallow) | - | TODO (not implemented) |
Callbacks
| Method | Description |
|---|---|
C:onActivate() | Empty callback (no-op) |
C:onDeactivate() | Empty callback (no-op) |
See Also
- Editor Element Helper - Related reference
- Plot Helper Utility - Related reference
- Search Utility - Related reference
- World Editor Guide - Guide
Vehicle Filter Utility
Vehicle filter editor for missions/quests - provides a UI for base filters (whitelist/blacklist), probability-weighted sub-filters, manual additions/removals, and vehicle selection using configListGen
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.