![]() |
Plasma Engine
2.0
|
Public Member Functions | |
Setup | |
void | StartInitialize (const plApplicationFileSystemConfig &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 | |
plDateTime | GetLastFullTransformDate () const |
void | StoreFullTransformDate () |
plStatus | TransformAllAssets (plBitflags< plTransformFlags > transformFlags, const plPlatformProfile *pAssetProfile=nullptr) |
Transforms all assets and writes the lookup tables. If the given platform is empty, the active platform is used. | |
void | ResaveAllAssets () |
plTransformStatus | TransformAsset (const plUuid &assetGuid, plBitflags< plTransformFlags > transformFlags, const plPlatformProfile *pAssetProfile=nullptr) |
plTransformStatus | CreateThumbnail (const plUuid &assetGuid) |
void | TransformAssetsForSceneExport (const plPlatformProfile *pAssetProfile=nullptr) |
plResult | WriteAssetTables (const plPlatformProfile *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 (plStringView sAbsolutePath) |
Allows to tell the system of a new or changed file, that might be of interest to the Curator. | |
void | NotifyOfAssetChange (const plUuid &assetGuid) |
Allows to tell the system to re-evaluate an assets status. | |
void | UpdateAssetLastAccessTime (const plUuid &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 plUuid &assetGuid) |
void | InvalidateAssetsWithTransformState (plAssetInfo::TransformState state) |
Utilities | |
void | GenerateTransitiveHull (const plStringView sAssetOrPath, plSet< plString > &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 plAssetInfo *pAssetInfo, plSet< plUuid > &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 plUuid &guid, plStringView sOutputFile) const |
Generates a DGML graph of all transform and thumbnail dependencies. | |
void | ClearAssetCaches (plAssetDocumentManager::OutputReliability threshold) |
Deletes all files in all asset caches, except for the asset outputs that exceed the threshold. | |
Public Attributes | |
plEvent< const plAssetCuratorEvent & > | m_Events |
Friends | |
class | plUpdateTask |
class | plAssetProcessor |
class | plProcessTask |
Asset Access | |
using | plLockedSubAsset = plLockedObject<plMutex, const plSubAsset> |
using | plLockedSubAssetTable = plLockedObject<plMutex, const plHashTable<plUuid, plSubAsset>> |
using | plLockedAssetTable = plLockedObject<plMutex, const plHashTable<plUuid, plAssetInfo*>> |
const plLockedSubAsset | FindSubAsset (plStringView sPathOrGuid, bool bExhaustiveSearch=false) const |
Tries to find the asset information for an asset identified through a string. | |
const plLockedSubAsset | GetSubAsset (const plUuid &assetGuid) const |
Same as GetAssteInfo, but wraps the return value into a plLockedSubAsset struct. | |
const plLockedSubAssetTable | GetKnownSubAssets () const |
Returns the table of all known assets in a locked structure. | |
const plLockedAssetTable | GetKnownAssets () const |
Returns the table of all known assets in a locked structure. | |
plUInt64 | GetAssetDependencyHash (plUuid assetGuid) |
Computes the combined hash for the asset and its dependencies. Returns 0 if anything went wrong. | |
plUInt64 | GetAssetReferenceHash (plUuid assetGuid) |
Computes the combined hash for the asset and its references. Returns 0 if anything went wrong. | |
plAssetInfo::TransformState | IsAssetUpToDate (const plUuid &assetGuid, const plPlatformProfile *pAssetProfile, const plAssetDocumentTypeDescriptor *pTypeDescriptor, plUInt64 &out_uiAssetHash, plUInt64 &out_uiThumbHash, bool bForce=false) |
void | GetAssetTransformStats (plUInt32 &out_uiNumAssets, plHybridArray< plUInt32, plAssetInfo::TransformState::COUNT > &out_count) |
Returns the number of assets in the system and how many are in what transform state. | |
plString | FindDataDirectoryForAsset (plStringView sAbsoluteAssetPath) const |
Iterates over all known data directories and returns the absolute path to the directory in which this asset is located. | |
plResult | FindBestMatchForFile (plStringBuilder &ref_sFile, plArrayPtr< plString > allowedFileExtensions) const |
Uses knowledge about all existing files on disk to find the best match for a file. Very slow. | |
void | FindAllUses (plUuid assetGuid, plSet< plUuid > &ref_uses, bool bTransitive) const |
Finds all uses, either as references or dependencies to a given asset. | |
void | FindAllUses (plStringView sAbsolutePath, plSet< plUuid > &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 (plStringView 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 plPlatformProfile * | GetDevelopmentAssetProfile () const |
The main platform on which development happens. E.g. "Default". | |
const plPlatformProfile * | GetActiveAssetProfile () const |
The currently active target platform for asset processing. | |
plUInt32 | GetActiveAssetProfileIndex () const |
Returns the index of the currently active asset platform configuration. | |
plUInt32 | FindAssetProfileByName (const char *szPlatform) |
Returns plInvalidIndex if no config with the given name exists. Name comparison is case insensitive. | |
plUInt32 | GetNumAssetProfiles () const |
const plPlatformProfile * | GetAssetProfile (plUInt32 uiIndex) const |
Always returns a valid config. E.g. even if plInvalidIndex is passed in, it will fall back to the default config (at index 0). | |
plPlatformProfile * | GetAssetProfile (plUInt32 uiIndex) |
Always returns a valid config. E.g. even if plInvalidIndex is passed in, it will fall back to the default config (at index 0). | |
plPlatformProfile * | CreateAssetProfile () |
Adds a new profile. The name should be set afterwards to a unique name. | |
plResult | DeleteAssetProfile (plPlatformProfile *pProfile) |
Deletes the given asset profile, if possible. | |
void | SetActiveAssetProfileByIndex (plUInt32 uiIndex, bool bForceReevaluation=false) |
Switches the currently active asset target platform. | |
plResult | SaveAssetProfiles () |
Saves the current asset configurations. Returns failure if the output file could not be written to. | |
void | SaveRuntimeProfiles () |
void plAssetCurator::ClearAssetCaches | ( | plAssetDocumentManager::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
plResult plAssetCurator::DeleteAssetProfile | ( | plPlatformProfile * | 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.
void plAssetCurator::FindAllUses | ( | plStringView | sAbsolutePath, |
plSet< plUuid > & | 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.
sAbsolutePath | Absolute path to any file inside a data directory. |
ref_uses | List of assets that use 'sAbsolutePath'. Any previous content of the set is not removed. |
void plAssetCurator::FindAllUses | ( | plUuid | assetGuid, |
plSet< plUuid > & | 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.
assetGuid | The asset to find use cases for. |
uses | List of assets that use 'assetGuid'. Any previous content of the set is not removed. |
transitive | If set, will also find indirect uses of the asset. |
plResult plAssetCurator::FindBestMatchForFile | ( | plStringBuilder & | ref_sFile, |
plArrayPtr< plString > | allowedFileExtensions ) const |
Uses knowledge about all existing files on disk to find the best match for a file. Very slow.
sFile | File name (may include a path) to search for. Will be modified both on success and failure to give a 'reasonable' result. |
const plAssetCurator::plLockedSubAsset plAssetCurator::FindSubAsset | ( | plStringView | 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 plAssetInfo is returned. If bExhaustiveSearch is set the function will go through all known assets and find the closest match.
const plPlatformProfile * plAssetCurator::GetDevelopmentAssetProfile | ( | ) | const |
The main platform on which development happens. E.g. "Default".
TODO: review this concept
bool plAssetCurator::IsReferenced | ( | plStringView | 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.
sAbsolutePath | Absolute path to any file inside a data directory. |
void plAssetCurator::SetActiveAssetProfileByIndex | ( | plUInt32 | uiIndex, |
bool | bForceReevaluation = false ) |
Switches the currently active asset target platform.
Broadcasts plAssetCuratorEvent::Type::ActivePlatformChanged on change.
void plAssetCurator::TransformAssetsForSceneExport | ( | const plPlatformProfile * | 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.