editor_heroRoadEditor_groupMgr¶
File: lua/ge/extensions/editor/heroRoadEditor/groupMgr.lua · VM: Game Engine (GE) · 1883 lines · BeamNG.drive 0.40.5 (buildbot 302427 on GitLab)
Access: extension editor_heroRoadEditor_groupMgr: extensions.load("editor_heroRoadEditor_groupMgr"), then the global editor_heroRoadEditor_groupMgr
Central manager of the "groups" (roads) of the Hero Road Editor. A group is a Lua table describing a road: nodes/widths/normals, cross-section profile, materials, marking layers, placed elements (crosswalks, repairs, potholes, widenings, intersections, barriers), groundmodel paint and Edit/Live state. The module creates, copies, splits, joins, serializes and deletes groups, applies profile presets, holds the undo/redo functions and drives the rebuild: updateDirtyGroups resamples the centerline then calls mesh, sidewalkMgr, barrierMgr and layerMgr in the right order.
Example¶
local gm = extensions.editor_heroRoadEditor_groupMgr
gm.addNewGroup('My road')
local g = gm.getGroups()[#gm.getGroups()]
gm.applyProfilePreset(g, 'country')
gm.addCrossing(g, 0.5) -- crosswalk in the middle
-- g.isDirty = true is set: updateDirtyGroups(false) rebuilds on the next frame
Notes¶
- Each group is a SimGroup folder in MissionGroup named '
- '; its canSave follows the road's state (false in Edit, true once baked/Live). - Profile presets (applyProfilePreset): highway, city, country, ledge, rally, race, speedway, valley. Each sets lanes, lane width, crown, shoulder, superelevation, engineering radii, road class and markings.
- Default lane width 3.65 m (minimum 1.5 m); the roadway width = (lanesLeft + lanesRight) * laneWidthM, split into equal leftExtM/rightExtM. At least 1 lane in total (otherwise 1+1).
- Element defaults: crosswalk depthM 3.5 m; repair lengthM 8.0 m, coverage 0.6, density 0.08, sizes 2 to 4 m, random seed; pothole radius 2.0 m, depth 0.3 m, noise 0.15; widening 3.0 m wide, bay 30 m, tapers 40 m and 25 m; intersection flare 4.0 m, length 8.0 m, bevel 2.5 m; barrier 30 m, offset 0.5 m, side 'right', type 'guardrail'.
- The position t of placed elements is a normalized abscissa 0..1 along the centerline (plan length), adjusted by clampCrossingT to stay away from the ends (0.5 m clearance, or mid-road if too short).
- Rebuild order of an active road (not being dragged): sampleCenterline, rib points, then meshMgr.updateMesh, sidewalkMgr.updateGroup, barrierMgr.updateGroup, be:reloadCollision, recreateAutoGeneratedLayers, layerMgr.updateAllLayers (decals drape over the collision, hence the collision before them). During a drag (dragging) or with previewMesh == false, only buildRibbonEdges is called. A terrain road (isMesh == false) uses buildTerrainEdges and terrain painting.
- New group defaults: geometryMode 'engineered' (engRadiusM 40, engTransM 15, engVertLenM 40), latRes 16, lonRes 100, LOD 400/150/40 px, chunkLenM 120, material 'm_asphalt_new_01', US-style markings, automatic layers: light tracks, centerline, edge lines and lane lines active.
- deserializeGroup fills the default geometry 'spline' for old saves without geometryMode, while addNewGroup creates 'engineered'.
- serializeGroup empties the derived arrays (divPoints, etc.) of the actual group before encoding; serializeGroupToTable makes a copy and removes the runtime keys (decal ids, previewMesh, terraBaseline) for the session file.
- convertPathsToRoadGroups: the final message logs #paths - #groups as the number of ignored paths, which also counts already existing groups (potentially wrong message). It creates a group per path even if the path is too small (minimum size 10 m): these groups stay empty.
- addGroupToGroupArray does not call computeIdToIdxMap; addNewGroup, removeGroup, splitGroup and joinRoadSplines do.
Functions¶
| Function | Description | Line |
|---|---|---|
editor_heroRoadEditor_groupMgr.addBarrier(group, t01) |
Adds a placeable barrier segment (guardrail, jersey or plastic) on one side, over a length window, at abscissa t01; the furniture is placed by barrierMgr after the rebuild. | 1218 |
editor_heroRoadEditor_groupMgr.addCrossing(group, t01) |
Adds a crosswalk at abscissa t01 ({ id, name, t, depthM 3.5, lateral 'carriageway' }) and marks dirty. | 1097 |
editor_heroRoadEditor_groupMgr.addGroupToGroupArray(group) |
Adds an existing group to the array, with a unique name; creates its SimGroup folder if missing and sets its canSave (true if group.isEnabled == false). | 112 |
editor_heroRoadEditor_groupMgr.addJunction(group, t01) |
Adds an intersection (funnel flare on one side, this road being the trunk) at abscissa t01, with options giveWay, exitCenterline and breakEdge. | 1246 |
editor_heroRoadEditor_groupMgr.addNewGroup(name) |
Creates a new group with all default parameters (see notes), its transient scene folder and its automatic layers, adds it to the list and updates the id map. Returns nothing: the group is found with getGroups()[#getGroups()]. | 557 |
editor_heroRoadEditor_groupMgr.addPothole(group, t01) |
Adds a procedural pothole (carved into the mesh) at abscissa t01; the adjustment extent is about the diameter. | 1154 |
editor_heroRoadEditor_groupMgr.addRepair(group, t01) |
Adds a repair patch cluster (scatter of asphalt decals, random seed) at abscissa t01 and marks dirty. | 1122 |
editor_heroRoadEditor_groupMgr.addWidening(group, t01) |
Adds a flat widening on one side (layby, overtaking lane) at abscissa t01, with smoothed entry and exit tapers. | 1183 |
editor_heroRoadEditor_groupMgr.applyProfilePreset(group, key) |
Applies a profile preset to the group (copies all its fields, resyncs the width, marks dirty). Does nothing if the key is unknown. | 219 |
editor_heroRoadEditor_groupMgr.barrierDefaults() |
Default values of a new barrier. | 1212 |
editor_heroRoadEditor_groupMgr.barrierExtent(b) |
Extent along the road (m) of a barrier segment, i.e. its length; used to keep it away from the ends. | 1215 |
editor_heroRoadEditor_groupMgr.clampCrossingT(group, t01, depthM) |
Clamps a normalized abscissa so that the strip (plus 0.5 m clearance) stays away from both ends; on a road that is too short, returns 0.5. | 1023 |
editor_heroRoadEditor_groupMgr.clearGroupVisuals(group) |
Hides during a drag: deletes the group's mesh, sidewalks, furniture and decals (the layer definitions are kept) and reloads the collision if a mesh existed. | 264 |
editor_heroRoadEditor_groupMgr.conformGroupToTerrain(group) |
One-off "Drape to Terrain": sets the z height of each node to that of the terrain (core_terrain.getTerrainHeight) and marks dirty. | 228 |
editor_heroRoadEditor_groupMgr.convertPathsToRoadGroups(paths) |
Converts paths traced from an image (terrain bitmap) into Hero Road groups: grid points converted to world coordinates, normals taken from the terrain. | 1370 |
editor_heroRoadEditor_groupMgr.copyGroupProfile(sourceGroup) |
Copies a group's layer profile: non-automatic (serialized) layers and the marking, edge and cross-section flags/parameters (lanes, crown, shoulder, etc.). | 784 |
editor_heroRoadEditor_groupMgr.crossingFrame(group, t01) |
World frame of a crosswalk at normalized abscissa t01: center and ends of the roadway edges (p0 left, p1 right). Drives the placement ghost, the handles and the zebra strip. nil if the geometry is not ready. | 1067 |
editor_heroRoadEditor_groupMgr.deepCopyAllGroups() |
Deep copy of the state of all groups. | 1287 |
editor_heroRoadEditor_groupMgr.deepCopyGroup(group) |
Deep copy of a group via string.buffer (encode/decode), with the derived arrays (divPoints, divWidths, tangents, binormals, normals, discMap) emptied. Used for undo snapshots. | 1275 |
editor_heroRoadEditor_groupMgr.deserializeGroup(data, isCreateObject) |
Deserializes a group from a string.buffer blob or a session JSON table: fills missing fields with defaults (old saves), rehydrates the layers, converts nodes/normals to vec3 and marks dirty. | 1417 |
editor_heroRoadEditor_groupMgr.deserializeSessionGroup(gt) |
Deserialization when loading a session: if the road is baked but its .dae files have disappeared, it is reloaded in editable mode (isEnabled = true, bakedManifest cleared). | 1607 |
editor_heroRoadEditor_groupMgr.ensureCornerArray(group) |
Aligns the sparse array group.corners (per-corner overrides, false = auto) to the number of nodes: pads with false and truncates the excess. | 187 |
editor_heroRoadEditor_groupMgr.getCurrentRoadSplineList() |
List of enabled (Edit) roads as { name, id, type = 'Hero Road' }. | 1796 |
editor_heroRoadEditor_groupMgr.getEditModeKey() |
Edit mode key of the tool: 'heroRoadEditor'. | 109 |
editor_heroRoadEditor_groupMgr.getGroups() |
Current array of all groups (live references, not a copy). | 100 |
editor_heroRoadEditor_groupMgr.getIdToIdxMap() |
Table group id to index in getGroups(). | 103 |
editor_heroRoadEditor_groupMgr.getToolPrefixStr() |
Tool name prefix: 'Hero Road'. | 106 |
editor_heroRoadEditor_groupMgr.isOneWayProfile(group) |
Indicates whether the profile is one-way (one side has zero lanes). | 197 |
editor_heroRoadEditor_groupMgr.joinRoadSplines(groupIdx1, nodeIdx1, groupIdx2, nodeIdx2) |
Joins two open roads into one: modifies group 1 with the joined geometry (geom.joinSplineGeometry), deletes group 2 and clears the terraform baseline. Does nothing if the indices are invalid. | 1340 |
editor_heroRoadEditor_groupMgr.junctionDefaults() |
Default values of a new intersection (also the reset values of the sliders). | 93 |
editor_heroRoadEditor_groupMgr.junctionExtent(j) |
Total extent (m) of an intersection: near bevel + throat + far bevel (2*bevelM + lengthM). Used for adjustment and meshing via the correspondence with the widening. | 97 |
editor_heroRoadEditor_groupMgr.pasteGroupProfile(targetGroup, profile) |
Pastes a profile onto a group: deletes its layers, takes the profile's layers and parameters (absent values keep those of the target or the defaults), marks dirty and recreates the automatic layers. | 898 |
editor_heroRoadEditor_groupMgr.rebuildSurfaceOnly(group) |
Light rebuild for groundmodel painting: redoes the mesh (mesh.updateMesh) and reloads the collision. Does nothing if the road is disabled, of terrain type, without preview or has fewer than 2 nodes. | 532 |
editor_heroRoadEditor_groupMgr.recomputeIdMap() |
Recomputes the id to index map (called by the session helper after a load). | 1615 |
editor_heroRoadEditor_groupMgr.recreateAutoGeneratedLayers(group) |
Deletes all automatic (hidden) layers then recreates those whose flag is active (tire tracks, repairs, damaged asphalt, cracks, patches, centerline, edge/lane lines, edge fades), and marks the group dirty. | 239 |
editor_heroRoadEditor_groupMgr.removeAllGroups(isIncludeDisabled) |
Deletes all groups (isIncludeDisabled = true) or only the enabled (Edit) groups otherwise. | 167 |
editor_heroRoadEditor_groupMgr.removeBarrier(group, idx) |
Deletes the barrier at index idx. | 1238 |
editor_heroRoadEditor_groupMgr.removeCrossing(group, idx) |
Deletes the crosswalk at index idx and marks the group dirty. | 1113 |
editor_heroRoadEditor_groupMgr.removeGroup(idx) |
Deletes the group at index idx: restores terrain paint, undoes the terraform, deletes layers, mesh, sidewalks, furniture and scene folder, then recomputes the id map. | 135 |
editor_heroRoadEditor_groupMgr.removeJunction(group, idx) |
Deletes the intersection at index idx. | 1268 |
editor_heroRoadEditor_groupMgr.removeLinkedRoadSpline(splineId) |
Deletes a group by its id (called from the deletion of a master spline layer). | 159 |
editor_heroRoadEditor_groupMgr.removePothole(group, idx) |
Deletes the pothole at index idx. | 1175 |
editor_heroRoadEditor_groupMgr.removeRepair(group, idx) |
Deletes the repair patch cluster at index idx. | 1145 |
editor_heroRoadEditor_groupMgr.removeWidening(group, idx) |
Deletes the widening at index idx. | 1205 |
editor_heroRoadEditor_groupMgr.serializeGroup(group) |
Serializes a group to a string.buffer blob after emptying its derived arrays (modifies the actual group). | 1404 |
editor_heroRoadEditor_groupMgr.serializeGroupToTable(group) |
A group as a simple portable table for the session file: copy by the codec, without runtime keys, layers reduced to their author data. | 1583 |
editor_heroRoadEditor_groupMgr.setFixedWidth(group, width) |
Sets the same width on all the group's nodes and marks it dirty. Overwritten by syncProfileWidth at the next rebuild (the lane profile is authoritative). | 539 |
editor_heroRoadEditor_groupMgr.setLaneProfile(group, lanesLeft, lanesRight, laneWidthM) |
Sets the number of lanes per side (and optionally their width), recomputes the roadway width and marks the group dirty. | 547 |
editor_heroRoadEditor_groupMgr.singleGroupEditRedo(data) |
Redoes a change to a single group: applies the data.new state. | 1774 |
editor_heroRoadEditor_groupMgr.singleGroupEditUndo(data) |
Undoes a change to a single group: restores the data.old state (layers, parameters, placed elements) in the group with the same id. | 1772 |
editor_heroRoadEditor_groupMgr.splitGroup(group, groupIdx, selectedNodeIdx) |
Cuts a road at the selected node. Loop: becomes a reordered open road. Otherwise: creates two new groups '(1)' and '(2)' (new ids, corner overrides kept, terraform baseline cleared) and deletes the old one. | 1296 |
editor_heroRoadEditor_groupMgr.syncProfileWidth(group) |
Derives the roadway width from the lane profile: normalizes lanesLeft/lanesRight (integers >= 0, at least 1 lane in total), clamps laneWidthM to a 1.5 m minimum, sets leftExtM/rightExtM and the width of each node. | 204 |
editor_heroRoadEditor_groupMgr.tForPointOnGroup(group, p, depthM) |
Normalized abscissa of a world point projected (in plan) onto the centerline, adjusted away from the ends. Used when dragging a handle. nil if the road has no ribbon. | 1059 |
editor_heroRoadEditor_groupMgr.transGroupEditRedo(groupsData) |
Redoes a multi-group change (groupsData.new state). | 1793 |
editor_heroRoadEditor_groupMgr.transGroupEditUndo(groupsData) |
Undoes a change touching several groups: deletes all groups and restores the copies from groupsData.old, all marked dirty. | 1791 |
editor_heroRoadEditor_groupMgr.updateDirtyGroups(dragging) |
Rebuilds each group marked isDirty (and the dirty layers of the others), then marks the session as edited. Handles disabled/baked roads, groups with fewer than 2 nodes (clean everything), mesh roads, terrain roads, dragging and disabled preview. Called every frame by the editor. (internal) | 402 |
editor_heroRoadEditor_groupMgr.wideningDefaults() |
Default values of a new widening (also the reset values of the sliders). | 87 |
editor_heroRoadEditor_groupMgr.wideningExtent(w) |
Total extent (m) along the road of a widening: entry taper + bay + exit taper. | 90 |
Parameter details¶
editor_heroRoadEditor_groupMgr.addBarrier(group, t01)¶
Adds a placeable barrier segment (guardrail, jersey or plastic) on one side, over a length window, at abscissa t01; the furniture is placed by barrierMgr after the rebuild.
group(table) : Hero Road group.t01(number|nil) : Normalized abscissa (default 0.5).- returns: table|nil The created barrier (side, lengthM, offsetM, zOffsetM, type).
editor_heroRoadEditor_groupMgr.addCrossing(group, t01)¶
Adds a crosswalk at abscissa t01 ({ id, name, t, depthM 3.5, lateral 'carriageway' }) and marks dirty.
group(table) : Hero Road group.t01(number|nil) : Normalized abscissa (default 0.5).- returns: table|nil The created crosswalk.
editor_heroRoadEditor_groupMgr.addGroupToGroupArray(group)¶
Adds an existing group to the array, with a unique name; creates its SimGroup folder if missing and sets its canSave (true if group.isEnabled == false).
group(table) : Group to add.
editor_heroRoadEditor_groupMgr.addJunction(group, t01)¶
Adds an intersection (funnel flare on one side, this road being the trunk) at abscissa t01, with options giveWay, exitCenterline and breakEdge.
group(table) : Hero Road group.t01(number|nil) : Normalized abscissa (default 0.5).- returns: table|nil The created intersection (flareM, lengthM, bevelM, side...).
editor_heroRoadEditor_groupMgr.addNewGroup(name)¶
Creates a new group with all default parameters (see notes), its transient scene folder and its automatic layers, adds it to the list and updates the id map. Returns nothing: the group is found with getGroups()[#getGroups()].
name(string|nil) : Base name; default 'Hero Road N'. Made unique by util.generateUniqueName.
editor_heroRoadEditor_groupMgr.addPothole(group, t01)¶
Adds a procedural pothole (carved into the mesh) at abscissa t01; the adjustment extent is about the diameter.
group(table) : Hero Road group.t01(number|nil) : Normalized abscissa (default 0.5).- returns: table|nil The created pothole (lateralM, lengthM, widthM, depthM, noise, cutMarkings, seed).
editor_heroRoadEditor_groupMgr.addRepair(group, t01)¶
Adds a repair patch cluster (scatter of asphalt decals, random seed) at abscissa t01 and marks dirty.
group(table) : Hero Road group.t01(number|nil) : Normalized abscissa (default 0.5).- returns: table|nil The created cluster.
editor_heroRoadEditor_groupMgr.addWidening(group, t01)¶
Adds a flat widening on one side (layby, overtaking lane) at abscissa t01, with smoothed entry and exit tapers.
group(table) : Hero Road group.t01(number|nil) : Normalized abscissa (default 0.5).- returns: table|nil The created widening (side, widthM, bayLenM, taperInM, taperOutM, edgeBulge, laneDivider).
editor_heroRoadEditor_groupMgr.applyProfilePreset(group, key)¶
Applies a profile preset to the group (copies all its fields, resyncs the width, marks dirty). Does nothing if the key is unknown.
group(table) : Hero Road group.key(string) : 'highway', 'city', 'country', 'ledge', 'rally', 'race', 'speedway' or 'valley'.
editor_heroRoadEditor_groupMgr.barrierDefaults()¶
Default values of a new barrier.
- returns: table { lengthM = 30.0, offsetM = 0.5, zOffsetM = 0.0, side = 'right', type = 'guardrail' }.
editor_heroRoadEditor_groupMgr.barrierExtent(b)¶
Extent along the road (m) of a barrier segment, i.e. its length; used to keep it away from the ends.
b(table) : Gate.- returns: number lengthM or 30.0 by default.
editor_heroRoadEditor_groupMgr.clampCrossingT(group, t01, depthM)¶
Clamps a normalized abscissa so that the strip (plus 0.5 m clearance) stays away from both ends; on a road that is too short, returns 0.5.
group(table) : Hero Road group.t01(number) : Normalized abscissa.depthM(number|nil) : Extent along the road (default 3.5 m).- returns: number Clamped t01.
editor_heroRoadEditor_groupMgr.clearGroupVisuals(group)¶
Hides during a drag: deletes the group's mesh, sidewalks, furniture and decals (the layer definitions are kept) and reloads the collision if a mesh existed.
group(table) : Hero Road group.
editor_heroRoadEditor_groupMgr.conformGroupToTerrain(group)¶
One-off "Drape to Terrain": sets the z height of each node to that of the terrain (core_terrain.getTerrainHeight) and marks dirty.
group(table) : Hero Road group.
editor_heroRoadEditor_groupMgr.convertPathsToRoadGroups(paths)¶
Converts paths traced from an image (terrain bitmap) into Hero Road groups: grid points converted to world coordinates, normals taken from the terrain.
paths(table[]) : Paths { points = {{x, y}, ...}, widths = {...} } in terrain grid coordinates.
editor_heroRoadEditor_groupMgr.copyGroupProfile(sourceGroup)¶
Copies a group's layer profile: non-automatic (serialized) layers and the marking, edge and cross-section flags/parameters (lanes, crown, shoulder, etc.).
sourceGroup(table) : Source group.- returns: table Copied profile, to pass to pasteGroupProfile.
editor_heroRoadEditor_groupMgr.crossingFrame(group, t01)¶
World frame of a crosswalk at normalized abscissa t01: center and ends of the roadway edges (p0 left, p1 right). Drives the placement ghost, the handles and the zebra strip. nil if the geometry is not ready.
group(table) : Hero Road group.t01(number) : Normalized abscissa 0..1.- returns: vec3|nil Center.
- returns: vec3|nil Left edge.
- returns: vec3|nil Right edge.
editor_heroRoadEditor_groupMgr.deepCopyAllGroups()¶
Deep copy of the state of all groups.
- returns: table[] List of copies.
editor_heroRoadEditor_groupMgr.deepCopyGroup(group)¶
Deep copy of a group via string.buffer (encode/decode), with the derived arrays (divPoints, divWidths, tangents, binormals, normals, discMap) emptied. Used for undo snapshots.
group(table) : Group to copy.- returns: table Independent copy.
editor_heroRoadEditor_groupMgr.deserializeGroup(data, isCreateObject)¶
Deserializes a group from a string.buffer blob or a session JSON table: fills missing fields with defaults (old saves), rehydrates the layers, converts nodes/normals to vec3 and marks dirty.
data(string|table) : Encoded blob or raw table.isCreateObject(boolean|nil) : Flag passed by the caller (inferred from code).- returns: table The reconstituted group.
editor_heroRoadEditor_groupMgr.deserializeSessionGroup(gt)¶
Deserialization when loading a session: if the road is baked but its .dae files have disappeared, it is reloaded in editable mode (isEnabled = true, bakedManifest cleared).
gt(table) : Group table read from the session file.- returns: table The reconstituted group.
editor_heroRoadEditor_groupMgr.ensureCornerArray(group)¶
Aligns the sparse array group.corners (per-corner overrides, false = auto) to the number of nodes: pads with false and truncates the excess.
group(table) : Hero Road group.- returns: table The group.corners array.
editor_heroRoadEditor_groupMgr.getCurrentRoadSplineList()¶
List of enabled (Edit) roads as { name, id, type = 'Hero Road' }.
- returns: table[] Entries { name, id, type }.
editor_heroRoadEditor_groupMgr.getEditModeKey()¶
Edit mode key of the tool: 'heroRoadEditor'.
- returns: string Key.
editor_heroRoadEditor_groupMgr.getGroups()¶
Current array of all groups (live references, not a copy).
- returns: table[] List of groups.
editor_heroRoadEditor_groupMgr.getIdToIdxMap()¶
Table group id to index in getGroups().
- returns: table
Id to index map.
editor_heroRoadEditor_groupMgr.getToolPrefixStr()¶
Tool name prefix: 'Hero Road'.
- returns: string Prefix.
editor_heroRoadEditor_groupMgr.isOneWayProfile(group)¶
Indicates whether the profile is one-way (one side has zero lanes).
group(table) : Hero Road group.- returns: boolean true if lanesLeft or lanesRight is 0.
editor_heroRoadEditor_groupMgr.joinRoadSplines(groupIdx1, nodeIdx1, groupIdx2, nodeIdx2)¶
Joins two open roads into one: modifies group 1 with the joined geometry (geom.joinSplineGeometry), deletes group 2 and clears the terraform baseline. Does nothing if the indices are invalid.
groupIdx1(integer) : Index of the kept group.nodeIdx1(integer) : End node of group 1.groupIdx2(integer) : Index of the deleted group.nodeIdx2(integer) : End node of group 2.
editor_heroRoadEditor_groupMgr.junctionDefaults()¶
Default values of a new intersection (also the reset values of the sliders).
- returns: table { flareM = 4.0, lengthM = 8.0, bevelM = 2.5 }.
editor_heroRoadEditor_groupMgr.junctionExtent(j)¶
Total extent (m) of an intersection: near bevel + throat + far bevel (2*bevelM + lengthM). Used for adjustment and meshing via the correspondence with the widening.
j(table) : Intersection.- returns: number Meters.
editor_heroRoadEditor_groupMgr.pasteGroupProfile(targetGroup, profile)¶
Pastes a profile onto a group: deletes its layers, takes the profile's layers and parameters (absent values keep those of the target or the defaults), marks dirty and recreates the automatic layers.
targetGroup(table) : Target group.profile(table) : Profile returned by copyGroupProfile.
editor_heroRoadEditor_groupMgr.rebuildSurfaceOnly(group)¶
Light rebuild for groundmodel painting: redoes the mesh (mesh.updateMesh) and reloads the collision. Does nothing if the road is disabled, of terrain type, without preview or has fewer than 2 nodes.
group(table) : Hero Road group.
editor_heroRoadEditor_groupMgr.recreateAutoGeneratedLayers(group)¶
Deletes all automatic (hidden) layers then recreates those whose flag is active (tire tracks, repairs, damaged asphalt, cracks, patches, centerline, edge/lane lines, edge fades), and marks the group dirty.
group(table) : Hero Road group.
editor_heroRoadEditor_groupMgr.removeAllGroups(isIncludeDisabled)¶
Deletes all groups (isIncludeDisabled = true) or only the enabled (Edit) groups otherwise.
isIncludeDisabled(boolean) : true to include the disabled/baked roads.
editor_heroRoadEditor_groupMgr.removeBarrier(group, idx)¶
Deletes the barrier at index idx.
group(table) : Hero Road group.idx(integer) : Index.
editor_heroRoadEditor_groupMgr.removeCrossing(group, idx)¶
Deletes the crosswalk at index idx and marks the group dirty.
group(table) : Hero Road group.idx(integer) : Index.
editor_heroRoadEditor_groupMgr.removeGroup(idx)¶
Deletes the group at index idx: restores terrain paint, undoes the terraform, deletes layers, mesh, sidewalks, furniture and scene folder, then recomputes the id map.
idx(integer) : Index in getGroups().
editor_heroRoadEditor_groupMgr.removeJunction(group, idx)¶
Deletes the intersection at index idx.
group(table) : Hero Road group.idx(integer) : Index.
editor_heroRoadEditor_groupMgr.removeLinkedRoadSpline(splineId)¶
Deletes a group by its id (called from the deletion of a master spline layer).
splineId(string) : Id (uuid) of the group.
editor_heroRoadEditor_groupMgr.removePothole(group, idx)¶
Deletes the pothole at index idx.
group(table) : Hero Road group.idx(integer) : Index.
editor_heroRoadEditor_groupMgr.removeRepair(group, idx)¶
Deletes the repair patch cluster at index idx.
group(table) : Hero Road group.idx(integer) : Index.
editor_heroRoadEditor_groupMgr.removeWidening(group, idx)¶
Deletes the widening at index idx.
group(table) : Hero Road group.idx(integer) : Index.
editor_heroRoadEditor_groupMgr.serializeGroup(group)¶
Serializes a group to a string.buffer blob after emptying its derived arrays (modifies the actual group).
group(table) : Group to serialize.- returns: string Encoded blob.
editor_heroRoadEditor_groupMgr.serializeGroupToTable(group)¶
A group as a simple portable table for the session file: copy by the codec, without runtime keys, layers reduced to their author data.
group(table) : Group to export.- returns: table Exportable table (JSON).
editor_heroRoadEditor_groupMgr.setFixedWidth(group, width)¶
Sets the same width on all the group's nodes and marks it dirty. Overwritten by syncProfileWidth at the next rebuild (the lane profile is authoritative).
group(table) : Hero Road group.width(number) : Width in meters.
editor_heroRoadEditor_groupMgr.setLaneProfile(group, lanesLeft, lanesRight, laneWidthM)¶
Sets the number of lanes per side (and optionally their width), recomputes the roadway width and marks the group dirty.
group(table) : Hero Road group.lanesLeft(integer) : Lanes on the left.lanesRight(integer) : Lanes on the right.laneWidthM(number|nil) : Lane width in meters (min 1.5).
editor_heroRoadEditor_groupMgr.singleGroupEditRedo(data)¶
Redoes a change to a single group: applies the data.new state.
data(table) : History data { old, new }.
editor_heroRoadEditor_groupMgr.singleGroupEditUndo(data)¶
Undoes a change to a single group: restores the data.old state (layers, parameters, placed elements) in the group with the same id.
data(table) : History data { old, new }.
editor_heroRoadEditor_groupMgr.splitGroup(group, groupIdx, selectedNodeIdx)¶
Cuts a road at the selected node. Loop: becomes a reordered open road. Otherwise: creates two new groups '(1)' and '(2)' (new ids, corner overrides kept, terraform baseline cleared) and deletes the old one.
group(table) : Group to cut.groupIdx(integer) : Index of the group in getGroups().selectedNodeIdx(integer) : Index of the cut node.
editor_heroRoadEditor_groupMgr.syncProfileWidth(group)¶
Derives the roadway width from the lane profile: normalizes lanesLeft/lanesRight (integers >= 0, at least 1 lane in total), clamps laneWidthM to a 1.5 m minimum, sets leftExtM/rightExtM and the width of each node.
group(table) : Hero Road group.
editor_heroRoadEditor_groupMgr.tForPointOnGroup(group, p, depthM)¶
Normalized abscissa of a world point projected (in plan) onto the centerline, adjusted away from the ends. Used when dragging a handle. nil if the road has no ribbon.
group(table) : Hero Road group.p(vec3) : World point.depthM(number|nil) : Extent along the road used for the adjustment.- returns: number|nil t01 or nil.
editor_heroRoadEditor_groupMgr.transGroupEditRedo(groupsData)¶
Redoes a multi-group change (groupsData.new state).
groupsData(table) : History data { old, new }.
editor_heroRoadEditor_groupMgr.transGroupEditUndo(groupsData)¶
Undoes a change touching several groups: deletes all groups and restores the copies from groupsData.old, all marked dirty.
groupsData(table) : History data { old, new } (lists of groups).
editor_heroRoadEditor_groupMgr.updateDirtyGroups(dragging)¶
Rebuilds each group marked isDirty (and the dirty layers of the others), then marks the session as edited. Handles disabled/baked roads, groups with fewer than 2 nodes (clean everything), mesh roads, terrain roads, dragging and disabled preview. Called every frame by the editor.
dragging(boolean) : true while dragging a node/gizmo: only the ribbon edges are rebuilt.
editor_heroRoadEditor_groupMgr.wideningDefaults()¶
Default values of a new widening (also the reset values of the sliders).
- returns: table { widthM = 3.0, bayLenM = 30.0, taperInM = 40.0, taperOutM = 25.0 }.
editor_heroRoadEditor_groupMgr.wideningExtent(w)¶
Total extent (m) along the road of a widening: entry taper + bay + exit taper.
w(table) : Widening.- returns: number Meters.
Fields¶
| Field | Type | Description |
|---|---|---|
defaultCrossingDepthM |
number | Default depth (m) of a new crosswalk: 3.5. |
defaultPotholeRadiusM |
number | Default radius (m) of a new pothole: 2.0. |
defaultRepairLengthM |
number | Default length (m) of a new repair patch cluster: 8.0. |
Calls into the engine (C++)¶
Engine.generateUUIDFS:fileExistsbe:reloadCollisionscenetree.findObjectById
tim19Atlas (Tim0219800) — derived from BeamNG GmbH Lua code (bCDDL 1.1, see LICENSE). Source: lua/ge/extensions/editor/heroRoadEditor/groupMgr.lua.