AssetConverterSettings

Inherited: None

Description

The AssetConverterSettings class provides configuration and state management for asset conversion processes. It handles metadata storage, version control, and file management for converted assets.

Public Methods

TString

absoluteDestination () const

AssetConverter *

converter ()

uint32_t

currentVersion () const

TString

defaultIconPath (const TString & type)

TString

destination () const

TString

hash () const

int

icon (const TString & uuid)

bool

isCode () const

bool

isDir () const

bool

isModified () const

bool

isOutdated () const

bool

isReadOnly () const

bool

loadSettings ()

void

saveSettings ()

void

setConverter (AssetConverter * converter)

void

setCurrentVersion (uint32_t version)

void

setDirectory ()

void

setModified ()

void

setSource (const TString & source)

void

setSubItem (const TString & name, const ResourceSystem::ResourceInfo & info)

void

setSubItemData (const TString & name, const Variant & data)

void

setSubItemsDirty ()

void

setVersion (uint32_t version)

TString

source () const

ResourceSystem::ResourceInfo

subItem (const TString & key, bool create = false) const

Variant

subItemData (const TString & key) const

const StringList

subKeys () const

uint32_t

type () const

TString

typeName () const

StringList

typeNames () const

uint32_t

version () const

Static Methods

int

documentIcon (const TString & type)

void

setDefaultIconPath (const TString & type, const TString & path)

Methods Description

TString AssetConverterSettings::absoluteDestination () const

Returns the absolute destination file path.


AssetConverter * AssetConverterSettings::converter ()

Returns assotiated AssetConverter.

See also setConverter().


uint32_t AssetConverterSettings::currentVersion () const

Returns the current asset format version.

See also setCurrentVersion().


TString AssetConverterSettings::defaultIconPath (TString & type)

Returns path to default icon for asset type (default returns “:/Style/styles/dark/images/unknown.svg”).

See also setDefaultIconPath().


TString AssetConverterSettings::destination () const

Returns the destination file path (relative).


int AssetConverterSettings::documentIcon (TString & type)

Returns icon associated with document type.


TString AssetConverterSettings::hash () const

Returns the md5 checksum of the source file (formatted as a GUID-like string).


int AssetConverterSettings::icon (TString & uuid)

Returns icon assotiatited with current asset uuid.


bool AssetConverterSettings::isCode () const

Returns whether this asset represents code (default returns false).


bool AssetConverterSettings::isDir () const

Returns true if asset represents directory; otherwise returns false.


bool AssetConverterSettings::isModified () const

Returns true if import setting has been modified; otherwise return false.


bool AssetConverterSettings::isOutdated () const

Returns true if the asset needs to be reimported; otherwise returns false. This method compares asset version, file md5 checksum or file existance.


bool AssetConverterSettings::isReadOnly () const

Returns true if asset cannot be cahnged using any embedded editor; returns true by the default.


bool AssetConverterSettings::loadSettings ()

Loads asset settings from the metadata file.

This method reads the settings from a metadata file located at “[source].[ext]”, where [ext] is defined by gMetaExt (typically “set”). The metadata file contains all meta-information and import settings for an asset in the Content directory.

Returns true if settings was successfully loaded; otherwise returns false.


void AssetConverterSettings::saveSettings ()

Saves current import settings to metadata file to ([source].set) file. Serializes properties via reflection, version and hash information and stores sub items information in JSON format.


void AssetConverterSettings::setConverter (AssetConverter * converter)

Sets assotiated asset converter.

See also converter().


void AssetConverterSettings::setCurrentVersion (uint32_t version)

Sets the current asset format version.

See also currentVersion().


void AssetConverterSettings::setDefaultIconPath (TString & type, TString & path)

Adds a new path default icon for the asset type.

Note: Icon must be in SVG format.

See also defaultIconPath().


void AssetConverterSettings::setDirectory ()

Marks the asset as directory.


void AssetConverterSettings::setModified ()

Marks the asset as modified. This allows to user decide to save setting and re-import the asset or revert the settings back.

See also isModified().


void AssetConverterSettings::setSource (TString & source)

Sets the source file path.

See also source().


void AssetConverterSettings::setSubItem (TString & name, ResourceSystem::ResourceInfo & info)

Sets a sub-item with name, info.

See also subItem().


void AssetConverterSettings::setSubItemData (TString & name, Variant & data)

Sets additional data for a sub-item with given name (default does nothing).

See also subItemData().


void AssetConverterSettings::setSubItemsDirty ()

Marks all sub-items as dirty (modified).


void AssetConverterSettings::setVersion (uint32_t version)

Sets the asset converter asset format version.

See also version().


TString AssetConverterSettings::source () const

Returns the source file path.

See also setSource().


ResourceSystem::ResourceInfo AssetConverterSettings::subItem (TString & key, bool create = false) const

Returns the resource information for a sub-item identified by key.

This method retrieves the ResourceInfo associated with the given sub-item key. If the sub-item doesn’t exist and create is true, a new sub-item is created with a generated UUID and the parent’s MD5 hash.

See also setSubItem().


Variant AssetConverterSettings::subItemData (TString & key) const

Returns additional data for a sub-item by it’s key (default returns empty object).

See also setSubItemData().


const StringList AssetConverterSettings::subKeys () const

Returns list of all sub-item keys.


uint32_t AssetConverterSettings::type () const

Returns the asset type for conversion for more details see MetaType.


TString AssetConverterSettings::typeName () const

Reimplements: Object::typeName() const.

Returns primary type name (first from typeNames()).


StringList AssetConverterSettings::typeNames () const

Returns list of type names for this asset (default returns “Invalid” if type is invalid).


uint32_t AssetConverterSettings::version () const

Returns the asset converter asset format version.

See also setVersion().