-- tools/fixtures/_fbx_encode: run by tools/fixtures/fbx.py (luau CLI, repo root): decodes every FBX case with our -- reader and writes it back with our writer (binary 7.4, and ASCII for every third case), printing "\t" -- lines for assimp and Blender to read back. Files: rt_.fbx (binary), rt_.a.fbx (ASCII). local Fbx = require("@rosetta/model/fbx") local Bytes = require("@rosetta/core/Bytes") local Cases = require("@tests/gen/fbx_cases") local HEX = {} for i = 0, 255 do HEX[i] = string.format("%02x", i) end local function hex(b: buffer): string local out = table.create(buffer.len(b)) for i = 0, buffer.len(b) - 1 do out[i + 1] = HEX[buffer.readu8(b, i)] end return table.concat(out) end for i, c in Cases do local scene, err = Fbx.decode(Bytes.reader(buffer.fromstring(c.data)), { files = c.files, triangulate = false }) if scene then local bin, e2 = Fbx.encode(scene) if bin then print(string.format("rt_%d.fbx\t%s", i, hex(bin))) else print("encode failed " .. c.name .. ": " .. tostring(e2)) end if i % 3 == 0 then local a = Fbx.encode(scene, { ascii = true }) if a then print(string.format("rt_%d.a.fbx\t%s", i, hex(a))) end end else print("skipped " .. c.name .. ": " .. tostring(err)) end end