class
Importer
Module responsible for importing various asset types and converting them to types usable by the engine.
Public
Constructors
Importer
Methods
~Importer
Import
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).
- inputFilePath
- Pathname of the input file.
- importOptions
- (optional) Options for controlling the import. Caller must ensure import options actually match the type of the importer used for the file type.
- UUID
- Specific UUID to assign to the resource. If not specified a randomly generated UUID will be assigned.
Returns: Imported resource.
ImportAsync
Same as import(), except it imports a resource without blocking the main thread.
The resulting resource will be placed in the returned AsyncOp object when the import ends.
ImportAll
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).
- inputFilePath
- Pathname of the input file.
- importOptions
- (optional) Options for controlling the import. Caller must ensure import options actually match the type of the importer used for the file type.
Returns: A list of all imported resources. The primary resource is always the first returned resource.
ImportAllAsync
Same as importAll(), except it imports a resource without blocking the main thread.
The returned AsyncOp will contain a list of the imported resources, after the import ends.
CreateImportOptions
Automatically detects the importer needed for the provided file and returns valid type of import options for that importer.
- inputFilePath
- Pathname of the input file.
Returns: 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.
SupportsFileType
Checks if we can import a file with the specified extension.
- extension
- The extension without the leading dot.
SupportsFileType
Checks if we can import a file with the specified magic number.
- magicNumber
- The buffer containing the magic number.
- magicNumberSize
- Size of the magic number buffer.
staticInstance
Returns a reference to the module instance.
Module has to have been started up first otherwise an exception will be thrown.
staticInstancePtr
Returns a pointer to the module instance.
Module has to have been started up first otherwise an exception will be thrown.
staticShutDown
Shuts down this module and frees any resources it is using.
staticIsStarted
Query if the module has been started.
Internal
Methods
RegisterAssetImporter
Registers a new asset importer for a specific set of extensions (as determined by the implementation).
If an asset importer for one or multiple extensions already exists, it is removed and replaced with this one.
- importer
- The importer that is able to handle import of certain type of files.
ImportInternal
Alternative to import() which doesn't create a resource handle, but instead returns a raw resource pointer.
ImportAllInternal
Alternative to ImportAll() which doesn't create resource handles, but instead returns raw resource pointers.
ImportAllAsyncInternal
Alternative to ImportAllAsync() which doesn't create resource handles, but instead returns raw resource pointers.
Protected
Methods
~Module<T>
OnStartUp
Override if you want your module to be notified once it has been constructed and started.
OnShutDown
Override if you want your module to be notified just before it is deleted.
staticInstanceInternal
Returns a singleton instance of this module.
Private
Methods
GetImporterForFile
Searches available importers and attempts to find one that can import the file of the provided type.
Returns null if one cannot be found.
PrepareForImport
Prepares for import of a file at the specified path.
Returns the type of importer the file can be imported with, or null if the file isn't valid or is of unsupported type. Also creates the default set of import options unless already provided.
WaitForAsync
Checks is the specific importer currently importing something asynchronously.
If the importer doesn't support multiple threads then the method will wait until async. import completes.
Fields
mAssetImporters
mPerImporterQueues
Queues for importers having to run sequential tasks.