Repository navigation
tools: census decoded character models - #2732
Conversation
|
Reviewed The PR's own test suite fails. The description says "-> 13 tests, OK". Cause: Re-ran the tool on a copy of the test's own fixtures: The rest of the CLI, exercised on synthetic input only (hand-written
Verdict: one concrete defect (failing own test: tool/docs/test disagree on index counts); the rest of the tool behaves as described. AI-assisted review. |
|
Tested on Linux (WSL2 Ubuntu, Python 3.12) and native Windows 11 (Python 3.13.1), CPU only: fail. Merges cleanly with main. tests/test_character_census.py: Linux 12 of 13 pass, Windows 12 of 13 pass, same failure on both and at the PR head before merging: |
3d005ca to
82bdcb8
Compare
|
The failing run was against The current fixtures expect the 114-index total and the tool reports it; Please re-run against |
|
Tested
AI-assisted. |
|
Reverted on main (1b2e8ff): |
82bdcb8 to
8983eac
Compare
|
The merged head was older than the current PR head. The reverted merge
Diff vs |
Flyander
left a comment
There was a problem hiding this comment.
Checked at 8983eaca2eb774b70d53b9f495a537a2124e1e14.
python -I tests/test_character_census.py— 15 tests passed.python -I tests/test_tool_startup.py— 2 tests passed.- Synthetic malformed-hash case reproduced through
model_row(); no game data or GPU used.
One input-validation issue remains at tools/character_census.py:91: Python's int(text, 16) accepts signs and underscores, so the helper does not enforce its documented hex-string grammar. A synthetic model with shader_name_hash: "-1" and texture hash32: "+1" produces shaders: ["0x-0000001"], textures: ["0x00000001"], and issues: []. Thus malformed source values enter the census totals as hashes. Please validate string characters as hexadecimal digits before conversion and add signed/underscore cases. The current suite does not cover these forms.
|
You were right: the fixtures, not the counting, were wrong. I checked a real decoded pack tree (18 Fixed at
Evidence: The PR is open at |
The local exporter writes vertex_count and triangle_count, not index_count. Remove the invented index_count from the synthetic fixtures and expect the documented unknown index total; keep index_count optional for inputs that actually supply it.
|
Rebased onto current main (4c52ce2); the base census commit is already there as 82bdcb8, so only the schema fix remains: the decoded model.json has no index_count, fixtures expect 0 indices / 5 unknown / row None, with an optional index_count case retained. python -I tests/test_character_census.py 16 tests OK, ests/test_docs_links.py 5 OK, git diff --check clean. New head $new. |
af4a7ba to
177ecb2
Compare
|
Fixed at \698dad62. _hash\ now requires every remaining character to be a hex digit before \int(text, 16), so signs and underscores are rejected (as are \ |
|
Code read (CPU) — Linux, standard library only, no game files. Ran the head against
The index-count test changes match the tool, not a behaviour change. One nit: the new docstring paragraph names Checked and fine: the Verdict: passes, the guard is genuinely covered, no blocking issues. AI-assisted. |
Summary
Adds
tools/character_census.py, a stdlib-only census for decoded character assets.No aggregate character census existed on
main.tools/world_census.pycounts world mapresources, and
tools/skin_streams.pyis a raw per-mesh skin-stream scanner; neither reads decodedmodel.jsontrees or totals character kinds, shaders, textures and bone/skin layout.What it does
model.jsonunder a directory, a singlemodel.json, or a manifest:rpf9dump modelsmanifest (Items[]withVerts,Tris,IsFragment,HasBoneBindings,Materials[]);models[]list of model paths or inline model objects.bones, 8-influence skin state, material shader hashes and texture keys.
--json FILEand--csv FILEare optional. Report paths that alias an input (a nestedmodel.json, the manifest, or a model referenced by the manifest) are refused with exit 2,using the shared
report_paths.same_report_pathhelper (the onegamedata_xml.pyuses).rpf9dump modelsmanifest has onlyHasBoneBindings, not a bone count or influence width, sothose cells are reported as unknown (
?) rather than guessed.The decoded
model.jsonlayout read here is the one produced by the local pack exporter:type(dr/ft),vertex_count,triangle_count,materials[].shader_name_hash,materials[].textures[].hash64/hash32,drawable.skeleton,drawable.models[].bone_paletteandmeshes[].skin_influences. Amesh_blob.sectionstablecontaining slots 6/7 (
WEIGHTS_0/1) and 8/9 (JOINTS_0/1) is used as an 8-influence fallback whenmeshes[].skin_influencesis absent.Tests
tests/test_character_census.pybuilds syntheticmodel.jsonfixtures only: a skinned model, astatic model, a fragment, a field-malformed model, an unreadable model, a manifest, a
manifest-with-paths, and the report-path guard. No game data is read or written.
Verification
test_tool_startup.pyemits pre-existingResourceWarninglines from its own unclosedopen()calls; the test result above is the exact tail of its output.
(no output; exit 0)
The tool was also smoke-tested locally against a decoded model tree and an
rpf9dump modelsmanifest. Those inputs are outside the repository and are not quoted in this PR.
This change was AI-assisted. No GPU or driver was involved; the tests are CPU-only.
Not pushed.
Current head:
af4a7ba0(rebased onto mainf847748c). The fixtures now match the measured decoded model.json schema: 18 sampled files have �ertex_count/ riangle_count and no index_count. The index total is therefore unknown for decoded models; an optional index_count input is still counted and has its own test.