public sealed class TerrainAssetImporterImports the four assets the terrain toolset authors: a paint layer, a foliage type, a grass type and a spline.
As a importer
- Extensions
- .vxlayer .vxfoliage .vxgrass .vxspline
Remarks
The owed item [docs/plan/31] carried through four phases. T4 shipped TerrainLayerDescription and said "this is the content and the editor's form, and turning either into a file belongs with Vixen.Editor.Assets"; T5, T6 and T8 each said the same about theirs, deliberately, so that this would be one job rather than four. It is.
Its real work is validation, not conversion. These are already YAML in the engine's own dialect — NativeFormatImporter would carry any of them forward untouched. What that importer cannot do is read them: every one of these four types has a Validate() that returns the sentence explaining why it cannot be used, and running it here turns "the grass never grew" from a bug report into a message beside the file that caused it.
⚠ A refusal is an error and a suspicion is a warning, and the split is deliberate. A spline with one control point cannot be built and is an error; a foliage type with no mesh is legal — an author is part-way through — and is a warning. Failing the second would stop a build over a file somebody is in the middle of.
⚠ The document is written forward, not a compiled record. [doc 08] splits import from compile, and none of these four has a compiler yet — the runtime reads the [DataContract] graph. Emitting a binary here would put the compiler's decisions inside the importer where the artefact cache key cannot see them.
Fields and properties (5)
public const string LayerExtensionWhat a terrain paint layer is written as.
public const string FoliageExtensionWhat a foliage type is written as.
public const string GrassExtensionWhat a grass type is written as.
public const string SplineExtensionWhat a spline is written as.
public override int VersionIts 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 (2)
public static string? AliasOf(string extension)The [DataContract] alias each extension's document is recorded under.
protected override ValueTask<ImportResult> ImportAsync(ImportContext context, TerrainAssetImportSettings settings, CancellationToken cancellationToken)Imports one asset.
Used by (2)
- BuiltInImportersVixen.Editor.Assets
- TerrainAssetImporterTestsVixen.Editor.Assets.Tests