Skip to content

ASSET-539: Preserve extra UV sets during ped assembly - #6604

Merged
shayderrr merged 1 commit into
ItsNotRexed:mainfrom
Hiiva:fix/ped-extra-uvs-main
Nov 23, 2026
Merged

shayderrr merged 1 commit into
ItsNotRexed:mainfrom
Hiiva:fix/ped-extra-uvs-main

Conversation

@Hiiva

@Hiiva Hiiva commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

ASSET-539, claimed for extra-UV preservation and carried to coordination #6414.

Why

The existing skinned exporter preserves authored TEXCOORD_1 and higher sets, but ped assembly silently discards them during GLB import, JSON serialization and GLB export. The commands still succeed. The existing MeshPart.uvs_extra field already follows alignment, culling and vertex compaction.

Change

Connect that field to the four missing input/output paths. Extra GLB sets use the existing budgeted accessor reader and its VEC2 precheck, including sparse overrides, normalized integer components and interleaved data. JSON uses positive string set indices under uvs_extra; GLB export emits separate VEC2 attributes and checks consecutive set indices and vertex counts. Primary UVs, skin remapping and material texture-coordinate binding policy retain their existing behavior.

The glTF attribute contract defines the supported representations and set numbering. The final synthetic fixture uses four-byte aligned vertex-attribute offsets.

Validation

Windows x64, CPython 3.14.6, CPU only. All inputs are synthetic; no game files were accessed.

  • On unchanged main a284bad1e9c22881b243d618443d206331403cca, the final seven-method suite reports 11 failed subcases. With this patch all seven pass.
  • The actual skinned_glb.py producer and cull-overlap/assemble commands preserve distinct UV sets after one of two triangles is removed and vertices are compacted. Independent output decoding checks UV values, positions, both joint/weight sets and source-file preservation.
  • Tests cover all seven extra sets, normalized byte/short and interleaved attributes, sparse overrides, missing base views, repeated mesh instances, the per-file implicit-row budget and the unchanged primary-only path.
  • All 39 existing ped, sparse, malformed-GLB, material-default and JSON-texture methods pass, for 46 focused methods total. CI registration, compileall, tool and make-game help, and git diff --check pass.
  • The repository line-ending audit has one unrelated failure at tools/f64_omod_probe.py:268, reproduced on untouched main at the same revision. That writer is already covered by f64_omod_probe: pin newline="\n" when writing JSON report #6461 and is unchanged here.

Integration

This branch is based on main after #6208, #6283 and #6353 merged. The #5999 precheck is already included through #6208. New UV reads consume the existing implicit-row budget directly.

An isolated combination with the unchanged heads of #5824 (ffc26593), #6119 (0c783978), #6037 (0afc7914), #5764 (f9e2ff3e) and #6199 (82d19e3c) passes 75 methods, with published tests preserved exactly. The docs paragraph merges cleanly with #6037. Relevant source, instructions and existing fixture files are unchanged between the tested base and freshly checked main 1cc6e3c121969761d9dad8fdec99f19928213973.

AI-assisted: yes.

@kapitche

Copy link
Copy Markdown
Contributor

Tested 8281455 merged with main ab235a2 on Linux/Python 3.12.16: pass

Commands (fresh worktree of upstream/main with the PR head merged, ~/src/Leonida/.venv/bin/python -I tests/<file>):

  • tests/test_ped_extra_uvs.py -> Ran 7 tests, OK
  • every other tests/test_ped*.py, plus test_docs_cli_flags, test_docs_repo_paths, test_docs_links, test_docs_table_* and test_runner_calls_all_tests: all exit 0

Negative control: git checkout upstream/main -- tools/ped_assemble.py (new test file kept) -> the new tests fail: test_extra_implicit_rows_share_the_import_budget_across_instances (both instance counts), test_extra_indices_cannot_replace_primary_or_leave_gaps (all 5 subcases), test_import_reuses_interleaved_and_normalized_accessor_path, test_json_and_writer_preserve_all_seven_extra_sets, test_skinned_producer_cull_json_and_assemble_keep_remapped_uvs, and others in the file; restoring the PR file passes all 7.

Diff read: key validation is strict on both sides (uvs_extra keys must match [1-9][0-9]{0,8}, bools and floats are rejected by type(key) is not int, and the writer refuses gaps, so a set N cannot be written without set N-1). The docs paragraph in docs/character_models.md matches what the code does. I did not check the exported GLB in an external viewer.

@shayderrr shayderrr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary

tools/ped_assemble.py carries extra UV sets end to end: MeshPart.uvs_extra maps positive set indices to VEC2 lists, parsed and validated in _part_from_dict, serialized sorted in part_to_dict, read from TEXCOORD_n glTF attributes, and emitted back as gap-free TEXCOORD_1..n accessors with per-vertex validation. check_region now validates TEXCOORD_[1-9][0-9]* accessors as VEC2. Docs and a 312-line test file cover the round trip and rejection of gaps or bad keys (ASSET-539).

Why merge

Previously extra texture-coordinate sets were silently dropped during ped assembly, losing material data from character models.

Verdict: Approve

@shayderrr

Copy link
Copy Markdown
Collaborator

Summary

tools/ped_assemble.py carries extra UV sets end to end: MeshPart.uvs_extra maps positive set indices to VEC2 lists, parsed and validated in _part_from_dict, serialized sorted in part_to_dict, read from TEXCOORD_n glTF attributes, and emitted back as gap-free TEXCOORD_1..n accessors with per-vertex validation. check_region now validates TEXCOORD_[1-9][0-9]* accessors as VEC2. Docs and a 312-line test file cover the round trip and rejection of gaps or bad keys (ASSET-539).

Why merge

Previously extra texture-coordinate sets were silently dropped during ped assembly, losing material data from character models.

Verdict: Approve

@shayderrr
shayderrr merged commit 603d53e into ItsNotRexed:main Nov 23, 2026
0 of 2 checks passed
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.

3 participants