class
BuiltinResourcesHelper
Provides various methods commonly used for managing builtin resources.
Public
Methods
staticImportAssets
Iterates over all entires in the provided json file, imports the files linked by the entries them and stores them in the corresponding folder.
Also registers the imported files in the provided manifest.
- entries
- JSON array containing the entries to parse, with each entry containing data determine by set ImportMode.
- importFlags
- A set of import flags (one for each entry) that specify which entries need to be imported.
- inputFolder
- Folder in which to look for the input files.
- outputFolder
- Folder in which to store the imported resources.
- mode
- Mode that controls how are files imported.
- compress
- True if the imported asset should be compressed when saved to the disk.
- mipmap
- True if mipmaps should be generated.
staticImportFont
Imports a font from the specified file.
Imported font assets are saved in the output folder. All saved resources are registered in the provided resource manifest.
staticGenerateImportFlags
Iterates over all the provided entries and generates a list of flags that determine should the asset be imported or not.
This is done by comparing file modification dates with the last update time and/or checking if any dependencies require import.
- entries
- JSON array containing entries to iterate over.
- inputFolder
- Folder in which to look for the input files.
- lastUpdateTime
- Timestamp of when the last asset import occurred.
- forceImport
- If true, all entries will be marked for import.
- dependencies
- Optional map of entries that map each entry in the array, to a list of dependencies. The dependencies will then also be checked for modifications and if modified the entry will be marked for reimport.
- dependencyFolder
- Folder in which dependeny files reside. Only relevant if is provided.
Returns: An array of the same size as the array, containing value true if an asset should be imported, or false otherwise.
staticUpdateJson
Scans the provided folder for any files that are currently not part of the provided JSON entries.
If some are found they are appended to the JSON entry array. Returns true if any new files were found, false otherwise.
- folder
- Folder to check for new entries.
- type
- Type of entries in the folder. Determines the type of JSON data generated.
- entries
- Current data file entries.
staticWriteTimestamp
Writes a timestamp with the current date and time in the specified file.
staticCheckForModifications
Checks all files in the specified folder for modifications compared to the time stored in the timestamp file.
Timestamp file must have been saved using writeTimestamp(). Returns 0 if no changes, 1 if timestamp is out date, or 2 if timestamp doesn't exist. will contain the time stored in the timestamp, if it exist.