ws-roblox: codecs/model/Rbx (RbxTree, typed values, CFrame rotation ids, binary property columns), model/rbxm (binary rbxm / rbxl read + write; LZ4 / Zstd / raw chunks; unknown chunks and property types round trip raw), model/rbxmx (XML rbxmx / rbxlx read + write); tests vs rojo 7.7 + lune 0.11 both ways
init.luau: KIND_CATEGORY gains rbxtree = model (F.save of an RbxTree finds the model category).
This commit is contained in:
1 parent
1ed25296ba
commit
ea9c0b36df
12 files changed
+3563
No files matched your search
@@ -0,0 +1,27 @@
|
||||
-- tools/fixtures/_rbx_encode.luau: run by tools/fixtures/rbxmx.py under the luau CLI: decodes every file of
|
||||
-- tests/gen/rbx_files (model/rbxm or model/rbxmx) and writes it back with both encoders; prints
|
||||
-- "<file>/rbxm <hex>" and "<file>/rbxmx <hex>" lines for lune to read.
|
||||
local Rbxm = require("@formats/model/rbxm")
|
||||
local Rbxmx = require("@formats/model/rbxmx")
|
||||
local Bytes = require("@formats/core/Bytes")
|
||||
local Fx = require("@tests/gen/rbx_files")
|
||||
|
||||
local function hex(b: buffer): string
|
||||
local t = table.create(buffer.len(b))
|
||||
for i = 0, buffer.len(b) - 1 do
|
||||
t[i + 1] = string.format("%02x", buffer.readu8(b, i))
|
||||
end
|
||||
return table.concat(t)
|
||||
end
|
||||
|
||||
for _, f in Fx.files do
|
||||
local fmt: any = if f.xml then Rbxmx else Rbxm
|
||||
local tree, err = fmt.decode(Bytes.reader(buffer.fromstring(f.data)))
|
||||
if not tree then
|
||||
error(f.name .. ": " .. tostring(err))
|
||||
end
|
||||
local a = assert(Rbxm.encode(tree))
|
||||
print(f.name .. "/rbxm " .. hex(a))
|
||||
local b = assert(Rbxmx.encode(tree))
|
||||
print(f.name .. "/rbxmx " .. hex(b))
|
||||
end
|
||||
Reference in new issue
Block a user