Navigation
API > API/Plugins > API/Plugins/USDClasses
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UUsdAssetCache3
References
| Module | USDClasses |
| Header | /Engine/Plugins/Runtime/USDCore/Source/USDClasses/Public/USDAssetCache3.h |
| Include | #include "USDAssetCache3.h" |
Syntax
UCLASS (BlueprintType, Blueprintable,
Meta=(DisplayName="USD Asset Cache", ScriptName="UsdAssetCache"))
class UUsdAssetCache3 : public UObject
Remarks
This class is an asset that can be created via the Content Browser and assigned to AUsdStageActors.
Its main purpose is to track generated assets based on the hash of the source prim data: Whenever the AUsdStageActor needs to generate e.g. a MaterialInstance, it will first hash the Material prim, and check whether its UUsdAssetCache3 already has an asset of that class for the resulting hash.
The cache can then be shared by multiple AUsdStageActors to prevent recreating UObjects from identical, already translated prim data.
A "Default Asset Cache" can be set on the project settings, and will be automatically used for any AUsdStageActor that hasn't had an asset cache manually set beforehand.
Variables
| Type | Name | Description | |
|---|---|---|---|
| FDirectoryPath | AssetDirectory | Content directory where the asset cache will place newly created assets. | |
| bool | bCleanUpUnreferencedAssets | If this is true, every time a UsdStageActor using this asset cache closes a stage or swaps asset caches it will attempt to call DeleteUnreferencedAssets, potentially dropping any unreferenced asset, due to this operation or previous ones. | |
| bool | bOnlyHandleAssetsWithinAssetDirectory | When true, it means the asset cache will only ever return assets that are currently inside of the AssetDirectory folder. | |
| TMap< FString, FSoftObjectPath > | HashToAssetPaths | This is the main internal property that maps hashes to asset paths. |
Constructors
| Type | Name | Description | |
|---|---|---|---|
Functions
| Type | Name | Description | |
|---|---|---|---|
| bool | AddAssetReferencer
(
const UObject* Asset, |
Adds a new UObject referencer to a particular asset, returning true if the operation succeeded. | |
| void | AddReferenceInternal
(
const FString& Hash, |
||
| void | CacheAsset
(
const FString& Hash, |
Adds an existing asset to the cache attached to a particular hash, and optionally registering a referencer | |
| void | DeleteUnreferencedAssets
(
const bool bShowConfirmation |
Deletes all assets that: | |
| void | This is the same as calling DeleteUnreferencedAssets and providing true for bShowConfirmation. | ||
| void | ForceValidAssetDirectoryInternal
(
bool bEmitWarning |
||
| TSet< FSoftObjectPath > | |||
| TMap< FString, FSoftObjectPath > | Returns a copy of the internal mapping between hashes and asset paths | ||
| T * | GetCachedAsset
(
const FString& Hash |
Templated version of GetCachedAsset for convenience | |
| UObject * | GetCachedAsset
(
const FString& Hash |
Returns the asset associated with a particular Hash, if any. | |
| FSoftObjectPath | GetCachedAssetPath
(
const FString& Hash |
Returns the internal FSoftObjectPath associated with Hash, without trying to load the asset. | |
| FString | GetHashForAsset
(
const FSoftObjectPath& AssetPath |
Returns the hash associated with a particular asset, or the empty string if there isn't any. | |
| int32 | GetNumAssets () |
Returns the total number of cached asset paths, whether these resolve to assets or not | |
| UObject * | Returns the cached UObject of the provided Class for the provided Hash if one exists. | ||
| T * | GetOrCreateCachedAsset
(
const FString& Hash, |
Templated version of GetOrCreateCachedAsset for convenience | |
| T * | GetOrCreateCustomCachedAsset
(
const FString& Hash, |
Templated version of GetOrCreateCachedAsset for convenience | |
| UObject * | GetOrCreateCustomCachedAsset
(
const FString& Hash, |
For most asset types GetOrCreateCachedAsset should suffice: It will internally call NewObject |
|
| bool | IsAssetDeletable
(
const UObject* Asset |
Returns whether a particular asset is currently marked as deletable or not | |
| bool | IsAssetTrackedByCache
(
const FSoftObjectPath& AssetPath |
Returns true if this asset is currently tracked by the asset cache's main hash to asset maps | |
| bool | |||
| TMap< FString, UObject * > | The same as GetAllTrackedAssets, except that it will automatically try loading all the asset paths before returning, which should be convenient for Python or Blueprint callers. | ||
| void | |||
| void | OnRegistryAssetRenamed
(
const FAssetData& NewAssetData, |
||
| bool | Removes all UObject referencer from all tracked assets, returning true if anything was removed. | ||
| bool | RemoveAllAssetReferencersInternal
(
const FString& Hash |
||
| bool | RemoveAllReferencerAssets
(
const UObject* Referencer |
Removes a particular UObject referencer from all tracked assets, returning true if anything was removed. | |
| bool | RemoveAllReferencersForAsset
(
const UObject* Asset |
Removes all UObject referencers from a particular asset, returning true if anything was removed. | |
| bool | RemoveAssetReferencer
(
const UObject* Asset, |
Removes an UObject referencer from a particular asset, returning true if anything was removed. | |
| void | |||
| void | Checks the current AssetDirectory for any new assets that were generated from USD, and automatically caches them if possible. | ||
| void | SetAssetDeletable
(
const UObject* Asset, |
Sets a particular asset as deletable or not. | |
| const UObject * | SetCurrentScopedReferencer
(
const UObject* NewReferencer |
||
| FSoftObjectPath | StopTrackingAsset
(
const FString& Hash |
Removes all info about the asset associated with Hash from this cache, if there is any. | |
| FSoftObjectPath | StopTrackingAssetInternal
(
const FString& Hash |
||
| void | TouchAsset
(
const FString& Hash, |
||
| void | TouchAssetInternal
(
const FSoftObjectPath& AssetPath, |
||
| void | TouchAssetPath
(
const FSoftObjectPath& AssetPath, |
||
| void | TryCachingAssetFromAssetUserData
(
const FAssetData& NewAssetData |
Overridden from UObject
| Type | Name | Description | |
|---|---|---|---|
| void | BeginDestroy () |
Called before destroying the object. | |
| void | PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
Called when a property on this object has been modified externally | |
| void | PostLoad () |
Do any object-specific cleanup required immediately after loading an object. | |
| void | Handles reading, writing, and reference collecting using FArchive. |
Classes
| Type | Name | Description | |
|---|---|---|---|
| FUsdScopedReferencer | The UUsdAssetCache3 can track all the UObjects that are referencing assets, so that it knows when to discard an unreferenced asset. |