Skip to content

Class ImportSettings

Namespace: Apogee.Content.Import
Assembly: Apogee.Content.dll

What an <asset>.import.xml file next to an asset says about importing it.

public sealed record ImportSettings : IEquatable<ImportSettings>

Inheritance

object ← ImportSettings

Implements

IEquatable<ImportSettings>

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Properties

Compression

Textures: how they are stored, GPU-compressed (the default) or as RGBA8.

public TextureCompression Compression { get; init; }

Property Value

TextureCompression

Mips

Textures: build the mip chain.

public bool Mips { get; init; }

Property Value

bool

NormalMap

Textures: the image is a normal map. It is linear whatever says, and is encoded with the settings that keep normals accurate.

public bool NormalMap { get; init; }

Property Value

bool

Optimize

Models: optimize the meshes.

public bool Optimize { get; init; }

Property Value

bool

Srgb

Textures: the colors are sRGB.

public bool Srgb { get; init; }

Property Value

bool

Uid

The UID of the asset (the uid attribute), or before one was minted. It says who the asset is, not how to import it, so it is not part of the import key ().

public AssetUid Uid { get; init; }

Property Value

AssetUid

Variants

Shaders: the variants to compile besides the default one, which has no defines.

public IReadOnlyList<ShaderVariant> Variants { get; init; }

Property Value

IReadOnlyList<ShaderVariant>

Methods

KeyText(string)

The text of a sidecar as the import key sees it: the same text without the root's uid attribute, so that minting a UID into a sidecar (or into a new one) does not change the key and make the asset import again, and every key made before UIDs existed is still the one a sidecar without a UID makes.

  1. The empty text stays empty.
  2. A sidecar that says nothing but a UID (<Import uid="…"/>, which is what minting makes when there was no sidecar) is the same as no sidecar: empty. (A sidecar that already existed with no settings at all, <Import/>, keeps its own key, so adding a UID to it imports the asset once more: it says nothing, and nobody writes it.)
  3. Otherwise the uid attribute and the white space before it are taken out textually (only that attribute changes), and everything else is returned byte for byte: it is the text people wrote, and it was part of the key before UIDs existed.

Text that is not valid XML is returned as it is (reading it as settings fails on its own).

public static string KeyText(string sidecarText)

Parameters

sidecarText string

Returns

string

Parse(string, string)

Reads settings from the text of a sidecar file; origin names it in errors.

public static ImportSettings Parse(string text, string origin)

Parameters

text string

origin string

Returns

ImportSettings

Exceptions

ContentException

The file is not valid.