XII Release 0.1.0
Loading...
Searching...
No Matches
xiiAssetCurator Class Reference

Public Member Functions

Setup
void StartInitialize (const xiiApplicationFileSystemConfig &cfg)
 Starts init task. Need to call WaitForInitialize to finish before loading docs.
 
void WaitForInitialize ()
 Waits for init task to finish.
 
void Deinitialize ()
 
void MainThreadTick (bool bTopLevel)
 
High Level Functions
xiiDateTime GetLastFullTransformDate () const
 
void StoreFullTransformDate ()
 
xiiStatus TransformAllAssets (xiiBitflags< xiiTransformFlags > transformFlags, const xiiPlatformProfile *pAssetProfile=nullptr)
 Transforms all assets and writes the lookup tables. If the given platform is empty, the active platform is used.
 
xiiTransformStatus TransformAsset (const xiiUuid &assetGuid, xiiBitflags< xiiTransformFlags > transformFlags, const xiiPlatformProfile *pAssetProfile=nullptr)
 
xiiTransformStatus CreateThumbnail (const xiiUuid &assetGuid)
 
void ResaveAllAssets (xiiStringView sPrefixPath)
 
void TransformAssetsForSceneExport (const xiiPlatformProfile *pAssetProfile=nullptr)
 
xiiResult WriteAssetTables (const xiiPlatformProfile *pAssetProfile=nullptr, bool bForce=false)
 Writes the asset lookup table for the given platform, or the currently active platform if nullptr is passed.
 
Manual and Automatic Change Notification
void NotifyOfFileChange (xiiStringView sAbsolutePath)
 Allows to tell the system of a new or changed file, that might be of interest to the Curator.
 
void NotifyOfAssetChange (const xiiUuid &assetGuid)
 Allows to tell the system to re-evaluate an assets status.
 
void UpdateAssetLastAccessTime (const xiiUuid &assetGuid)
 
void CheckFileSystem ()
 Checks file system for any changes. Call in case the file system watcher does not pick up certain changes.
 
void NeedsReloadResources (const xiiUuid &assetGuid)
 
void InvalidateAssetsWithTransformState (xiiAssetInfo::TransformState state)
 
Utilities
void GenerateTransitiveHull (const xiiStringView sAssetOrPath, xiiSet< xiiString > &inout_deps, bool bIncludeTransformDeps=false, bool bIncludeThumbnailDeps=false, bool bIncludePackageDeps=false) const
 Generates one transitive hull for all the dependencies that are enabled. The set will contain dependencies that are reachable via any combination of enabled reference types.
 
void GenerateInverseTransitiveHull (const xiiAssetInfo *pAssetInfo, xiiSet< xiiUuid > &inout_inverseDeps, bool bIncludeTransformDeps=false, bool bIncludeThumbnailDeps=false) const
 Generates one inverse transitive hull for all the types dependencies that are enabled. The set will contain inverse dependencies that can reach the given asset (pAssetInfo) via any combination of the enabled reference types. As only assets can have dependencies, the inverse hull is always just asset GUIDs.
 
void WriteDependencyDGML (const xiiUuid &guid, xiiStringView sOutputFile) const
 Generates a DGML graph of all transform and thumbnail dependencies.
 
void ClearAssetCaches (xiiAssetDocumentManager::OutputReliability threshold)
 Deletes all files in all asset caches, except for the asset outputs that exceed the threshold.
 

Public Attributes

xiiEvent< const xiiAssetCuratorEvent & > m_Events
 

Friends

class xiiUpdateTask
 
class xiiAssetProcessor
 
class xiiProcessTask
 

Asset Access

using xiiLockedSubAsset = xiiLockedObject<xiiMutex, const xiiSubAsset>
 
using xiiLockedSubAssetTable = xiiLockedObject<xiiMutex, const xiiHashTable<xiiUuid, xiiSubAsset>>
 
using xiiLockedAssetTable = xiiLockedObject<xiiMutex, const xiiHashTable<xiiUuid, xiiAssetInfo*>>
 
