Scripting API

Scripting API

TextureImporter

Class in Abyss.Core, from Abyss.Core.

The engine's texture importer: an image file and its settings in, a KTX2 file out, with its mipmaps and no larger than its Max Size; and a preview of what it made.

public static class TextureImporter

Remarks

No world, and any thread. An import is a function of two files, so the editor runs as many at once as it has threads to spare, and tells the world of each as it lands (World.UseImported). A game built from the project never imports anything.

Properties

Extensions

public static IReadOnlyList<string> Extensions { get; }

The extensions of an image the engine imports as a texture, as its texture importer and Bevy's own loader decode them: PNG, JPEG, BMP, TGA and WebP.

Version

public static uint Version { get; }

The importer's version: a texture imported by any other is imported again.

Methods

IsImage

public static bool IsImage(string path)

Whether path names an image the engine imports as a texture; see TextureImporter.Extensions.

Parameters

  • path

Import

public static ImportedTexture Import(string source, ImportSettings settings, string artifact)

Imports source as settings say, into artifact.

Parameters

  • source: The image file, its whole path.
  • settings: How it is imported.
  • artifact: The KTX2 file to write, its whole path; written whole, its folder made.

Returns What it made.

Exceptions

  • AbyssException: The source cannot be read or decoded, or the artifact written; the message says which and why.
  • AbyssException: In a game's executable, which is built without what only the editor does (AbyssStatus.NotInBuiltGame).

Preview

public static TexturePreview Preview(string artifact, uint level, PreviewChannel channel, uint largest)

Mipmap level of an imported texture, as channel, no wider or taller than largest.

Parameters

  • artifact
  • level
  • channel
  • largest

Exceptions

  • AbyssException: The file cannot be read or has no such level.
  • AbyssException: In a game's executable, which is built without what only the editor does (AbyssStatus.NotInBuiltGame).

Source

public static SourcePicture Source(string source, uint largest)

The image file source as it is — not its import — no wider or taller than largest, made smaller evenly where it is larger.

Parameters

  • source
  • largest

Exceptions

  • AbyssException: The file cannot be read or decoded.
  • AbyssException: In a game's executable, which is built without what only the editor does (AbyssStatus.NotInBuiltGame).