Skip to content

ASSET-429: Select a physical model for a ped kit by archive coordinates - #5238

Open
dimaszoo wants to merge 15 commits into
ItsNotRexed:mainfrom
dimaszoo:feat/ped-kit-model-source
Open

dimaszoo wants to merge 15 commits into
ItsNotRexed:mainfrom
dimaszoo:feat/ped-kit-model-source

Conversation

@dimaszoo

@dimaszoo dimaszoo commented Nov 23, 2026 •

Copy link
Copy Markdown

Depends on: #5141
Depends on: #4763

ASSET-429 claim · Review the four changed files on top of #5141

A kit can refer to a drawable name shared by several physical models. Previously, exporting a chosen variant required building a separate parts index. Add the repeatable --model-source HASH ARCHIVE OFFSET DRAWABLE option to ped_kit_glb.py. The hash must belong to the selected kit, and all three coordinates must match a row for that hash in the same index. Without the option, an ambiguous drawable still stops the export. The docs include a query for listing candidates.

The selected model must have a ready, uniquely owned GLB and matching skin sidecar. An explicit choice also protects other indexed GLBs with the same hash if one of those files is used as the output.

Verification

  • Ran all 58 tests across the ped-kit, catalogue, skinned-GLB and GLB skinning suites, plus three text-output checks. The synthetic regressions include two geometries with the same name, a reordered index, repeated options, invalid coordinates, a shared export and attempts to overwrite a sibling source.
  • Rebuilt the SQLite index twice with the actual Add a local asset viewer and reusable parts index (ASSET-375) #4763 producer at e04cee84, changing the manifest order. The local row IDs changed. Explicit selections for two real variants yielded 8,393 and 1,087 triangles respectively. Each GLB was byte-identical across the two index builds. Both embedded images in each GLB matched the selected DDS data after decoding.
  • Tested an incorrect hash/coordinate combination, an absent offset and a wrong drawable field against an existing GLB. All three failed and preserved the output. Direct, hard-link and symbolic-link output paths to the sibling GLB were also rejected.

AI-assisted (Codex). Tested on Linux with CPU-only tools. The committed fixtures are synthetic. Only aggregate retail measurements are included above.

Pre-merge verification

The explicit model selection now uses the same index-wide output check as #5141. This also protects a model with a different hash outside the selected kit. The regression checks direct paths, symbolic links and hard links.

On upstream 3faac557, I merged #4187, #4763, #5089 (7f36e0b2), #5141 (e5ac2545) and this PR (71953110) in that order without conflicts. All 72 functional tests passed with NumPy, including the six parts-index tests. Of 20 repository checks, 19 passed. The remaining stdout check already fails on #4763 alone, and the dependency report includes the command to reproduce it. Both real colorway GLBs were byte-identical to their previous exports. Linux, CPython 3.12.14, NumPy 2.3.5.

@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested ba8e3b2 on Windows 11, CPython 3.14.7, CPU only: pass for model selection and NTFS hard-link protection. AI-assisted.

The physical-source test rebuilt the synthetic index in two orders. Each set of archive coordinates selected the same geometry and produced the same GLB bytes after the rebuild.

I also used an NTFS hard link to the unselected model as the CLI output path. The CLI rejected the output. Both source GLBs kept their original bytes. The separate symbolic-link check skipped on this machine.

I ran test_ped_kit_glb.py, test_ped_catalogues.py, test_skinned_glb.py, test_glb_skinning.py and test_text_write_line_endings.py with py -3.14 -I -B. Of 61 tests, 60 passed and one skipped. For the control I used both production Python files from the stacked parent ef94e40. The parent CLI rejected --model-source as an unknown option.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this at ba8e3b293 on Windows 11: pytest tests/test_ped_catalogues.py tests/test_ped_kit_glb.py -q -> 24 passed, 1 skipped, 38 subtests passed; git diff --check clean.

Ped kits can now select their physical model by archive coordinates, and the viewer parts index documents those coordinates; the added catalogue/GLB cases cover the coordinate selection and the fallback.

Stacking: this branch shares byte-identical ped_catalogues files with #5141 (and #5089), all by the same author, and merges cleanly with both (git merge-tree exit 0), so it is a cumulative series — land #5089, then #5141, then this; no conflict to resolve. The skip needs the game package.

@whattheflop

Copy link
Copy Markdown
Contributor

Independent AI-assisted native Windows check at ba8e3b29, using the actual #4763 e04cee84 producer. One synthetic kit had two independent ambiguous drawables: the trousers differed by archive, and the jacket differed by drawable coordinate within one archive and offset. All four explicit combinations passed for both kits (eight exports). Every exported primitive matched the selected source's index, position, normal and UV bytes, and all four embedded PNGs per export matched the expected pixels. The two jacket albedo keys share their low 32 bits. Leaving out either selector gave an ambiguity error for the remaining drawable.

The same selected kit exported byte-identically from 0DRP and PSIN. The #5141 parent ef94e40f on an unambiguous two-row index matched the corresponding explicit selection byte for byte. With a mixed-case manifest path under a directory with spaces, the actual index's lowercase slash-separated archive key resolved on Windows; the original manifest spelling did not, as expected for the documented exact-key contract. uv CPython 3.14.5, synthetic inputs and CPU only.

@kacper-serewis kacper-serewis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted independent review. Windows CPU review of ba8e3b2. All nine tests passed. Four synthetic exports distinguished same-name candidates sharing archive and offset by drawable, even after reversing insertion order. Mesh bytes, material settings and both embedded images matched the selected source. The cached window had 1,438 distinct names in 1,438 rows and no available component GLBs. It supplied name-census coverage only.

@tedin7

tedin7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Reviewed d8ce6ba (CPU, Linux, Python 3.13): no defects found

@kapitche

Copy link
Copy Markdown
Contributor

Tested d8ce6ba merged with main 561b65a on Linux (WSL2) / Python 3.12.16 and on Windows (native) / Python 3.13.1: pass

Linux: tests/test_ped_catalogues.py 17 run / 17 passed, tests/test_ped_kit_glb.py 10 / 10, plus tests/test_skinned_glb.py (OK), tests/test_ped_assemble.py (OK) and the docs tests test_docs_table_rows/links/repo_paths/cli_flags/python_deps (all OK), 0 failed. Windows (from a git archive copy of the merge): 17/17, 10/10, test_skinned_glb 24 run OK (1 skipped), test_ped_assemble 14/14, 0 failed.

Negative control: with tools/ped_catalogues.py and tools/skinned_glb.py taken from upstream/main and the PR's tests kept, test_ped_catalogues.py fails (17 run, failures=4, errors=11) and test_ped_kit_glb.py fails (10 run, failures=32 in subtests, errors=1; tools/ped_kit_glb.py and ped_kit_parts.py are new files and were left in place). Restored afterwards. I did not review the new docs numbers in docs/ped_catalogues.md against game data and did not run it on a real viewer parts index; the tests use synthetic sqlite indexes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants