AssetConverter¶
Inherited: None
Description¶
The AssetConverter class is an abstract base class that provides an interface for converting assets in the engine. It’s designed to be subclassed for specific asset types that require conversion or processing.
Example:
class TextureConverter : public AssetConverter {
public:
QStringList suffixes() const override {
return {"png", "jpg", "tga"};
}
ReturnCode convertFile(AssetConverterSettings *settings) override {
// Conversion logic here
return Success;
}
AssetConverterSettings *createSettings() override {
return new TextureSettings();
}
};
Public Methods¶
convertFile (AssetConverterSettings * settings) |
|
Actor * |
createActor (const AssetConverterSettings * settings, const TString & guid) const |
void |
createFromTemplate (const TString & destination) |
void |
init () |
void |
renameAsset (AssetConverterSettings * settings, const TString & oldName, const TString & newName) |
StringList |
suffixes () const |
templatePath () const |
Public Enums¶
enum AssetConverter::ReturnCode
Constant |
Value |
Description |
AssetConverter::Success |
0 |
Conversion completed successfully |
AssetConverter::InternalError |
1 |
An unexpected error occurred during conversion |
AssetConverter::Unsupported |
2 |
The asset type is not supported by this converter |
AssetConverter::Skipped |
3 |
Conversion was intentionally skipped |
Static Methods¶
None
Methods Description¶
AssetConverter::ReturnCode AssetConverter::convertFile (AssetConverterSettings * settings)
Converts a file using the provided settings.
Actor * AssetConverter::createActor (AssetConverterSettings * settings, TString & guid) const
Creates an actor with appropriate component using this asset using settings and asset guid.
void AssetConverter::createFromTemplate (TString & destination)
Creates a new asset file from template and copies it by destination path.
AssetConverterSettings * AssetConverter::createSettings ()
Creates a new settings object appropriate for this converter type.
void AssetConverter::init ()
Initializes the converter. Can be overridden to perform any necessary setup.
void AssetConverter::renameAsset (AssetConverterSettings * settings, TString & oldName, TString & newName)
Handles asset renaming to react on asset change the oldName to newName (e.g. for code renaming) for the particaular asset settings.
StringList AssetConverter::suffixes () const
Returns the list of file suffixes (extensions) this converter supports (e.g., [“png”, “jpg”] for an image converter).
TString AssetConverter::templatePath () const
Returns the path to a template file for creating new assets of this type.