Plasma Engine  2.0
Loading...
Searching...
No Matches
plAssetDocumentManager Class Referenceabstract
Inheritance diagram for plAssetDocumentManager:

Public Member Functions

virtual plStatus ReadAssetDocumentInfo (plUniquePtr< plAssetDocumentInfo > &out_pInfo, plStreamReader &inout_stream) const
 Opens the asset file and reads the "Header" into the given plAssetDocumentInfo.
 
virtual void FillOutSubAssetList (const plAssetDocumentInfo &assetInfo, plDynamicArray< plSubAssetData > &out_subAssets) const
 
virtual plStatus GetAdditionalOutputs (plDynamicArray< plString > &ref_files)
 
virtual plStatus CloneDocument (plStringView sPath, plStringView sClonePath, plUuid &inout_cloneGuid) override
 
virtual plResult OpenPickedDocument (const plDocumentObject *pPickedComponent, plUInt32 uiPartIndex)
 Called by the editor to try to open a document for the matching picking result.
 
plResult TryOpenAssetDocument (const char *szPathOrGuid)
 
virtual void GetAssetTypesRequiringTransformForSceneExport (plSet< plTempHashedString > &inout_assetTypes)
 
Thumbnail Functions
virtual plString GenerateResourceThumbnailPath (plStringView sDocumentPath, plStringView sSubAssetName=plStringView())
 Returns the absolute path to the thumbnail that belongs to the given document.
 
virtual bool IsThumbnailUpToDate (plStringView sDocumentPath, plStringView sSubAssetName, plUInt64 uiThumbnailHash, plUInt32 uiTypeVersion)
 
- Public Member Functions inherited from plDocumentManager
plStatus CanOpenDocument (plStringView sFilePath) const
 
plStatus CreateDocument (plStringView sDocumentTypeName, plStringView sPath, plDocument *&out_pDocument, plBitflags< plDocumentFlags > flags=plDocumentFlags::None, const plDocumentObject *pOpenContext=nullptr)
 Creates a new document.
 
plStatus OpenDocument (plStringView sDocumentTypeName, plStringView sPath, plDocument *&out_pDocument, plBitflags< plDocumentFlags > flags=plDocumentFlags::AddToRecentFilesList|plDocumentFlags::RequestWindow, const plDocumentObject *pOpenContext=nullptr)
 Opens an existing document.
 
void CloseDocument (plDocument *pDocument)
 
void EnsureWindowRequested (plDocument *pDocument, const plDocumentObject *pOpenContext=nullptr)
 
const plDynamicArray< plDocument * > & GetAllOpenDocuments () const
 Returns a list of all currently open documents that are managed by this document manager.
 
plDocumentGetDocumentByPath (plStringView sPath) const
 
bool EnsureDocumentIsClosed (plStringView sPath)
 If the given document is open, it will be closed. User is not asked about it, unsaved changes are discarded. Returns true if the document was open and needed to be closed. This function only operates on documents opened by this manager. Use EnsureDocumentIsClosedInAllManagers() to close documents of any type.
 
void CloseAllDocumentsOfManager ()
 
void GetSupportedDocumentTypes (plDynamicArray< const plDocumentTypeDescriptor * > &inout_documentTypes) const
 
- Public Member Functions inherited from plReflectedClass
virtual const plRTTIGetDynamicRTTI () const
 
bool IsInstanceOf (const plRTTI *pType) const
 Returns whether the type of this instance is of the given type or derived from it.
 
template<typename T >
PL_ALWAYS_INLINE bool IsInstanceOf () const
 Returns whether the type of this instance is of the given type or derived from it.
 

Static Protected Member Functions

static bool IsResourceUpToDate (const char *szResourceFile, plUInt64 uiHash, plUInt16 uiTypeVersion)
 
static void GenerateOutputFilename (plStringBuilder &inout_sRelativeDocumentPath, const plPlatformProfile *pAssetProfile, const char *szExtension, bool bPlatformSpecific)
 

Output Functions

enum  OutputReliability : plUInt8 { Unknown = 0 , Good = 1 , Perfect = 2 }
 
virtual void AddEntriesToAssetTable (plStringView sDataDirectory, const plPlatformProfile *pAssetProfile, plDelegate< void(plStringView sGuid, plStringView sPath, plStringView sType)> addEntry) const
 
virtual plString GetAssetTableEntry (const plSubAsset *pSubAsset, plStringView sDataDirectory, const plPlatformProfile *pAssetProfile) const
 
plString GetAbsoluteOutputFileName (const plAssetDocumentTypeDescriptor *pTypeDesc, plStringView sDocumentPath, plStringView sOutputTag, const plPlatformProfile *pAssetProfile=nullptr) const
 Calls GetRelativeOutputFileName and prepends [DataDir]/AssetCache/ .
 
virtual plString GetRelativeOutputFileName (const plAssetDocumentTypeDescriptor *pTypeDesc, plStringView sDataDirectory, plStringView sDocumentPath, plStringView sOutputTag, const plPlatformProfile *pAssetProfile=nullptr) const
 Relative to 'AssetCache' folder.
 
virtual bool GeneratesProfileSpecificAssets () const =0
 
bool IsOutputUpToDate (plStringView sDocumentPath, const plDynamicArray< plString > &outputs, plUInt64 uiHash, const plAssetDocumentTypeDescriptor *pTypeDescriptor)
 
virtual bool IsOutputUpToDate (plStringView sDocumentPath, plStringView sOutputTag, plUInt64 uiHash, const plAssetDocumentTypeDescriptor *pTypeDescriptor)
 
virtual OutputReliability GetAssetTypeOutputReliability () const
 

Asset Profile Functions

void ComputeAssetProfileHash (const plPlatformProfile *pAssetProfile)
 Called by the plAssetCurator when the active asset profile changes to re-compute m_uiAssetProfileHash.
 
PL_ALWAYS_INLINE plUInt64 GetAssetProfileHash () const
 Returns the hash that was previously computed through ComputeAssetProfileHash().
 
static const plPlatformProfileDetermineFinalTargetProfile (const plPlatformProfile *pAssetProfile)
 Returns pAssetProfile, or if that is null, plAssetCurator::GetSingleton()->GetActiveAssetProfile().
 

Additional Inherited Members

- Public Types inherited from plDocumentManager
using CustomAction = plVariant (*)(const plDocument*)
 
- Static Public Member Functions inherited from plDocumentManager
static const plHybridArray< plDocumentManager *, 16 > & GetAllDocumentManagers ()
 
static plResult FindDocumentTypeFromPath (plStringView sPath, bool bForCreation, const plDocumentTypeDescriptor *&out_pTypeDesc)
 
static plDocumentGetDocumentByGuid (const plUuid &guid)
 
static bool EnsureDocumentIsClosedInAllManagers (plStringView sPath)
 If the given document is open, it will be closed. User is not asked about it, unsaved changes are discarded. Returns true if the document was open and needed to be closed.
 
static void CloseAllDocuments ()
 
static const plDocumentTypeDescriptorGetDescriptorForDocumentType (plStringView sDocumentType)
 
static const plMap< plString, const plDocumentTypeDescriptor * > & GetAllDocumentDescriptors ()
 
- Static Public Member Functions inherited from plNoBase
static const plRTTIGetStaticRTTI ()
 
- Static Public Attributes inherited from plDocumentManager
static plCopyOnBroadcastEvent< const Event & > s_Events
 
static plEvent< Request & > s_Requests
 
static plMap< plString, CustomAction > s_CustomActions
 
- Protected Member Functions inherited from plDocumentManager
virtual void InternalCloneDocument (plStringView sPath, plStringView sClonePath, const plUuid &documentId, const plUuid &seedGuid, const plUuid &cloneGuid, plAbstractObjectGraph *pHeader, plAbstractObjectGraph *pObjects, plAbstractObjectGraph *pTypes)
 

Member Enumeration Documentation

◆ OutputReliability

Describes how likely it is that a generated file is 'corrupted', due to dependency issues and such. For example a prefab may not work correctly, if it was written with a very different C++ plugin state, but this can't be detected later. Whereas a texture always produces exactly the same output and is thus perfectly reliable. This is used to clear asset caches selectively, and keep things that are unlikely to be in a broken state.

Member Function Documentation

◆ CloneDocument()

plStatus plAssetDocumentManager::CloneDocument ( plStringView sPath,
plStringView sClonePath,
plUuid & inout_cloneGuid )
overridevirtual

Reimplemented from plDocumentManager.

◆ GetAdditionalOutputs()

virtual plStatus plAssetDocumentManager::GetAdditionalOutputs ( plDynamicArray< plString > & ref_files)
inlinevirtual

If this asset type has additional output files that need to be generated (like a texture atlas that combines outputs from multiple assets) this function should make sure those files are all generated and return the list of relative file paths (from the data directory root).

Reimplemented in plTypeScriptAssetDocumentManager.

◆ GetAssetTypeOutputReliability()

◆ GetAssetTypesRequiringTransformForSceneExport()

virtual void plAssetDocumentManager::GetAssetTypesRequiringTransformForSceneExport ( plSet< plTempHashedString > & inout_assetTypes)
inlinevirtual

In case this manager deals with types that need to be force transformed on scene export, it can add the asset type names to this list. This is only needed for assets that have such special dependencies for their transform step, that the regular dependency tracking doesn't work for them. Currently the only known case are Collection assets, because they have to manually go through the Package dependencies transitively, which means that the asset curator can't know when they need to be updated.

Reimplemented in plCollectionAssetDocumentManager.

◆ GetRelativeOutputFileName()

plString plAssetDocumentManager::GetRelativeOutputFileName ( const plAssetDocumentTypeDescriptor * pTypeDesc,
plStringView sDataDirectory,
plStringView sDocumentPath,
plStringView sOutputTag,
const plPlatformProfile * pAssetProfile = nullptr ) const
virtual

Relative to 'AssetCache' folder.

Reimplemented in plMaterialAssetDocumentManager, and plTextureAssetDocumentManager.

◆ OpenPickedDocument()

virtual plResult plAssetDocumentManager::OpenPickedDocument ( const plDocumentObject * pPickedComponent,
plUInt32 uiPartIndex )
inlinevirtual

Called by the editor to try to open a document for the matching picking result.

Reimplemented in plMeshAssetDocumentManager.


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