-- tools/fixtures/_smd_encode.luau: run by tools/fixtures/smd.py under the luau CLI: decodes the reference SMDs of -- tests/gen/smd_src and writes them back with our encoder (bind pose; links; and the animation as an animation SMD), -- printing "\t" lines for assimp to read back. local Smd = require("@rosetta/model/smd") local Bytes = require("@rosetta/core/Bytes") local Src = require("@tests/gen/smd_src") local function hex(b: buffer): string return (string.gsub(buffer.tostring(b), ".", function(c: string): string return string.format("%02x", string.byte(c)) end)) end for _, c in Src do local s = Smd.decode(Bytes.reader(buffer.fromstring(c.data))) if s then print(c.name .. "\t" .. hex(Smd.encode(s) :: buffer)) if #s.animations > 0 then print(c.name .. "-anim\t" .. hex(Smd.encode(s, { animation = 1 }) :: buffer)) end end end