Dependency Tree
Analyzes level asset dependencies by walking scene objects and building a dependency graph of files, textures, materials, shapes, and SimObjects.
Analyzes level asset dependencies by walking scene objects and building a dependency graph of files, textures, materials, shapes, and SimObjects.
Overview
util_dependencyTree scans .level.json, .material.json, and .datablock.json files for a target level folder, then recursively inspects each SimObject for its dependencies (textures, materials, shapes, files) and what it provides (named objects, materials). Outputs the tree as dependencytree.json.
Extension path: lua/ge/extensions/util/dependencyTree.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
test | () | Runs the dependency analysis on the configured folder. |
Internals
Target Folder
Hardcoded to levels/gridmap. Change folder local variable to analyze other levels.
Dependency Categories
Each entity tracks:
deps: What it depends on - categories:file,tex,material,shape,simobjectprovides: What it makes available - categories:simobject,material,shape
Supported Object Classes
| Class | Dependencies Extracted |
|---|---|
TSStatic | shapeName |
BeamNGVehicle | JBeam, partConfig |
DecalRoad | material |
MeshRoad | topMaterial, bottomMaterial, sideMaterial |
River / WaterPlane | textures (ripple, foam, depthGradient), soundAmbience |
ScatterSky | gradient textures, moonMat, nightCubemap |
Forest | forest data file items |
ForestItemData | shapeFile |
Material | All stage textures (diffuse, normal, specular, etc.), cubemap |
GroundCover | material, shapeFilename |
ParticleData/Emitter | textures, particles |
ConvexShape / GroundPlane | material |
LevelInfo | globalEnviromentMap |
Shape Info Processing
After scene objects, .meshes.json files are also scanned. Each shape's materials become dependencies, and the shape file itself is registered as a provides.
Path Normalization
File paths in dependencies are normalized relative to the source file's directory. Shape and texture extensions are stripped for consistent matching.
How It Works
- Call
test()to run the analysis. - All
.level.json,.material.json, and.datablock.jsonfiles in the folder are parsed. - Each SimObject is recursively inspected for dependencies.
- Shape info files (
.meshes.json) add material dependencies. - Results are written to
dependencytree.json.
Lua Examples
-- Run dependency analysis on the default folder (gridmap)
extensions.util_dependencyTree.test()
-- Output: dependencytree.json containing entities with deps/providesAdditional Exports
M.test- (undocumented)
Decal Roads Editor
Debug visualization for AIPath objects in the world editor. Renders lane markings, widths, and directions using dynamic decals and debug drawing.
Doc Creator
Generates JSON data files and resources for the BeamNG documentation / Hugo system. Exports levels, vehicles, materials, JBeam defaults, controller info, and more across all available languages.