Skip to content

v4.18.0

Choose a tag to compare

@github-actions github-actions released this 12 Nov 01:59
· 24 commits to main since this release
v4.18.0
b75d855

cleanmodels v4.18.0

Every binary model in Layonara's haks now survives decompile → compile with nothing lost, and cleanmodels check stops flagging valid models.

The round trip

Decompiling a binary and compiling the result again should give back what the game draws. Over Layonara's 13,136 binary models, v4.17.5 still lost or changed something in a few hundred. This release fixes each cause and checks it against the game's own compiler (probes in nwn-mdl-spec):

  • Vertex order and tangents (#137, #138): decompile leaves out generated tangents that a compile makes again, so the vertex order survives. Compile writes the original vertex into the face records after tangent cloning, as the game does; only the index list uses the clones.
  • Node numbering (#139): compile walks on through a supermodel node numbered -1 (such as a_ba's Cloak_g), as the game does. Before, everything below it got fresh numbers, which broke inherited animations on models like a_da.
  • Node order (#140, #143): decompile declares nodes in an order the game's compiler rebuilds, including the draw order of more than 16 siblings with transparency hints, which the game sorts unstably.
  • Merged render lists (#141): a merged mesh's donors are restored with the drawing settings, tangents and normals the game actually drew them with.
  • Remaining unstable models (#142, #143): the last tangent, degenerate-face, part-number and animation-node cases.

Compile and check

From cleanmodels check over the haks' 94,719 ASCII models (#144):

  • check no longer reports valid models, and leaves the file alone without --fix.
  • Negative smoothing groups are written signed.
  • Text after donemodel is read past, as the game does. Junk there is reported as info, and anything that looks like model data as a warning.
  • Animroot pruning: compile prunes an animation to its animroot subtree, as the game does (exact-case match among the animation's own nodes; no match keeps the whole tree), and decompile writes an animroot that rebuilds the stored tree.
  • Duplicate animations are a warning that names the copy the game plays (the first); --fix keeps that copy.
  • Decompile keeps the Latin-1 bytes of node names (such as ñ).

Result

In Layonara's haks, with every fix:

  • Round trip: of the 13,136 binary models, 1,847 come back identical and 11,289 differ only in ways that are listed and approved (runner/approvals/layonara.json in nwn-mdl-spec). 0 fail and 0 are unstable.
  • Compile: all 107,855 models (94,719 ASCII and 13,136 binary) compile, with 0 refused.

Checked

  • Each fix has Go tests that fail without it. Every fix is also ported to the Python port, where the port has that code, and its decompile, parse and compile parity tests pass, on Windows too.
  • nwn-mdl-spec's compile and decompile probes all pass.