CLI: sixng vehicle, a whole vehicle with the parts of a configuration as one GLB #142

Manually merged
github merged 3 commits from gh-pr/142/head into gh-pr/142/base 2026-11-26 20:13:00 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-24 12:27 UTC · original
holdmysocks:claude/vehicle-export → master · +503 −2 · 5 files · 3 commits · merged 2026-11-24 12:54 UTC

What

sixng vehicle <name> -o <file.glb> writes a whole vehicle as one GLB: its model with the parts of one of its configurations fitted, in that configuration's part colours and paint colour, with rims and tyres on the wheel bones. Until now only the viewer could put a vehicle together; the CLI gave the bare model and its parts as separate files.

  • --config N picks the configuration (default 0). --list prints the vehicle's configurations (colour, part count, parts key).
  • --no-wheels leaves the wheels out. --data <vehicles.json> uses an existing sixng vehicles file; without it the file is built first, into the output folder.
  • New core module vehexport with the same rules as the viewer: an element's model by asset id or name hash; a part at the bind pose of its bone and skinned to it; a body behind the cab first, with the bones it brings; stock triangles on replaced bones dropped; the switches of the fitted parts choose the stock alternatives; every piece takes the vehicle's part colours for the configuration.
  • The result JSON lists every piece with what fitted it, the elements left out and why.

Checked

Six vehicles exported, first configuration each, no warnings:

vehicle parts switch pieces wheels stock triangles replaced
mule flatbed, footboards, sideguards, mudflaps, aerial, plates 0 6 4,916
benson box, mudflaps, plates 0 6 7,205
towtruck tow bed, plates 0 10 4,582
declasse500 pickup bed, rear bumper, plates, intake 2 4 0
comet7 plates 1 4 0
ambulance plates 0 6 0
  • The mule and benson GLBs opened in the viewer beside the viewer's own assembly of the same configuration, same camera: body, bed or box, sideguards, mudflaps and wheels match in place and colour. (The viewer shows a plain GLB's primary paint in its own default colour, so the paint was checked by its numbers instead: the mule's 18,325 primary paint vertices hold the configuration's stored colour.)
  • The first eye check found two faults, both fixed in this PR: rims and tyres had no part colours, and the paint colour was converted from sRGB although the stored value is linear.
  • Vertex colours are present on the fitted pieces (flatbed 98 % of vertices, sideguards 100 %).
  • cargo test -p sixng-core vehexport passes (switch choice, mirrored placement).
  • An export takes 5 to 17 s with --data; building vehicles.json first adds about 80 s.

Not decoded / not done

  • The GLBs were not opened in Blender.
  • Wheels: rim and tyre are scaled alike to the collision disc's radius, so the rim's share of the wheel is the models' own, not the configuration's rim_ratio. Brake discs, drums and calipers are left out (reported under left_out).
  • A part that lists a model per chassis length is fitted on every bone the vehicle has, as in the viewer; on the mule that is three lengths of sideguard.
  • Only the parts a configuration names can be chosen; there is no free pick of single parts yet.
  • Liveries, the per-pixel palette and the wear layer are not in the GLB: the colours are one per part id.
**@⁠holdmysocks** on GitHub · 2026-11-24 12:27 UTC · [original](https://github.com/holdmysocks/SixNG/pull/142) `holdmysocks:claude/vehicle-export` → `master` · +503 −2 · 5 files · 3 commits · merged 2026-11-24 12:54 UTC ## What `sixng vehicle <name> -o <file.glb>` writes a whole vehicle as one GLB: its model with the parts of one of its configurations fitted, in that configuration's part colours and paint colour, with rims and tyres on the wheel bones. Until now only the viewer could put a vehicle together; the CLI gave the bare model and its parts as separate files. - `--config N` picks the configuration (default 0). `--list` prints the vehicle's configurations (colour, part count, parts key). - `--no-wheels` leaves the wheels out. `--data <vehicles.json>` uses an existing `sixng vehicles` file; without it the file is built first, into the output folder. - New core module `vehexport` with the same rules as the viewer: an element's model by asset id or name hash; a part at the bind pose of its bone and skinned to it; a body behind the cab first, with the bones it brings; stock triangles on replaced bones dropped; the switches of the fitted parts choose the stock alternatives; every piece takes the vehicle's part colours for the configuration. - The result JSON lists every piece with what fitted it, the elements left out and why. ## Checked Six vehicles exported, first configuration each, no warnings: | vehicle | parts | switch pieces | wheels | stock triangles replaced | |---|---|---|---|---| | mule | flatbed, footboards, sideguards, mudflaps, aerial, plates | 0 | 6 | 4,916 | | benson | box, mudflaps, plates | 0 | 6 | 7,205 | | towtruck | tow bed, plates | 0 | 10 | 4,582 | | declasse500 | pickup bed, rear bumper, plates, intake | 2 | 4 | 0 | | comet7 | plates | 1 | 4 | 0 | | ambulance | plates | 0 | 6 | 0 | - The mule and benson GLBs opened in the viewer beside the viewer's own assembly of the same configuration, same camera: body, bed or box, sideguards, mudflaps and wheels match in place and colour. (The viewer shows a plain GLB's primary paint in its own default colour, so the paint was checked by its numbers instead: the mule's 18,325 primary paint vertices hold the configuration's stored colour.) - The first eye check found two faults, both fixed in this PR: rims and tyres had no part colours, and the paint colour was converted from sRGB although the stored value is linear. - Vertex colours are present on the fitted pieces (flatbed 98 % of vertices, sideguards 100 %). - `cargo test -p sixng-core vehexport` passes (switch choice, mirrored placement). - An export takes 5 to 17 s with `--data`; building vehicles.json first adds about 80 s. ## Not decoded / not done - The GLBs were not opened in Blender. - Wheels: rim and tyre are scaled alike to the collision disc's radius, so the rim's share of the wheel is the models' own, not the configuration's `rim_ratio`. Brake discs, drums and calipers are left out (reported under `left_out`). - A part that lists a model per chassis length is fitted on every bone the vehicle has, as in the viewer; on the mule that is three lengths of sideguard. - Only the parts a configuration names can be chosen; there is no free pick of single parts yet. - Liveries, the per-pixel palette and the wear layer are not in the GLB: the colours are one per part id.
New core module vehexport: the vehicle's model with the parts of one configuration fitted (by asset id or name hash, at the bind pose of their bone, a body behind the cab first), the stock alternatives its switches choose, the configuration's part colours and paint, and rims and tyres on the wheel bones. sixng vehicle <name> -o <file.glb> [--config N] [--list] [--no-wheels] [--data vehicles.json].
Their vertices carry part ids of the vehicle they are on; the stand-in rim colour is dropped where the look gives one.
It was converted from sRGB a second time, which made the baked paint too dark.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:12:59 +00:00
github manually merged commit 23336c73aa into gh-pr/142/base 2026-11-26 20:13:00 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.