Vixen
02b45cc4
csharp
public sealed class ModelImporter

Turns a model an artist exported into the chunks a build packs.

No guide page documents this yet — the page shows what the code says about itself.

As a importer

Extensions
.fbx .gltf .glb .obj .dae .3ds .ply .stl .blend

Remarks

The first importer that produces more than one thing. A model is a model, and also a mesh per material, a skeleton and a clip per animation — and each of those is separately addressable, separately deduplicated by the object database, and separately loadable. BuildPlanner gives each an address under its owner's (characters/hero, characters/hero#Hero_Body), which is the machinery this is the first real consumer of.

The parts are named, not numbered. An exporter that reorders its meshes — which happens whenever an artist re-exports after adding a material — would break every reference that had been stored by position. A sub-asset id is derived from the name, so renaming a mesh breaks a reference and reordering does not, which is the trade worth making.

Reading is ModelReader's job and this is the plumbing. The split is so that the conversion — where every decision and every way to be wrong lives — is testable against a file with no import context in the way.

Fields and properties (5)

  • public override int Version
  • public const string ClusterKind

    What the sub-asset holding a mesh's hierarchy and page records is called.

  • public const string ClusterPageKind

    What the sub-asset holding a mesh's page blob is called.

  • public const string MeshType

    The chunk type a mesh artefact is recorded as.

  • public const string DistanceFieldType

    The chunk type a signed-distance-field artefact is recorded as.

Methods (4)

  • public static string ClusterName(string mesh)

    What a mesh's cluster sub-asset is named, which is what its address is built from.

  • public static string PageName(string mesh)

    What a mesh's page-blob sub-asset is named.

  • public static string FieldName(string mesh)

    What a mesh's signed-distance-field sub-asset is named.

  • protected override ValueTask<ImportResult> ImportAsync(ImportContext context, ModelImportSettings settings, CancellationToken cancellationToken)

    Imports one asset.

Used by (3)

  • BuiltInImportersVixen.Editor.Assets
  • ImportedGeometryLoadsTestsVixen.Editor.Assets.Tests
  • ModelImporterTestsVixen.Editor.Assets.Tests