Forest Editor
Full-featured editor for placing and manipulating forest vegetation items in BeamNG levels.
Full-featured editor for placing and manipulating forest vegetation items in BeamNG levels.
Overview
The editor_forestEditor extension provides a comprehensive vegetation/forest editing toolset. It supports brush-based painting, transform tools (select, translate, rotate, scale), lasso selection, parallax mapping texture set editing, and detailed per-item property inspection. Works with ForestBrush, ForestBrushElement, and ForestItemData objects.
Module Globals
| Field | Type | Description |
|---|---|---|
var.selectedTool | enum | Currently active tool (transform, brush, instantiate) |
var.selectedForestBrushes | table | Currently selected forest brushes |
var.selectedForestItemDatas | table | Currently selected forest item data objects |
var.transformToolSelectionMode | enum | Current transform sub-mode (select/translate/rotate/scale/lasso) |
var.forestBrushTool | object | The brush tool controller |
var.forestData | object | Forest data handle |
var.forestBrushes | table | All forest brushes |
var.forestBrushesMap | table | Name-to-brush lookup map |
var.selectedTab | enum | Active tab: brushes or meshes |
Tool Types
| Enum | Value | Description |
|---|---|---|
transformTool | 1 | Select/move/rotate/scale items |
brush | 2 | Paint vegetation with brushes |
instantiate | 3 | Place single items |
Brush Modes
| Mode | Value | Description |
|---|---|---|
paint | 0 | Paint vegetation items |
snap | 1 | Snap items to terrain |
erase | 2 | Erase vegetation items |
eraseSelected | 3 | Erase only selected items |
instantiate | 4 | Place individual items |
Transform Modes
| Mode | Value | Description |
|---|---|---|
select | 1 | Selection mode |
translate | 2 | Move items |
rotate | 3 | Rotate items |
scale | 4 | Scale items |
lassoSelect | 5 | Freehand or polyline lasso selection |
Key Functions
| Function | Description |
|---|---|
M.dumpForestBrushes() | Debug: prints all forest brushes |
M.dumpBrushProperties() | Debug: prints brush size, pressure, hardness |
updateCentroid() | Recalculates selection centroid from selected forest items |
readOrIntializeParallaxMappingTextureSets() | Loads or creates parallax texture set data |
updateAutoRepeatChangeBrushSize() | Handles held-key brush size adjustment |
Debug Functions
-- Dump all forest brushes to console
editor_forestEditor.dumpForestBrushes()
-- Dump brush properties (size, pressure, hardness)
editor_forestEditor.dumpBrushProperties()
-- Dump brush name mapping
editor_forestEditor.dumpForestBrushesMap()Usage Example
-- The forest editor is activated via the editor's edit mode system.
-- When "Edit Forest" mode is active, the forest editor window appears.
-- Brush properties are accessed via the internal var table
-- (no public getVar export exists - use the exported functions instead)
editor_forestEditor.selectToolByName("brush")
editor_forestEditor.selectBrushByIndex(1)Module Variables
M.dependencies(table) -{"core_forest"}.
Functions
M.beginChangeBrushSizeWithKeys(direction)
Starts auto-repeat brush size change with keyboard.
direction(number)
M.endChangeBrushSizeWithKeys()
Stops auto-repeat brush size change.
M.onEditorInitialized()
Registers edit mode, tool windows, preferences, and legend action names.
M.onEditorGui()
Main per-frame UI rendering and 3D visualization.
M.onEditorAfterSaveLevel()
Saves forest data after level save.
M.onEditorRegisterPreferences(prefsRegistry)
Registers forest editor preferences.
prefsRegistry(any)
M.onEditorAxisGizmoAligmentChanged()
Updates gizmo when alignment mode changes.
M.onEditorAxisGizmoModeChanged(mode)
Updates gizmo when mode changes.
mode(any)
M.onEditorInspectorFieldChanged(selectedIds, fieldName, fieldValue, arrayIndex)
Handles inspector field changes for forest items.
selectedIds(any)fieldName(string)fieldValue(any)arrayIndex(any)
M.onDeserialize(data)
Restores forest editor state from serialized data.
data(table)
M.onSerialize()
Serializes forest editor state for persistence.
Returns: table
M.changeBrush(value, step)
Changes brush size/pressure by value and step.
value(any)step(any)
M.selectBrushByIndex(index)
Selects a brush by its index.
index(number)
M.selectForestItems(forestItems, addToSelection)
Selects forest items in the editor.
forestItems(table)addToSelection(boolean)
M.selectToolByName(toolName)
Activates a tool by name (e.g. "brush", "transform").
toolName(string)
M.clearForestItemsSelection()
Clears the current forest items selection.
M.dumpForestBrushes()
Debug: prints all forest brushes to console.
M.dumpForestBrushesMap()
Debug: prints brush name-to-object mapping.
M.dumpBrushProperties()
Debug: prints brush size, pressure, hardness.
See Also
- Forest View - List view of forest items
- Gen Terrain - Terrain editing tools