merge ws/engines
This commit is contained in:
commit
8bd15840d8
66 files changed
+31751
-1331
No files matched your search
@@ -326,6 +326,29 @@ local bin = assert(F.save(acf, nil, { format = "vdf", binary = true }))
|
||||
assert(F.data.load(bin, { format = "vdf" }).AppState.appid == "440")
|
||||
```
|
||||
|
||||
## Godot resources (.tres)
|
||||
|
||||
Godot text resources load as a table: `type` (the resource class), `format`, `uid`, `scriptClass`, `external` (the
|
||||
`ext_resource` list: `id`, `type`, `path`, `uid`), `subresources` (`id`, `type`, `properties`) and `properties` (the
|
||||
`[resource]` section, in file order). Godot values that Luau lacks are `{ type, args }` tables: `Vector3(1, 2, 3)` is
|
||||
`{ type = "Vector3", args = { 1, 2, 3 } }`, likewise `Color`, `Transform3D`, `PackedFloat32Array`, `NodePath`,
|
||||
`&"StringName"` (`type = "StringName"`), `SubResource("id")` and `ExtResource("id")`; `Object(Class, ...)` has `class`
|
||||
and its properties in `args[1]`. Godot dictionaries keep their order and may have number keys. Godot tells integers
|
||||
from floats, so integral floats read from a file (`1.0`) are written back as floats.
|
||||
`F.format("tres")` and the codec `F._internal("codecs/text/GodotVariant")` (`value`, `format`, `isCtor`, `ctor`)
|
||||
help with the values. Scenes (`.tscn`) are models: see [the scene guide](scene.md).
|
||||
|
||||
```luau
|
||||
local res = assert(F.data.load(tresText))
|
||||
assert(res.type == "StandardMaterial3D" and res.external[1].path == "res://brick.png")
|
||||
local c = res.properties.albedo_color
|
||||
assert(c.type == "Color" and c.args[1] == 0.8)
|
||||
assert(res.properties.albedo_texture.type == "ExtResource")
|
||||
res.properties.metallic = 0.5
|
||||
local text = assert(F.saveString(res, { format = "tres" }))
|
||||
assert(string.find(text, "metallic = 0.5", 1, true) and string.find(text, "roughness = 1.0", 1, true))
|
||||
```
|
||||
|
||||
## Quake III shaders and skins
|
||||
|
||||
Quake III `.shader` scripts load as a list of shaders: `{ name, directives, stages }`, each directive its tokens
|
||||
@@ -381,6 +404,7 @@ is an error there), CSV needs rows, INI needs sections of scalars, JSON has no b
|
||||
| cbor (`.cbor`) | yes | yes | values, buffers, Dates, tagged values |
|
||||
| plist (`.plist`) | XML + binary | XML | values, buffers, Dates |
|
||||
| nbt (`.nbt`, `.dat`, `.mcstructure`), snbt (`.snbt`) | yes | yes | typed values: see [Minecraft and voxels](voxel.md) |
|
||||
| tres (`.tres`) | yes | yes | Godot resources: sections, Variant values as `{ type, args }` |
|
||||
|
||||
Full capability list: [FORMATS.md](../FORMATS.md).
|
||||
|
||||
|
||||
Reference in new issue
Block a user