const xiiLockedSubAsset FindSubAsset (xiiStringView sPathOrGuid, bool bExhaustiveSearch=false) const
 Tries to find the asset information for an asset identified through a string.
 
const xiiLockedSubAsset GetSubAsset (const xiiUuid &assetGuid) const
 Same as GetAssteInfo, but wraps the return value into a xiiLockedSubAsset struct.
 
const xiiLockedSubAssetTable GetKnownSubAssets () const
 Returns the table of all known assets in a locked structure.
 
const xiiLockedAssetTable GetKnownAssets () const
 Returns the table of all known assets in a locked structure.
 
xiiUInt64 GetAssetDependencyHash (xiiUuid assetGuid)
 Computes the combined hash for the asset and its dependencies. Returns 0 if anything went wrong.
 
xiiUInt64 GetAssetReferenceHash (xiiUuid assetGuid)
 Computes the combined hash for the asset and its references. Returns 0 if anything went wrong.
 
xiiAssetInfo::TransformState IsAssetUpToDate (const xiiUuid &assetGuid, const xiiPlatformProfile *pAssetProfile, const xiiAssetDocumentTypeDescriptor *pTypeDescriptor, xiiUInt64 &out_uiAssetHash, xiiUInt64 &out_uiThumbHash, xiiUInt64 &out_uiPackageHash, bool bForce=false)
 
void GetAssetTransformStats (xiiUInt32 &out_uiNumAssets, xiiHybridArray< xiiUInt32, xiiAssetInfo::TransformState::COUNT > &out_count)
 Returns the number of assets in the system and how many are in what transform state.
 
xiiString FindDataDirectoryForAsset (xiiStringView sAbsoluteAssetPath) const
 Iterates over all known data directories and returns the absolute path to the directory in which this asset is located.
 
xiiResult FindBestMatchForFile (xiiStringBuilder &ref_sFile, xiiArrayPtr< xiiString > allowedFileExtensions) const
 Uses knowledge about all existing files on disk to find the best match for a file. Very slow.
 
void FindAllUses (xiiUuid assetGuid, xiiSet< xiiUuid > &ref_uses, bool bTransitive) const
 Finds all uses, either as references or dependencies to a given asset.
 
void FindAllUses (xiiStringView sAbsolutePath, xiiSet< xiiUuid > &ref_uses) const
 Returns all assets that use a file for transform. Use this to e.g. figure which assets still reference a .tga file in the project.
 
bool IsReferenced (xiiStringView sAbsolutePath) const
 Returns whether a file is referenced, i.e. used for transforming an asset. Use this to e.g. figure out whether a .tga file is still in use by any asset.
 

Asset Platform Configurations

const xiiPlatformProfileGetDevelopmentAssetProfile () const
 The main platform on which development happens. E.g. "Default".
 
const xiiPlatformProfileGetActiveAssetProfile () const
 The currently active target platform for asset processing.
 
xiiUInt32 GetActiveAssetProfileIndex () const
 Returns the index of the currently active asset platform configuration.
 
xiiUInt32 FindAssetProfileByName (const char *szPlatform)
 Returns xiiInvalidIndex if no config with the given name exists. Name comparison is case insensitive.
 
xiiUInt32 GetNumAssetProfiles () const
 
const xiiPlatformProfileGetAssetProfile (xiiUInt32 uiIndex) const
 Always returns a valid config. E.g. even if xiiInvalidIndex is passed in, it will fall back to the default config (at index 0).
 
xiiPlatformProfileGetAssetProfile (xiiUInt32 uiIndex)
 Always returns a valid config. E.g. even if xiiInvalidIndex is passed in, it will fall back to the default config (at index 0).
 
xiiPlatformProfileCreateAssetProfile ()
 Adds a new profile. The name should be set afterwards to a unique name.
 
xiiResult DeleteAssetProfile (xiiPlatformProfile *pProfile)
 Deletes the given asset profile, if possible.
 
void SetActiveAssetProfileByIndex (xiiUInt32 uiIndex, bool bForceReevaluation=false)
 Switches the currently active asset target platform.
 
xiiResult SaveAssetProfiles ()
 Saves the current asset configurations. Returns failure if the output file could not be written to.
 
