Class TypeScriptImporter<ImportOptionsType>Abstract

Allows implementing resource importes from TypeScript code.

Type Parameters

  • ImportOptionsType extends object = object

Hierarchy

  • FrameworkObject
    • TypeScriptImporter

Constructors

Methods

  • Virtual

    Check is the provided extension supported by this importer.

    Parameters

    • extension: string

    Returns boolean

    Provided extension should be without the leading dot.

  • Virtual

    Check if the provided magic number is supported by this importer.

    Parameters

    • magicNumbers: number[]

    Returns boolean

  • Virtual

    Creates import options specific for this importer. Import options are provided when calling onImport to customize the import, and provide additional information.

    Returns ImportOptionsType

  • Virtual

    Imports the given file. If file contains more than one resource only the primary resource is imported (for example for an FBX a mesh would be imported, but animations ignored).

    Parameters

    • sourceData: DataStream

      The data of the source file to import from.

    • filePath: FilePath

      Pathname of the file, with file extension.

    • importProgress: TaskProgress

      The operation progress.

    • importOptions: ImportOptionsType

      Options that can control how is the resource imported.

    • filePeekInformation: ImportFileInformation

      Optional import information cache in case the file was peeked before importing.

    Returns Promise<ImportedSubResource>

    A resource import result containing the resource or an error message.

  • Virtual

    Imports the given file. This method returns all imported resources, which is relevant for files that can contain multiple resources (for example an FBX which may contain both a mesh and animations).

    Parameters

    • sourceData: DataStream

      The data of the source file to import from.

    • filePath: FilePath

      Pathname of the file, with file extension.

    • importProgress: TaskProgress

      The operation progress.

    • importOptions: ImportOptionsType

      Options that can control how are the resources imported.

    • OptionalfilePeekInformation: ImportFileInformation

      Optional import information cache in case the file was peeked before importing.

    Returns Promise<ImportedSubResource[]>

    An array of imported resource, that might be successful of have failed. First element is always the primary resource.