Model loading · interface

ModelImport

What a reader found, before anything is oriented, welded or written.

Explained in Importing models.

interface ModelImport
import type { ModelImport } from '@driftengine/assets';

Properties

NameTypeDescription
meshesMeshData[]
warningsstring[]Caveats a person should read: an experimental reader, a missing axis convention.
notesstring[]Informational lines, worth printing and not worth worrying about.
declaredUpoptionalUpAxisWhat the file says is up, where the format says anything at all.
materialsoptionalDrftMaterial[]One per mesh, by ordinal, when the format carries materials.
substancesoptional{ material: number; substance: string; }[]Which substance each material is made of, from a glTF material's extras.substance.
More

Absent for every other format and for a glTF that labels nothing, which is the same all-or-nothing shape materials and textures have beside it. The baker writes these into the SUBS chunk; §16 of the chemistry design is why they exist.

texturesoptionalAssetReference[]Textures the model named, with bytes in hand where it carried them inline.
unitScaleoptionalnumberMetres per source unit, when the format states one. USD and FBX do; nothing else here does.
skinsoptionalreadonly DrftSkin[]Skins and clips, where the format carries them. glTF and FBX do; nothing else here does.
More

Optional, so every reader that knows nothing about rigs stays exactly as it was — the same reason materials and textures are optional beside it.

clipsoptionalreadonly AnimationClip[]
nodesoptionalreadonly DrftNode[]The asset's own hierarchy, where the format carries one. Absent for a format with none.
More

MESH stays world-space beside it, which is what makes this additive: §4.4 rule 4 says a minor version never changes the meaning of an existing byte, and moving positions into node-local space would change the meaning of every vertex in the format while leaving the bytes identical. It would also defeat rule 2, which promises that a reader skipping an optional chunk still gets a usable asset — a local-space model whose NODE was skipped draws as a heap at the origin. So a reader that skips NODE still draws the model, and one that reads it calls localiseNodes to get parts it can turn.

lightsoptionalreadonly DrftLight[]The lights the file was authored with, in world space. glTF carries them; nothing else here.
declaredHandoptionalHandednessWhich way round the source's coordinate system was. orient.ts is what acts on it.
approximationsoptionalreadonly string[]Where the reader knows its result differs from what the authoring tool would export: a node graph glTF cannot hold, animation it does not read. Drawn anyway, and named.
More

Absent for every format but .blend, whose authoring tool can be asked instead: the baker reads a non-empty list as the reason to hand the file to Blender when Blender is there.