Vixen
dd8b0a81
csharp
public sealed class NativeFormatImporter

Imports an asset Vixen itself authored: a material, a scene, a prefab, a group.

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

As a importer

Extensions
.vxgroup .vxinput

Remarks

Its real job is the dependency graph, not the conversion. There is nothing to convert — the file is already in the engine's own format, which is the whole point of [doc 08](../../docs/plan/08-asset-pipeline-and-addressables.md)'s YAML dialect. What is not already known is what the file points at, and that is what makes a material re-import when the texture it names is replaced. So this walks the document, finds every vx: scalar, and declares each one.

A reference that does not parse fails the import. A scalar beginning vx: was meant to be a reference by whoever wrote it; if the GUID after it is malformed, the alternatives are failing here — naming the file and the text — or shipping an asset whose pointer resolves to nothing on a player's machine. Anything that does not begin with the prefix is left alone, because a string field holding arbitrary text is ordinary.

What it writes is the document, and that is a deliberate stopping point. Doc 08 splits import from compile: import produces editor-domain objects, and the compiler turns them into the runtime chunks a player loads. Emitting a half-resolved binary here would put the compiler's decisions inside the importer, where the artefact cache key cannot see them; carrying the document forward keeps the seam where the plan puts it.

.vxscene, .vxprefab, .vxmat, .vxvfx and now .vxanim are no longer among them, and each took the same shape: SceneImporter, MaterialImporter and AnimationClipImporter read the same document, declare the same references through the same scan, and write a compiled asset rather than the text. What is left here are the formats whose compiler genuinely has nothing to do — a group, an input map — and nothing whose compiler is still owed.

⚠ Which is why the artefact's type is one of exactly two names, and never the document's own tag. This used to claim a third extension, .vxasset, and to write the text under whatever type the document tagged itself: !PhysicsMaterial produced a chunk labelled PhysicsMaterial whose bytes were YAML. That is the .vxgrass bug with the file renamed — see TerrainAssetImporter.WriteGrass, where the fix was to write the record the runtime reader actually opens, because a game does not link the YAML dialect. There is no way to write the right bytes for a type named by a tag, since which reader opens them is not known until a game asks; a self-describing payload does not help either, because DefinitionImporter's framing works only where one reader unwraps every artefact of one type, and here no reader exists at all. So a file that is not a group or an input map is no longer this importer's, and falls to RawImporter — where it becomes a Blob, which is a name no typed reader resolves and therefore a mismatch the asset manager throws about, rather than a deserializer quietly reading YAML as a record.

Fields and properties (1)

  • public override int Version

    Its own version. Bumping it invalidates every artefact it has ever produced, which is the whole mechanism for "I fixed the mip filter, re-import everything".

Methods (1)

Used by (2)

  • BuiltInImportersVixen.Editor.Assets
  • NativeFormatImporterTestsVixen.Editor.Assets.Tests