HammeriteModelLibrary
Core: files, names and extension. Inherits RefCounted
Where a prop's model name becomes a mesh (#87). A game says where its models are:
HammeriteModelLibrary.get_library().search_paths = ["res://models"]and adds a source of its own for any that are not imported resources - a mod's glTF files, loaded with load_gltf(). Search paths, sources, HammeriteAssetLibrary.has() and HammeriteAssetLibrary.name_of() are all on get_library(); resolve() is here only to say what it returns is a Mesh.
Methods
| Returns | Method |
|---|---|
HammeriteAssetLibrary | get_library() static |
Mesh | load_gltf(path: String) static |
Mesh | resolve(name: StringName) static |
void | set_library(value: HammeriteAssetLibrary) static |
Array | surface_arrays(mesh: Mesh) static |
Method descriptions
get_library()
static func get_library() -> HammeriteAssetLibrary
The one library of meshes every prop's model name is looked up in. Search paths try .glb, .gltf, .obj, .tscn, .scn, .tres, .res and .mesh. A scene - which is what an imported glTF is - is one mesh of every mesh in it, placed as the scene places them.
load_gltf()
static func load_gltf(path: String) -> Mesh
The model in the glTF file at path (.glb or .gltf), as one mesh: every mesh in the file with its place in the file's scene baked in, a surface each. Null when the file does not load or holds no mesh. For a file no import step has seen - one of a mod's.
resolve()
static func resolve(name: StringName) -> Mesh
The mesh get_library() finds for name, or null when it finds none or what it finds is not a Mesh.
set_library()
static func set_library(value: HammeriteAssetLibrary) -> void
Replaces get_library()'s library.
surface_arrays()
static func surface_arrays(mesh: Mesh) -> Array
Each surface's arrays of mesh, as Mesh.surface_get_arrays() gives them - but without asking the mesh, for one this library made: under Forward+ a mesh keeps no copy of its own, and asking it reads its buffers back from the GPU. A model a prop wears is asked for its corners by every prop that lays a lightmap over it and by the collider made from it, and on a dressed level that was a readback for each of 712 models.
Shared: copy an array before changing it. A mesh made elsewhere is read back once, and kept too.