ezEngine  Release 25.03
ezAssetCurator Class Reference

Public Member Functions

Setup
void StartInitialize (const ezApplicationFileSystemConfig &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
ezDateTime GetLastFullTransformDate () const
 
void StoreFullTransformDate ()
 
ezStatus TransformAllAssets (ezBitflags< ezTransformFlags > transformFlags, const ezPlatformProfile *pAssetProfile=nullptr)
 Transforms all assets and writes the lookup tables. If the given platform is empty, the active platform is used.
 
ezTransformStatus TransformAsset (const ezUuid &assetGuid, ezBitflags< ezTransformFlags > transformFlags, const ezPlatformProfile *pAssetProfile=nullptr)
 
ezTransformStatus CreateThumbnail (const ezUuid &assetGuid)
 
void ResaveAllAssets (ezStringView sPrefixPath)
 
void TransformAssetsForSceneExport (const ezPlatformProfile *pAssetProfile=nullptr)
 
ezResult WriteAssetTables (const ezPlatformProfile *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 (ezStringView sAbsolutePath)
 Allows to tell the system of a new or changed file, that might be of interest to the Curator.
 
void NotifyOfAssetChange (const ezUuid &assetGuid)
 Allows to tell the system to re-evaluate an assets status.
 
void UpdateAssetLastAccessTime (const ezUuid &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 ezUuid &assetGuid)
 
void InvalidateAssetsWithTransformState (ezAssetInfo::TransformState state)
 
Utilities
void GenerateTransitiveHull (const ezStringView sAssetOrPath, ezSet< ezString > &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 ezAssetInfo *pAssetInfo, ezSet< ezUuid > &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 ezUuid &guid, ezStringView sOutputFile) const
 Generates a DGML graph of all transform and thumbnail dependencies.
 
void ClearAssetCaches (ezAssetDocumentManager::OutputReliability threshold)
 Deletes all files in all asset caches, except for the asset outputs that exceed the threshold. More...
 

Public Attributes

ezEvent< const ezAssetCuratorEvent & > m_Events
 

Friends

class ezUpdateTask
 
class ezAssetProcessor
 
class ezProcessTask
 

Asset Platform Configurations

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

Asset Access

using ezLockedSubAsset = ezLockedObject< ezMutex, const ezSubAsset >
 
using ezLockedSubAssetTable = ezLockedObject< ezMutex, const ezHashTable< ezUuid, ezSubAsset > >
 
using ezLockedAssetTable = ezLockedObject< ezMutex, const ezHashTable< ezUuid, ezAssetInfo * > >
 
const ezLockedSubAsset FindSubAsset (ezStringView sPathOrGuid, bool bExhaustiveSearch=false) const
 Tries to find the asset information for an asset identified through a string. More...
 
const ezLockedSubAsset GetSubAsset (const ezUuid &assetGuid) const
 Same as GetAssteInfo, but wraps the return value into a ezLockedSubAsset struct.
 
const ezLockedSubAssetTable GetKnownSubAssets () const
 Returns the table of all known assets in a locked structure.
 
const ezLockedAssetTable GetKnownAssets () const
 Returns the table of all known assets in a locked structure.
 
ezUInt64 GetAssetDependencyHash (ezUuid assetGuid)
 Computes the combined hash for the asset and its dependencies. Returns 0 if anything went wrong.
 
ezUInt64 GetAssetReferenceHash (ezUuid assetGuid)
 Computes the combined hash for the asset and its references. Returns 0 if anything went wrong.
 
ezAssetInfo::TransformState IsAssetUpToDate (const ezUuid &assetGuid, const ezPlatformProfile *pAssetProfile, const ezAssetDocumentTypeDescriptor *pTypeDescriptor, ezUInt64 &out_uiAssetHash, ezUInt64 &out_uiThumbHash, ezUInt64 &out_uiPackageHash, bool bForce=false)
 
void GetAssetTransformStats (ezUInt32 &out_uiNumAssets, ezHybridArray< ezUInt32, ezAssetInfo::TransformState::COUNT > &out_count)
 Returns the number of assets in the system and how many are in what transform state.
 
ezString FindDataDirectoryForAsset (ezStringView sAbsoluteAssetPath) const
 Iterates over all known data directories and returns the absolute path to the directory in which this asset is located.
 
ezResult FindBestMatchForFile (ezStringBuilder &ref_sFile, ezArrayPtr< ezString > allowedFileExtensions) const
 Uses knowledge about all existing files on disk to find the best match for a file. Very slow. More...
 
void FindAllUses (ezUuid assetGuid, ezSet< ezUuid > &ref_uses, bool bTransitive) const
 Finds all uses, either as references or dependencies to a given asset. More...
 
void FindAllUses (ezStringView sAbsolutePath, ezSet< ezUuid > &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. More...
 
bool IsReferenced (ezStringView 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. More...
 

Member Function Documentation

◆ ClearAssetCaches()

void ezAssetCurator::ClearAssetCaches ( ezAssetDocumentManager::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()

ezResult ezAssetCurator::DeleteAssetProfile ( ezPlatformProfile 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 ezAssetCurator::FindAllUses ( ezStringView  sAbsolutePath,
ezSet< ezUuid > &  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 ezAssetCurator::FindAllUses ( ezUuid  assetGuid,
ezSet< ezUuid > &  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()

ezResult ezAssetCurator::FindBestMatchForFile ( ezStringBuilder ref_sFile,
ezArrayPtr< ezString 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 ezAssetCurator::ezLockedSubAsset ezAssetCurator::FindSubAsset ( ezStringView  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 ezAssetInfo is returned. If bExhaustiveSearch is set the function will go through all known assets and find the closest match.

◆ GetDevelopmentAssetProfile()

const ezPlatformProfile * ezAssetCurator::GetDevelopmentAssetProfile ( ) const

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

TODO: review this concept

◆ IsReferenced()

bool ezAssetCurator::IsReferenced ( ezStringView  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 ezAssetCurator::SetActiveAssetProfileByIndex ( ezUInt32  uiIndex,
bool  bForceReevaluation = false 
)

Switches the currently active asset target platform.

Broadcasts ezAssetCuratorEvent::Type::ActivePlatformChanged on change.

◆ TransformAssetsForSceneExport()

void ezAssetCurator::TransformAssetsForSceneExport ( const ezPlatformProfile 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: