Viewer: Liveries panel to place stickers on a vehicle by hand #186

Manually merged
github merged 15 commits from gh-pr/186/head into gh-pr/186/base 2026-11-26 20:16:28 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-24 17:38 UTC · original
holdmysocks:claude/livery-editor → master · +1249 −33 · 5 files · 15 commits · merged 2026-11-24 18:55 UTC

What

Third step of the custom livery editor (SIX-122): a Liveries panel in the model viewer to place stickers on the loaded vehicle by hand. It builds on PR 172 (sticker textures and zones) and PR 176 (drawing), both merged; master is merged into this branch.

With a vehicle loaded, "Liveries" in the side panel opens a floating window:

  • Add a sticker from the game's sticker textures (a picker: grid of thumbnails, search by texture id or sticker hash, filters for colour masks / pictures and for the record's shape class) or from a PNG / JPG file of your own. A game sticker that is a colour mask comes with its record's three colours.
  • Choose its panels by their sticker zones: turn on "Click panels on the model" and click the vehicle (a click adds the zone under the pointer, a second click takes it off; the zone under the pointer and the chosen zones are tinted), or tick zones in a list (zone number, the side it faces, its area). A sticker can lie on several zones of one model. Fitted parts count: the model list has the vehicle itself and every fitted part that has zones (a truck's box, a fitted bonnet).
  • Place it: "Drag it on the model" moves it under the pointer; sliders for across and down (metres from the middle of its panels), width and height (metres), rotation, mirror. Width and height are set apart, so a sticker can be stretched either way; "lock proportions" ties them, "picture's shape" undoes a stretch, and the panel shows the stretch factor. With the pointer on the model: Ctrl + wheel sizes it, Shift + wheel stretches the width, Ctrl + Shift + wheel the height, Alt + wheel turns it. A new sticker is fitted to its panels until it is first moved by hand.
  • Colours: colour mask on / off, the three mask colours or a tint, opacity.
  • The list of placed stickers: select, show / hide, move up / down (lower in the list lies on top), duplicate, delete. The header counts them against the limits: 64 stickers and 32 different pictures per vehicle. There is no limit per zone (the game's shader takes three per zone); the panel says so.
  • Save / Load / Clear: Save writes <work>/liveries/<vehicle>.json, which is read again whenever that vehicle opens. "File" saves a copy elsewhere or opens another livery file.
  • The panel also shows the six numbers the shader gets for the chosen sticker (a b c d ou ov, as the game's sticker records hold them) and the panels' metres per UV unit, for comparing with the game's layout numbers (SIX-109).

Also in this PR:

  • Decal meshes (bolts, markers, reflective strips; shader 389206d1) carry the second colour stream too, but its fourth byte is not a sticker zone there. The loader clears their zone data, so they take no stickers and a click passes through them to the wall behind.
  • A first placement is fitted to where the bulk of the chosen zones lies in UV space, not to their full UV box (a zone that is a thin frame, or has a few faces unwrapped elsewhere, would put the middle off the panel).
  • Scripted steps for checks without a mouse: --livery-panel, --livery-picker, --livery-select N, --livery-add ID[:mask], --livery-click "x,y;x,y" (clicks at fractions of the view), --livery-drag "x,y", --livery-tool zones|move, --livery-save. A scripted screenshot waits for them and for the picker's thumbnails.

Checked

All by scripted runs of the release build (clicks and the drag go through the same picking and placing code as the mouse):

  • Box truck (benson_hi with truckbeds_box_01_hi): run 1 adds a 4:1 game picture and clicks the six panels of the left box wall; the sticker ends on zones 169 to 174 of the box, fitted to the wall (3.63 m x 0.91 m), and is saved. Run 2 adds a colour mask on the same wall and drags it to the rear of the wall; saved. Run 3 adds a third and clicks the cab door; it moves to the vehicle itself, zone 24; saved. Run 4 opens the truck with no livery options: all three are back, as the saved file says. So: three stickers on different panels, two of them on the same side wall, each placed, saved and shown again after a reload.
  • Car (phoenix_hi): a picture across the front wing and the door (zones 83 and 25; it runs over the seam without a break), a mask on the rear quarter (zone 71), a mask on the fitted bonnet (its own model, zone 1). Saved, reopened, shown again.
  • Stretch: the truck's two wall stickers set to 4.3 m x 1.9 m and 0.9 m x 1.7 m from a file: both come out stretched as asked.
  • Picker: opens, reads 8,402 sticker records (first time about 20 s, then from the viewer's cache), and shows thumbnails; masks are shown in their record's colours, unreadable textures as a cross.
  • Five unit tests (cargo test -p sixng-gui livery) pass: upright and metric placement whatever the UV direction, fit, ray picking with and without boxes, metres to UV and back, file round trip.
  • cargo build --release -p sixng-cli -p sixng-gui passes without warnings.

Not decoded / not done

  • Not tried by hand with a mouse. Buttons, sliders, the drag, the wheel shortcuts, duplicate, delete, reorder, the file dialogs and "Change…" were not clicked by a person; only what the scripted steps reach is verified (add, zone clicks, drag target, save, load, the panel and picker drawing).
  • The game gives sticker records no names, so the picker is searched by id and by eye.
  • On the car, the mask on the rear quarter shows only in part: that zone's faces are spread in UV space and the first fit lands between them. It needs moving by hand. Curved panels can also shear a large sticker slightly.
  • On a roof or bonnet "up" is taken as towards the front of the vehicle; turn the sticker if it should read another way.
  • Picking uses the stored pose: with doors or bonnet opened in the Rig controls, clicks land where the panel was.
  • A sticker belongs to one model: it cannot run from the cab onto the box. Only the first two UV sets are available.
  • Pictures are read on the UI thread when first used (a short pause for a large PNG), and resampled to 1024 x 1024.
  • The game's own liveries (brands) are still not drawn (SIX-109); nothing here was calibrated against the game's layout numbers.
  • The Metal renderer (macOS, feature metal4-poc) does not draw stickers and was not built here. Read instead: it copies the viewer's vertices field by field into its own layout (vertex4), so the vertex's new zone field (PR 172) needs no change there.
  • Screenshots are not attached: they show game assets, which do not go into the repository, and the CLI cannot upload images to a PR. They were handed to the user directly.
**@⁠holdmysocks** on GitHub · 2026-11-24 17:38 UTC · [original](https://github.com/holdmysocks/SixNG/pull/186) `holdmysocks:claude/livery-editor` → `master` · +1249 −33 · 5 files · 15 commits · merged 2026-11-24 18:55 UTC ## What Third step of the custom livery editor (SIX-122): a **Liveries** panel in the model viewer to place stickers on the loaded vehicle by hand. It builds on PR 172 (sticker textures and zones) and PR 176 (drawing), both merged; master is merged into this branch. With a vehicle loaded, "Liveries" in the side panel opens a floating window: - **Add a sticker** from the game's sticker textures (a picker: grid of thumbnails, search by texture id or sticker hash, filters for colour masks / pictures and for the record's shape class) or from a PNG / JPG file of your own. A game sticker that is a colour mask comes with its record's three colours. - **Choose its panels** by their sticker zones: turn on "Click panels on the model" and click the vehicle (a click adds the zone under the pointer, a second click takes it off; the zone under the pointer and the chosen zones are tinted), or tick zones in a list (zone number, the side it faces, its area). A sticker can lie on several zones of one model. Fitted parts count: the model list has the vehicle itself and every fitted part that has zones (a truck's box, a fitted bonnet). - **Place it**: "Drag it on the model" moves it under the pointer; sliders for across and down (metres from the middle of its panels), width and height (metres), rotation, mirror. **Width and height are set apart, so a sticker can be stretched either way**; "lock proportions" ties them, "picture's shape" undoes a stretch, and the panel shows the stretch factor. With the pointer on the model: Ctrl + wheel sizes it, Shift + wheel stretches the width, Ctrl + Shift + wheel the height, Alt + wheel turns it. A new sticker is fitted to its panels until it is first moved by hand. - **Colours**: colour mask on / off, the three mask colours or a tint, opacity. - **The list** of placed stickers: select, show / hide, move up / down (lower in the list lies on top), duplicate, delete. The header counts them against the limits: 64 stickers and 32 different pictures per vehicle. There is no limit per zone (the game's shader takes three per zone); the panel says so. - **Save / Load / Clear**: Save writes `<work>/liveries/<vehicle>.json`, which is read again whenever that vehicle opens. "File" saves a copy elsewhere or opens another livery file. - The panel also shows the six numbers the shader gets for the chosen sticker (`a b c d ou ov`, as the game's sticker records hold them) and the panels' metres per UV unit, for comparing with the game's layout numbers (SIX-109). Also in this PR: - Decal meshes (bolts, markers, reflective strips; shader `389206d1`) carry the second colour stream too, but its fourth byte is not a sticker zone there. The loader clears their zone data, so they take no stickers and a click passes through them to the wall behind. - A first placement is fitted to where the bulk of the chosen zones lies in UV space, not to their full UV box (a zone that is a thin frame, or has a few faces unwrapped elsewhere, would put the middle off the panel). - Scripted steps for checks without a mouse: `--livery-panel`, `--livery-picker`, `--livery-select N`, `--livery-add ID[:mask]`, `--livery-click "x,y;x,y"` (clicks at fractions of the view), `--livery-drag "x,y"`, `--livery-tool zones|move`, `--livery-save`. A scripted screenshot waits for them and for the picker's thumbnails. ## Checked All by scripted runs of the release build (clicks and the drag go through the same picking and placing code as the mouse): - **Box truck** (`benson_hi` with `truckbeds_box_01_hi`): run 1 adds a 4:1 game picture and clicks the six panels of the left box wall; the sticker ends on zones 169 to 174 of the box, fitted to the wall (3.63 m x 0.91 m), and is saved. Run 2 adds a colour mask on the same wall and drags it to the rear of the wall; saved. Run 3 adds a third and clicks the cab door; it moves to the vehicle itself, zone 24; saved. Run 4 opens the truck with no livery options: all three are back, as the saved file says. So: three stickers on different panels, two of them on the same side wall, each placed, saved and shown again after a reload. - **Car** (`phoenix_hi`): a picture across the front wing and the door (zones 83 and 25; it runs over the seam without a break), a mask on the rear quarter (zone 71), a mask on the fitted bonnet (its own model, zone 1). Saved, reopened, shown again. - **Stretch**: the truck's two wall stickers set to 4.3 m x 1.9 m and 0.9 m x 1.7 m from a file: both come out stretched as asked. - **Picker**: opens, reads 8,402 sticker records (first time about 20 s, then from the viewer's cache), and shows thumbnails; masks are shown in their record's colours, unreadable textures as a cross. - Five unit tests (`cargo test -p sixng-gui livery`) pass: upright and metric placement whatever the UV direction, fit, ray picking with and without boxes, metres to UV and back, file round trip. - `cargo build --release -p sixng-cli -p sixng-gui` passes without warnings. ## Not decoded / not done - **Not tried by hand with a mouse.** Buttons, sliders, the drag, the wheel shortcuts, duplicate, delete, reorder, the file dialogs and "Change…" were not clicked by a person; only what the scripted steps reach is verified (add, zone clicks, drag target, save, load, the panel and picker drawing). - The game gives sticker records no names, so the picker is searched by id and by eye. - On the car, the mask on the rear quarter shows only in part: that zone's faces are spread in UV space and the first fit lands between them. It needs moving by hand. Curved panels can also shear a large sticker slightly. - On a roof or bonnet "up" is taken as towards the front of the vehicle; turn the sticker if it should read another way. - Picking uses the stored pose: with doors or bonnet opened in the Rig controls, clicks land where the panel was. - A sticker belongs to one model: it cannot run from the cab onto the box. Only the first two UV sets are available. - Pictures are read on the UI thread when first used (a short pause for a large PNG), and resampled to 1024 x 1024. - The game's own liveries (brands) are still not drawn (SIX-109); nothing here was calibrated against the game's layout numbers. - The Metal renderer (macOS, feature `metal4-poc`) does not draw stickers and was not built here. Read instead: it copies the viewer's vertices field by field into its own layout (`vertex4`), so the vertex's new zone field (PR 172) needs no change there. - Screenshots are not attached: they show game assets, which do not go into the repository, and the CLI cannot upload images to a PR. They were handed to the user directly.
Mesh stream 12 (RGBA8) was dropped. It is now decoded and written to the GLB as _COLOR1. On vehicle bodies its fourth byte is the sticker zone a livery's layout records list (box side walls, front wall, cab doors).
New core module vehstickers; sixng vehicles also writes <out>/vehicles/liveries.json. Work in progress: the layout reader is not yet checked against the game (the packs index is being rebuilt at version 6).
The layout file's groups are the elements of its root record and its field names are hashed with their capitals. Brands are counted once per vehicle.
# Conflicts:
#	crates/sixng-cli/src/main.rs
#	crates/sixng-core/src/vehstickers.rs
# Conflicts:
#	crates/sixng-gui/src/glb.rs
#	crates/sixng-gui/src/livery.rs
#	crates/sixng-gui/src/main.rs
#	crates/sixng-gui/src/model_view.rs
# Conflicts:
#	crates/sixng-gui/src/model_view.rs
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:16:27 +00:00
github manually merged commit d9d6cfa169 into gh-pr/186/base 2026-11-26 20:16:28 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.