RSX Code Reference
    Preparing search index...

    Class Importer

    Module responsible for importing various asset types and converting them to types usable by the engine.

    Index
    • Automatically detects the importer needed for the provided file and returns valid type of import options for that importer.

      Parameters

      • inputFilePath: FilePath

        Pathname of the input file.

      • OptionalrequireValidFile: boolean

        If specified, requires that the file at the inputFilePath exists on disk. Default: true.

      Returns ImportOptions

      The new import options. Null is returned if the file path is not valid, or if a valid importer cannot be found for the specified file.

      You will need to type cast the importer options to a valid type, taking into consideration exact importer you expect to be used for this file type. If you don't use a proper import options type, an exception will be thrown during import.

    • Gets a JSON object that contains information about all registered importers with the following interface:

       interface ImporterRegistrations
      {
      // Key is the name of the importer
      [key: string]: {
      developer: string;
      description?: string;
      supportedExtensions: string[];
      }
      }

      Returns JsonObject

      JsonObject (ImporterRegistrations)

    • Imports a resource at the specified location, and returns the loaded data. If file contains more than one resource only the primary resource is imported (for example an FBX a mesh would be imported, but animations ignored).

      Parameters

      • inputFilePath: FilePath

        Pathname of the input file.

      • OptionalimportOptions: Const<ImportOptions | null>

        (optional) Options for controlling the import. Caller must ensure import options actually match the type of the importer used for the file type.

      • Optionaluuid: UUID

        Specific UUID to assign to the resource. If not specified a randomly generated UUID will be assigned.

      Returns Resource

      Imported resource.

      Thread safe.

    • Imports a resource at the specified location, and returns the loaded data. 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

      • inputFilePath: FilePath

        Pathname of the input file.

      • OptionalimportOptions: Const<ImportOptions | null>

        (optional) Options for controlling the import. Caller must ensure import options actually match the type of the importer used for the file type.

      Returns MultiResource

      A list of all imported resources. The primary resource is always the first returned resource.

      Thread safe.

    • Checks if we can import a file with the specified extension.

      Parameters

      • extension: string

        The extension without the leading dot.

      Returns boolean