Skip to content

Commit

Permalink
fix: Fix failed cooking
Browse files Browse the repository at this point in the history
  • Loading branch information
Panakotta00 committed Jul 8, 2024
1 parent 4792fee commit 2c05b33
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Source/FicsItNetworks/Private/Reflection/FINReflection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,32 @@ void FFINReflection::LoadAllTypes() {
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(FName("AssetRegistry"));
IAssetRegistry& AssetRegistry = AssetRegistryModule.Get();

#if WITH_EDITOR
TArray<FString> PathsToScan;
PathsToScan.Add(TEXT("/FicsItNetworks/"));
AssetRegistry.ScanPathsSynchronous(PathsToScan, true);

TArray<FAssetData> AssetData;
FARFilter Filter;
Filter.bRecursivePaths = true;
Filter.bRecursiveClasses = true;
Filter.PackagePaths.Add("/");
Filter.ClassPaths.Add(UBlueprint::StaticClass()->GetClassPathName());
Filter.ClassPaths.Add(UBlueprintGeneratedClass::StaticClass()->GetClassPathName());
Filter.ClassPaths.Add(UClass::StaticClass()->GetClassPathName());
AssetRegistry.GetAssets(Filter, AssetData);

for (const FAssetData& Asset : AssetData) {
FString Path = Asset.GetObjectPathString();
if (!Path.EndsWith("_C")) Path += "_C";
UClass* Class = LoadClass<UObject>(NULL, *Path);
if (!Class) {
Class = LoadClass<UObject>(NULL, *Path);
}
if (!Class) continue;
FindClass(Class);
}
#else
TArray<FTopLevelAssetPath> BaseNames;
BaseNames.Add(UObject::StaticClass()->GetClassPathName());
TSet<FTopLevelAssetPath> Excluded;
Expand All @@ -51,6 +77,7 @@ void FFINReflection::LoadAllTypes() {
if (Class->GetClassFlags() & (CLASS_Abstract | CLASS_Hidden) || Class->GetName().StartsWith("SKEL_")) continue;
FindClass(Class);
}
#endif

for (TObjectIterator<UClass> Class; Class; ++Class) {
if (!Class->GetName().StartsWith("SKEL_") && !Class->GetName().StartsWith("REINST_")) FindClass(*Class);
Expand Down

0 comments on commit 2c05b33

Please sign in to comment.