|
RapyutaSimulationPlugins
|
GameSingleton class which handles asset loading. More...
#include <RRGameSingleton.h>


Public Member Functions | |
| virtual | ~URRGameSingleton () |
| virtual void | PrintSimConfig () const |
| bool | InitializeResources (bool bInRequestResourceLoading=false) |
| Read all sim dynamic resouces(Uassets) info from designated folders. More... | |
| void | FinalizeResources () |
| Finalize ResourceMap by calling FRRResourceInfo::Finalize. More... | |
| bool | CollateEntityAssetsInfoFromPAK (const TArray< FString > &InEntityModelNameList, bool bInForceReload=false) |
| Load PAK files of a specific set of entity models, mounting then then collate their content assets info. More... | |
| FString | GetDynamicBPAssetPath (const FString &InBPAssetName) |
| Get UE asset path of a dynamically created BP asset. More... | |
| FORCEINLINE FString | GetAssetsFolderName (const ERRResourceDataType InDataType) |
| Get the leaf relative UE path of a folder housing assets of a particular resource data type. More... | |
| FORCEINLINE FString | GetDynamicAssetPath (const ERRResourceDataType InDataType, const FString &InAssetName, const TCHAR *InModuleName) |
| Get the full UE path of a dynamic asset that is either early loaded at Sim initilization or generated dynamically at runtime. More... | |
| template<ERRResourceDataType InDataType> | |
| int32 | CollateAssetsInfo () |
| Collate assets info for ResourceMap. More... | |
| template<typename T > | |
| int32 | CollateAssetsInfo (const ERRResourceDataType InDataType, const FString &InAssetRelativeFolderPath) |
| Collate assets info for ResourceMap. More... | |
| void | CollateAssetsInfo () |
| Collate assets info. More... | |
| bool | HaveAllResourcesBeenLoaded (bool bIsLogged=false) const |
| Check all resources have been loaded or not. More... | |
| template<ERRResourceDataType InDataType> | |
| bool | RequestResourcesLoading () |
| Collate asset resources info & Async load them by UAssetManager. More... | |
| FORCEINLINE void | OnResourceLoaded (ERRResourceDataType InDataType, FSoftObjectPath InResourcePath, FString InResourceUniqueName) |
| This is used as param to [FStreamableDelegate::CreateUObject()] thus its params could not be constref-ized. More... | |
| template<typename TResource > | |
| FORCEINLINE bool | ProcessAsyncLoadedResource (const ERRResourceDataType InDataType, const FSoftObjectPath &InResourcePath, const FString &InResourceUniqueName) |
| Callback to handle an asynchronously loaded resource, which receives a [FSoftObjectPath] that references a valid [UObject]. More... | |
| template<typename TResource > | |
| FORCEINLINE void | AddDynamicResource (const ERRResourceDataType InDataType, TResource *InResourceObject, const FString &InResourceUniqueName, const FString &InResourceAssetPath=EMPTY_STR) |
| Update ResourceMap and ResourceStore with dynamically runtime-generated InResourceObject of which soft object path is also created on the fly. More... | |
| template<typename TResource > | |
| TResource * | GetSimResource (const ERRResourceDataType InDataType, const FString &InResourceUniqueName, bool bIsStaticResource=true) |
| Get the Sim Resource object, loading if required + updating resource store. More... | |
| bool | HasSimResource (const ERRResourceDataType InDataType, const FString &InResourceUniqueName) const |
| Check resource exist with GetSimResourceInfo. More... | |
| const TMap< FString, FRRResource > & | GetSimResourceList (const ERRResourceDataType InDataType) const |
| Get the Sim Resource List object with GetSimResourceInfo. More... | |
| FRRResourceInfo & | GetSimResourceInfo (const ERRResourceDataType InDataType) |
| Get the Sim Resource Info object from ResourceMap. More... | |
| const FRRResourceInfo & | GetSimResourceInfo (const ERRResourceDataType InDataType) const |
| Get the Sim Resource Info object from ResourceMap. More... | |
| FORCEINLINE UStaticMesh * | GetStaticMesh (const FString &InStaticMeshName, bool bIsStaticResource=true) |
| Get or load static mesh, GetSimResource with ERRResourceDataType::UE_STATIC_MESH. More... | |
| FORCEINLINE USkeletalMesh * | GetSkeletalMesh (const FString &InSkeletalMeshName, bool bIsStaticResource=true) |
| Get or load skeletal mesh, GetSimResource with ERRResourceDataType::UE_SKELETAL_MESH. More... | |
| FORCEINLINE USkeleton * | GetSkeleton (const FString &InSkeletonName, bool bIsStaticResource=true) |
| Get or load physics skeleton, GetSimResource with ERRResourceDataType::UE_SKELETON. More... | |
| FORCEINLINE UPhysicsAsset * | GetPhysicsAsset (const FString &InPhysicsAssetName, bool bIsStaticResource=true) |
| Get or load physics asset, GetSimResource with ERRResourceDataType::UE_PHYSICS_ASSET. More... | |
| FORCEINLINE UMaterialInterface * | GetMaterial (const FString &InMaterialName) |
| Get or load material, calling GetSimResource with ERRResourceDataType::UE_MATERIAL. More... | |
| FORCEINLINE UPhysicalMaterial * | GetPhysicalMaterial (const FString &InPhysicalMaterialName) |
| Get or load physical material, calling GetSimResource with ERRResourceDataType::UE_PHYSICAL_MATERIAL. More... | |
| FORCEINLINE UTexture * | GetTexture (const FString &InTextureName, bool bIsStaticResource=true) |
| Get or load texture, calling GetSimResource with ERRResourceDataType::UE_TEXTURE. More... | |
| FORCEINLINE UDataTable * | GetDataTable (const FString &InDataTableName, bool bIsStaticResource=true) |
| Get or load Data table, calling GetSimResource with ERRResourceDataType::UE_DATA_TABLE. More... | |
| FORCEINLINE UBodySetup * | GetBodySetup (const FString &InBodySetupName) |
| Get or load BodySetup, calling GetSimResource with ERRResourceDataType::UE_BODY_SETUP. More... | |
Static Public Member Functions | |
| static URRGameSingleton * | Get () |
| static constexpr const FORCEINLINE TCHAR * | GetAssetNamePrefix (const ERRResourceDataType InDataType) |
| Get name prefix of asset. More... | |
| static FORCEINLINE FString | GetAssetsBasePath (const TCHAR *InModuleName) |
| Get the Assets Base Path object. More... | |
| static FORCEINLINE FString | GetDynamicAssetsBasePath (const TCHAR *InModuleName) |
| Get the dynamic Assets Base Path of a module. More... | |
| static FORCEINLINE TArray< FString > | GetDynamicAssetsBasePathList (const ERRResourceDataType InDataType) |
| Get the Dynamic Assets Path List object. More... | |
| static const FString | GetMeshNameFromShapeType (const ERRShapeType InShapeType) |
| static ERRShapeType | GetShapeTypeFromMeshName (const FString &InMeshName) |
Public Attributes | |
| bool | BSIM_PROFILING = false |
| FString | FOLDER_PATH_ASSET_PAKS = TEXT("Paks") |
| TObjectPtr< URRPakLoader > | PakLoader = nullptr |
| bool | bPakLoaderInitialized = false |
| Whether PakLoader has been initialized, which is only true as in packaged game. More... | |
| FIntPoint | ASSETS_THUMBNAIL_SIZE = {512, 512} |
| FString | ASSETS_RUNTIME_BP_SAVE_BASE_PATH = TEXT("/Game/RapyutaContents/Blueprints") |
| Base path whereby runtime-created blueprint classes are saved, ideally in Project, so it could reference all plugins' assets. More... | |
| FString | FOLDER_PATH_ASSET_STATIC_MESHES = TEXT("StaticMeshes") |
| FString | FOLDER_PATH_ASSET_SKELETAL_MESHES = TEXT("SkeletalMeshes") |
| FString | FOLDER_PATH_ASSET_SKELETONS = TEXT("Skeletons") |
| FString | FOLDER_PATH_PHYSICS_ASSETS = TEXT("PhysicsAssets") |
| FString | FOLDER_PATH_ASSET_MATERIALS = TEXT("Materials") |
| Dynamic Material assets folder path. More... | |
| FString | FOLDER_PATH_ASSET_TEXTURES = TEXT("Textures") |
| Dynamic Texture assets folder path. More... | |
| FString | FOLDER_PATH_ASSET_DATA_TABLES = TEXT("DataTables") |
| Dynamic Data Table assets folder path. More... | |
Static Public Attributes | |
| static TMap< ERRResourceDataType, TArray< const TCHAR * > > | SASSET_OWNING_MODULE_NAMES |
| This list specifically hosts names of which module houses the UE assets based on their data type. More... | |
| static constexpr const TCHAR * | ASSETS_ROOT_PATH = TEXT("/") |
| [ASSETS_ROOT_PATH] only returns base path of assets residing in Plugin, not from Project level, which should starts with [/Game/] More... | |
| static constexpr const TCHAR * | ASSETS_PROJECT_BASE_MODULE_NAME = TEXT("Game") |
| static constexpr const TCHAR * | ASSETS_PROJECT_MODULE_NAME = TEXT("Game/RapyutaContents") |
| static constexpr const TCHAR * | DYNAMIC_CONTENTS_FOLDER_NAME = TEXT("DynamicContents") |
| static constexpr const TCHAR * | SHAPE_NAME_PLANE = TEXT("Plane") |
| static constexpr const TCHAR * | SHAPE_NAME_CUBE = TEXT("Cube") |
| static constexpr const TCHAR * | SHAPE_NAME_CYLINDER = TEXT("Cylinder") |
| static constexpr const TCHAR * | SHAPE_NAME_SPHERE = TEXT("Sphere") |
| static constexpr const TCHAR * | SHAPE_NAME_CAPSULE = TEXT("Capsule") |
| static constexpr const TCHAR * | MATERIAL_NAME_ASSET_MASTER = TEXT("M_RapyutaAssetMaster") |
| static constexpr const TCHAR * | MATERIAL_NAME_PROP_MASTER = TEXT("M_RapyutaPropMaster") |
| static constexpr const TCHAR * | MATERIAL_NAME_PHYSICS_WHEEL = TEXT("PM_Wheel") |
| static constexpr const TCHAR * | MATERIAL_NAME_TRANSLUCENCE_MASTER = TEXT("M_RapyutaTranslucenceMaster") |
| static constexpr const TCHAR * | TEXTURE_NAME_WHITE_MASK = TEXT("T_WhiteMask") |
| static constexpr const TCHAR * | TEXTURE_NAME_BLACK_MASK = TEXT("T_BlackMask") |
Protected Member Functions | |
| URRGameSingleton () | |
Private Attributes | |
| TMap< ERRResourceDataType, FRRResourceInfo > | ResourceMap |
| Async loaded, thus must be thread safe. A map just helps referencing an item faster, though costs some overheads. More... | |
| TArray< TObjectPtr< UObject > > | ResourceStore |
| We need this to escape UObject-based resource Garbage Collection. More... | |
GameSingleton class which handles asset loading.
GameSingleton class can exist during editor usage.
|
protected |
|
virtual |
|
inline |
Update ResourceMap and ResourceStore with dynamically runtime-generated InResourceObject of which soft object path is also created on the fly.
| TResource |
| InDataType | |
| InResourceObject | |
| InResourceUniqueName |
|
inline |
Collate assets info for ResourceMap.
| InDataType |
| InAssetRelativeFolderPath |
|
inline |
Collate assets info.
|
inline |
Collate assets info for ResourceMap.
| TResource |
| InDataType | |
| InAssetRelativeFolderPath |
| bool URRGameSingleton::CollateEntityAssetsInfoFromPAK | ( | const TArray< FString > & | InEntityModelNameList, |
| bool | bInForceReload = false |
||
| ) |
Load PAK files of a specific set of entity models, mounting then then collate their content assets info.
| InEntityModelName | |
| bInForceReload |
| void URRGameSingleton::FinalizeResources | ( | ) |
Finalize ResourceMap by calling FRRResourceInfo::Finalize.
|
static |
|
inlinestaticconstexpr |
|
inlinestatic |
Get the Assets Base Path object.
For particular handling, please set the asset path ending with '/'
This concatenation operator ensure only a single '/' is put in between
| InModuleName |
|
inline |
Get the leaf relative UE path of a folder housing assets of a particular resource data type.
NOTE: This function returns a user-configurable folder path value, thus cannot be made static or constexpr
| InDataType |
|
inline |
Get or load BodySetup, calling GetSimResource with ERRResourceDataType::UE_BODY_SETUP.
| InBodySetupName |
|
inline |
Get or load Data table, calling GetSimResource with ERRResourceDataType::UE_DATA_TABLE.
| InDataTableName | |
| bIsStaticResource |
|
inline |
Get the full UE path of a dynamic asset that is either early loaded at Sim initilization or generated dynamically at runtime.
| InDataType | |
| InAssetName | |
| InModuleName |
|
inlinestatic |
Get the dynamic Assets Base Path of a module.
| InModuleName |
|
inlinestatic |
Get the Dynamic Assets Path List object.
Return the TArray of SASSET_OWNING_MODULE_NAMES[i] / DYNAMIC_CONTENTS_FOLDER_NAME
| InDataType |
|
inline |
Get UE asset path of a dynamically created BP asset.
| InBPAssetName |
Also, in order for them to reference any other arbitrary asset, it's advisable to save them into project's Content (not into plugins)
|
inline |
Get or load material, calling GetSimResource with ERRResourceDataType::UE_MATERIAL.
| InMaterialName |
|
inlinestatic |
|
inline |
Get or load physical material, calling GetSimResource with ERRResourceDataType::UE_PHYSICAL_MATERIAL.
| InPhysicalMaterialName |
|
inline |
Get or load physics asset, GetSimResource with ERRResourceDataType::UE_PHYSICS_ASSET.
| InPhysicsAssetName | |
| bIsStaticResource |
|
inlinestatic |
|
inline |
Get the Sim Resource object, loading if required + updating resource store.
| TResource |
| InDataType | |
| InResourceUniqueName | |
| bIsStaticResource |
|
inline |
|
inline |
Get the Sim Resource Info object from ResourceMap.
| InDataType |
|
inline |
Get the Sim Resource List object with GetSimResourceInfo.
| InDataType |
|
inline |
Get or load skeletal mesh, GetSimResource with ERRResourceDataType::UE_SKELETAL_MESH.
| InSkeletalMeshName | |
| bIsStaticResource |
|
inline |
Get or load physics skeleton, GetSimResource with ERRResourceDataType::UE_SKELETON.
| InSkeletonName | |
| bIsStaticResource |
|
inline |
Get or load static mesh, GetSimResource with ERRResourceDataType::UE_STATIC_MESH.
(NOTE) StaticMesh could be dynamically created
| InStaticMeshName | |
| bIsStaticResource |
|
inline |
Get or load texture, calling GetSimResource with ERRResourceDataType::UE_TEXTURE.
| InTextureName | |
| bIsStaticResource |
|
inline |
Check resource exist with GetSimResourceInfo.
| InDataType | |
| InResourceUniqueName |
| bool URRGameSingleton::HaveAllResourcesBeenLoaded | ( | bool | bIsLogged = false | ) | const |
Check all resources have been loaded or not.
| bIsLogged |
| bool URRGameSingleton::InitializeResources | ( | bool | bInRequestResourceLoading = false | ) |
Read all sim dynamic resouces(Uassets) info from designated folders.
| bInRequestResourceLoading |
|
|
inline |
This is used as param to [FStreamableDelegate::CreateUObject()] thus its params could not be constref-ized.
|
virtual |
|
inline |
Callback to handle an asynchronously loaded resource, which receives a [FSoftObjectPath] that references a valid [UObject].
Then put it into both ResourceMap & ResourceStore.
| TResource |
| InDataType | |
| InResourcePath | |
| InResourceUniqueName |
|
inline |
Collate asset resources info & Async load them by UAssetManager.
| InDataType |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
[ASSETS_ROOT_PATH] only returns base path of assets residing in Plugin, not from Project level, which should starts with [/Game/]
And ideally, Sim should not store common runtime-created assets in Project, since they should be accessible among plugins.
| FString URRGameSingleton::ASSETS_RUNTIME_BP_SAVE_BASE_PATH = TEXT("/Game/RapyutaContents/Blueprints") |
Base path whereby runtime-created blueprint classes are saved, ideally in Project, so it could reference all plugins' assets.
| FIntPoint URRGameSingleton::ASSETS_THUMBNAIL_SIZE = {512, 512} |
| bool URRGameSingleton::bPakLoaderInitialized = false |
Whether PakLoader has been initialized, which is only true as in packaged game.
| bool URRGameSingleton::BSIM_PROFILING = false |
|
staticconstexpr |
| FString URRGameSingleton::FOLDER_PATH_ASSET_DATA_TABLES = TEXT("DataTables") |
Dynamic Data Table assets folder path.
| FString URRGameSingleton::FOLDER_PATH_ASSET_MATERIALS = TEXT("Materials") |
Dynamic Material assets folder path.
| FString URRGameSingleton::FOLDER_PATH_ASSET_PAKS = TEXT("Paks") |
| FString URRGameSingleton::FOLDER_PATH_ASSET_SKELETAL_MESHES = TEXT("SkeletalMeshes") |
| FString URRGameSingleton::FOLDER_PATH_ASSET_SKELETONS = TEXT("Skeletons") |
| FString URRGameSingleton::FOLDER_PATH_ASSET_STATIC_MESHES = TEXT("StaticMeshes") |
| FString URRGameSingleton::FOLDER_PATH_ASSET_TEXTURES = TEXT("Textures") |
Dynamic Texture assets folder path.
| FString URRGameSingleton::FOLDER_PATH_PHYSICS_ASSETS = TEXT("PhysicsAssets") |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
| TObjectPtr<URRPakLoader> URRGameSingleton::PakLoader = nullptr |
|
private |
Async loaded, thus must be thread safe. A map just helps referencing an item faster, though costs some overheads.
Besides, UE does not support UPROPERTY() on a map yet.
|
private |
We need this to escape UObject-based resource Garbage Collection.
|
static |
This list specifically hosts names of which module houses the UE assets based on their data type.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
1.8.17