API ReferenceGE Extensionseditorgenlib
Gen JBeam Library
JBeam file parsing library for the gen editor's mesh and vehicle inspection tools.
JBeam file parsing library for the gen editor's mesh and vehicle inspection tools.
Overview
The jbeam library parses JBeam vehicle definition files and extracts beam groups, nodes, and their physical properties (spring, damping, deformation, strength). It organizes beams into groups based on property changes and provides structured data for the mesh explorer.
Module Table: M
| Field | Type | Description |
|---|
Functions
| Function | Signature | Description |
|---|---|---|
M.fileUp(file, nm, dbg) | (string, string?, boolean?) → table? | Parses a JBeam file. If nm given, extracts that part's beams into grouped structure |
Parsed Data Structure
When nm (part name) is provided, returns:
Beam Groups (dgroup)
Each group key is a stamp of strength*deform*spring*damp:
| Field | Type | Description |
|---|---|---|
list | table | Array of beam entries {node1, node2} |
key | number | Group sequential index |
strength | number | Beam break strength (FLT_MAX → math.huge) |
spring | number | Spring constant |
deform | number | Deformation threshold |
damp | number | Damping coefficient |
dparam | table | Additional parameters from JBeam headers |
Part Data
| Field | Type | Description |
|---|---|---|
abeam | table | All beams in the part |
anode | table | All nodes in the part |
Dependencies
| Module | Path |
|---|---|
| Utils | /lua/ge/extensions/editor/gen/utils |
| jbeam/io | jbeam/io |
| jbeam/tableSchema | jbeam/tableSchema |
Usage Example
local J = require('/lua/ge/extensions/editor/gen/lib/jbeam')
-- Parse a JBeam file and extract beam groups for a specific part
local data = J.fileUp('/vehicles/pickup/pickup.jbeam', 'pickup_chassis')
-- data contains grouped beams by physical properties
-- Access beam groups:
for stamp, group in pairs(data.dgroup) do
print(stamp, #group.list, "beams, spring:", group.spring)
endAll Exported Functions
| Function | Signature | Description |
|---|---|---|
M.fileUp(file, nm, dbg) | (string, string?, boolean?) → table? | Parses JBeam file. If nm provided, extracts that part's beams into grouped structure with dgroup |
M.part2file() | () → table | Maps all active vehicle parts to their JBeam source files. Returns dict {partName → {name, file, abeam, amesh}} using player vehicle data and jbeamIO |
See Also
- Gen Mesh Explorer - Uses JBeam lib for vehicle inspection
- Gen Mesh - 3D mesh creation