model_import

Writes a model edited in Blender back as the game’s files: the glTF’s meshes put into the original .msh in place of their chunks (matched by the custom properties model_export wrote, else by name), each vertex where the glTF has it at rest, with its normal, tangent and binormal, texture coordinates and its bones by name, and the .mmh with each mesh node’s bones and material made to match and its bounding boxes made again. Vertices and triangles may be added, moved or removed. A mesh that is none of the model’s chunks, or a copy of one (Blender’s duplicate), is added as a new chunk under a new mesh node like the one it was copied from (else the first), with the glTF’s material. A joint that is none of the model’s bones is added as a new bone under the nearest node above it, where the glTF has it at rest; no animation moves it, so it follows its parent. A mesh weighted to more than 67 bones (the most the game’s skinning shaders take for one chunk) is split into chunks of at most 67, the rest under new mesh nodes like its own. Blender splits vertices at seams; where the vertices still say their place (_DAO_INDEX) and none were added or removed, they are joined back into the chunk’s own vertices, order and triangles, each value the original’s where it is unedited, so a mesh through Blender unedited comes back as it was and a head’s morphs still fit; otherwise Blender’s layout is kept (notes says which). Bone moves and textures are not taken. Answers each chunk’s counts before and after, the files written, notes, and where to put the files for the game to take them. Writes nothing in the game’s folders.

Arguments

Name Type Required What
name string yes The model the glTF was made from, its hierarchy (.mmh): the one model_export wrote it from. Its files are the base the meshes are written into.
source string   Which copy of the .mmh, by its source (“core”, “addin:…”). Default: the copy the game takes. Its mesh file is always the game’s copy.
archive string   Which copy of the .mmh, by its archive’s path.
gltf string yes The edited model, a .gltf (with its .bin beside it) or .glb, full path. Export from Blender with export_extras=True, so each mesh still says its chunk, and export_attributes=True, so each vertex still says its place in it (_DAO_INDEX).
to string yes The folder to write the .msh and .mmh into, a full path; made if missing. Never inside the game’s folder.

Call it as model_import over MCP, or from a shell as ghilana.exe --call model_import '<arguments as JSON>'.