void SaveRuntimeProfiles ()
 

Member Function Documentation

◆ ClearAssetCaches()

void xiiAssetCurator::ClearAssetCaches ( xiiAssetDocumentManager::OutputReliability threshold)

Deletes all files in all asset caches, except for the asset outputs that exceed the threshold.

-> OutputReliability::Perfect -> deletes everything -> OutputReliability::Good -> keeps the 'Perfect' files -> OutputReliability::Unknown -> keeps the 'Good' and 'Perfect' files

◆ DeleteAssetProfile()

xiiResult xiiAssetCurator::DeleteAssetProfile ( xiiPlatformProfile * pProfile)

Deletes the given asset profile, if possible.

The function fails when the given profile is the main profile (at index 0), or it is the currently active profile.

◆ FindAllUses() [1/2]

void xiiAssetCurator::FindAllUses ( xiiStringView sAbsolutePath,
xiiSet< xiiUuid > & ref_uses ) const

Returns all assets that use a file for transform. Use this to e.g. figure which assets still reference a .tga file in the project.

Parameters
sAbsolutePathAbsolute path to any file inside a data directory.
ref_usesList of assets that use 'sAbsolutePath'. Any previous content of the set is not removed.

◆ FindAllUses() [2/2]

void xiiAssetCurator::FindAllUses ( xiiUuid assetGuid,
xiiSet< xiiUuid > & ref_uses,
bool bTransitive ) const

Finds all uses, either as references or dependencies to a given asset.

Technically this finds all references and dependencies to this asset but in practice there are no uses of transform dependencies between assets right now so the result is a list of references and can be referred to as such.

Parameters
assetGuidThe asset to find use cases for.
usesList of assets that use 'assetGuid'. Any previous content of the set is not removed.
transitiveIf set, will also find indirect uses of the asset.

◆ FindBestMatchForFile()

xiiResult xiiAssetCurator::FindBestMatchForFile ( xiiStringBuilder & ref_sFile,
xiiArrayPtr< xiiString > allowedFileExtensions ) const

Uses knowledge about all existing files on disk to find the best match for a file. Very slow.

Parameters
sFileFile name (may include a path) to search for. Will be modified both on success and failure to give a 'reasonable' result.

◆ FindSubAsset()

const xiiAssetCurator::xiiLockedSubAsset xiiAssetCurator::FindSubAsset ( xiiStringView sPathOrGuid,
bool bExhaustiveSearch = false ) const

Tries to find the asset information for an asset identified through a string.

The string may be a stringyfied asset GUID or a relative or absolute path. The function will try all possibilities. If no asset can be found, an empty/invalid xiiAssetInfo is returned. If bExhaustiveSearch is set the function will go through all known assets and find the closest match.

◆ GetDevelopmentAssetProfile()

const xiiPlatformProfile * xiiAssetCurator::GetDevelopmentAssetProfile ( ) const

The main platform on which development happens. E.g. "Default".

TODO: review this concept

◆ IsReferenced()

bool xiiAssetCurator::IsReferenced ( xiiStringView sAbsolutePath) const

Returns whether a file is referenced, i.e. used for transforming an asset. Use this to e.g. figure out whether a .tga file is still in use by any asset.

Parameters
sAbsolutePathAbsolute path to any file inside a data directory.
Returns
True, if at least one asset references the given file.

◆ SetActiveAssetProfileByIndex()

void xiiAssetCurator::SetActiveAssetProfileByIndex ( xiiUInt32 uiIndex,
bool bForceReevaluation = false )

Switches the currently active asset target platform.

Broadcasts xiiAssetCuratorEvent::Type::ActivePlatformChanged on change.

◆ TransformAssetsForSceneExport()

void xiiAssetCurator::TransformAssetsForSceneExport ( const xiiPlatformProfile * pAssetProfile = nullptr)

Some assets are not automatically updated by the asset dependency detection (mainly Collections) because of their transitive data dependencies. So we must update them when the user does something 'significant' like doing TransformAllAssets or a scene export.


The documentation for this class was generated from the following files: