|
|
static const plEvent< const plResourceEvent &, plMutex > & | GetResourceEvents () |
|
static const plEvent< const plResourceManagerEvent &, plMutex > & | GetManagerEvents () |
| Events for the resource manager that affect broader things.
|
|
static void | BroadcastExistsEvent () |
| Goes through all existing resources and broadcasts the 'Exists' event.
|
|
|
template<typename ResourceType > |
static plTypedResourceHandle< ResourceType > | LoadResource (plStringView sResourceID) |
| Returns a handle to the requested resource. szResourceID must uniquely identify the resource, different spellings / casing will result in different resources.
|
|
template<typename ResourceType > |
static plTypedResourceHandle< ResourceType > | LoadResource (plStringView sResourceID, plTypedResourceHandle< ResourceType > hLoadingFallback) |
| Same as LoadResource(), but additionally allows to set a priority on the resource and a custom fallback resource for this instance.
|
|
static plTypelessResourceHandle | LoadResourceByType (const plRTTI *pResourceType, plStringView sResourceID) |
| Same as LoadResource(), but instead of a template argument, the resource type to use is given as plRTTI info. Returns a typeless handle due to the missing template argument.
|
|
static bool | IsAnyLoadingInProgress () |
| Checks whether any resource loading is in progress.
|
|
static plString | GenerateUniqueResourceID (plStringView sResourceIDPrefix) |
| Generates a unique resource ID with the given prefix.
|
|
template<typename ResourceType , typename DescriptorType > |
static plTypedResourceHandle< ResourceType > | CreateResource (plStringView sResourceID, DescriptorType &&descriptor, plStringView sResourceDescription=nullptr) |
| Creates a resource from a descriptor.
|
|
template<typename ResourceType , typename DescriptorType > |
static plTypedResourceHandle< ResourceType > | GetOrCreateResource (plStringView sResourceID, DescriptorType &&descriptor, plStringView sResourceDescription=nullptr) |
| Returns a handle to the resource with the given ID if it exists or creates it from a descriptor.
|
|
template<typename ResourceType > |
static plTypedResourceHandle< ResourceType > | GetExistingResource (plStringView sResourceID) |
| Returns a handle to the resource with the given ID. If the resource does not exist, the handle is invalid.
|
|
static plTypelessResourceHandle | GetExistingResourceByType (const plRTTI *pResourceType, plStringView sResourceID) |
| Same as GetExistingResourceByType() but allows to specify the resource type as an plRTTI.
|
|
template<typename ResourceType > |
static plTypedResourceHandle< ResourceType > | GetExistingResourceOrCreateAsync (plStringView sResourceID, plUniquePtr< plResourceTypeLoader > &&pLoader, plTypedResourceHandle< ResourceType > hLoadingFallback={}) |
|
static plTypelessResourceHandle | GetExistingResourceOrCreateAsync (const plRTTI *pResourceType, plStringView sResourceID, plUniquePtr< plResourceTypeLoader > &&pLoader) |
|
static void | PreloadResource (const plTypelessResourceHandle &hResource) |
| Triggers loading of the given resource. tShouldBeAvailableIn specifies how long the resource is not yet needed, thus allowing other resources to be loaded first. This is only a hint and there are no guarantees when the resource is available.
|
|
static void | ForceLoadResourceNow (const plTypelessResourceHandle &hResource) |
| Similar to locking a resource with 'BlockTillLoaded' acquire mode, but can be done with a typeless handle and does not return a result.
|
|
static plResourceState | GetLoadingState (const plTypelessResourceHandle &hResource) |
| Returns the current loading state of the given resource.
|
|
|
static plUInt32 | ReloadAllResources (bool bForce) |
| Goes through all resources and makes sure they are reloaded, if they have changed. If bForce is true, all resources are updated, even if there is no indication that they have changed.
|
|
template<typename ResourceType > |
static plUInt32 | ReloadResourcesOfType (bool bForce) |
| Goes through all resources of the given type and makes sure they are reloaded, if they have changed. If bForce is true, resources are updated, even if there is no indication that they have changed.
|
|
static plUInt32 | ReloadResourcesOfType (const plRTTI *pType, bool bForce) |
| Goes through all resources of the given type and makes sure they are reloaded, if they have changed. If bForce is true, resources are updated, even if there is no indication that they have changed.
|
|
template<typename ResourceType > |
static bool | ReloadResource (const plTypedResourceHandle< ResourceType > &hResource, bool bForce) |
| Reloads only the one specific resource. If bForce is true, it is updated, even if there is no indication that it has changed.
|
|
static bool | ReloadResource (const plRTTI *pType, const plTypelessResourceHandle &hResource, bool bForce) |
| Reloads only the one specific resource. If bForce is true, it is updated, even if there is no indication that it has changed.
|
|
static void | UpdateResourceWithCustomLoader (const plTypelessResourceHandle &hResource, plUniquePtr< plResourceTypeLoader > &&pLoader) |
| Calls ReloadResource() on the given resource, but makes sure that the reload happens with the given custom loader.
|
|
static void | RestoreResource (const plTypelessResourceHandle &hResource) |
| Removes the 'PreventFileReload' flag and forces a reload on the resource.
|
|
|
template<typename ResourceType > |
static ResourceType * | BeginAcquireResource (const plTypedResourceHandle< ResourceType > &hResource, plResourceAcquireMode mode, const plTypedResourceHandle< ResourceType > &hLoadingFallback=plTypedResourceHandle< ResourceType >(), plResourceAcquireResult *out_pAcquireResult=nullptr) |
| Acquires a resource pointer from a handle. Prefer to use plResourceLock, which wraps BeginAcquireResource / EndAcquireResource.
|
|
static plResource * | BeginAcquireResourcePointer (const plRTTI *pType, const plTypelessResourceHandle &hResource) |
| Same as BeginAcquireResource but only for the base resource pointer.
|
|
template<typename ResourceType > |
static void | EndAcquireResource (ResourceType *pResource) |
| Needs to be called in concert with BeginAcquireResource() after accessing a resource has been finished. Prefer to use plResourceLock instead.
|
|
static void | EndAcquireResourcePointer (plResource *pResource) |
| Same as EndAcquireResource but without the template parameter. See also BeginAcquireResourcePointer.
|
|
static void | ForceNoFallbackAcquisition (plUInt32 uiNumFrames=0xFFFFFFFF) |
| Forces the resource manager to treat plResourceAcquireMode::AllowLoadingFallback as plResourceAcquireMode::BlockTillLoaded on BeginAcquireResource.
|
|
static plUInt32 | GetForceNoFallbackAcquisition () |
| If the returned number is greater 0 the resource manager treats plResourceAcquireMode::AllowLoadingFallback as plResourceAcquireMode::BlockTillLoaded on BeginAcquireResource.
|
|
template<typename ResourceType > |
static plLockedObject< plMutex, plDynamicArray< plResource * > > | GetAllResourcesOfType () |
| Retrieves an array of pointers to resources of the indicated type which are loaded at the moment. Destroy the returned object as soon as possible as it holds the entire resource manager locked.
|
|
|
static plMutex & | GetMutex () |
| Returns the resource manager mutex. Allows to lock the manager on a thread when multiple operations need to be done in sequence.
|
|
static void | PerFrameUpdate () |
| Must be called once per frame for some bookkeeping.
|
|
static void | EngineAboutToShutdown () |
| Makes sure that no further resource loading will take place.
|
|
static void | ResetAllResources () |
| Calls plResource::ResetResource() on all resources.
|
|
static void | SetResourceLowResData (const plTypelessResourceHandle &hResource, plStreamReader *pStream) |
| Calls plResource::UpdateContent() to fill the resource with 'low resolution' data.
|
|
|
static void | SetDefaultResourceLoader (plResourceTypeLoader *pDefaultLoader) |
| Sets the resource loader to use when no type specific resource loader is available.
|
|
static plResourceTypeLoader * | GetDefaultResourceLoader () |
| Returns the resource loader to use when no type specific resource loader is available.
|
|
template<typename ResourceType > |
static void | SetResourceTypeLoader (plResourceTypeLoader *pCreator) |
| Sets the resource loader to use for the given resource type.
|
|
|
static void | RegisterNamedResource (plStringView sLookupName, plStringView sRedirectionResource) |
| Registers a 'named' resource. When a resource is looked up using szLookupName, the lookup will be redirected to szRedirectionResource.
|
|
static void | UnregisterNamedResource (plStringView sLookupName) |
| Removes a previously registered name from the redirection table.
|
|
|
static void | RegisterResourceForAssetType (plStringView sAssetTypeName, const plRTTI *pResourceType) |
| Registers which resource type to use to load an asset with the given type name.
|
|
static const plRTTI * | FindResourceForAssetType (plStringView sAssetTypeName) |
| Returns the resource type that was registered to handle the given asset type for loading. nullptr if no resource type was registered for this asset type.
|
|
|
static void | EnableExportMode (bool bEnable) |
| Enables export mode. In this mode the resource manager will assert when it actually tries to load a resource. This can be useful when exporting resource handles but the actual resource content is not needed.
|
|
static bool | IsExportModeEnabled () |
| Returns whether export mode is active.
|
|
template<typename ResourceType > |
static plTypedResourceHandle< ResourceType > | GetResourceHandleForExport (plStringView sResourceID) |
| Creates a resource handle for the given resource ID. This method can only be used if export mode is enabled. Internally it will create a resource but does not load the content. This way it can be ensured that the resource handle is always only the size of a pointer.
|
|
|
static void | RegisterResourceOverrideType (const plRTTI *pDerivedTypeToUse, plDelegate< bool(const plStringBuilder &)> overrideDecider) |
| Registers a resource type to be used instead of any of it's base classes, when loading specific data.
|
|
static void | UnregisterResourceOverrideType (const plRTTI *pDerivedTypeToUse) |
| Unregisters pDerivedTypeToUse as an override resource.
|
|