Skip to content

Commit

Permalink
optimize impl
Browse files Browse the repository at this point in the history
  • Loading branch information
hxhb committed Feb 11, 2023
1 parent 5e52463 commit 5d281bc
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -603,10 +603,15 @@ FCookCluster USingleCookerProxy::GetPackageTrackerAsCluster()
PackageTrackerCluster.AssetDetails.Empty();
for(FName LongPackageName:PackageTracker->GetPendingPackageSet())
{
if(!FPackageName::DoesPackageExist(LongPackageName.ToString()))
{
continue;
}

// make asset data to asset registry
FSoftObjectPath ObjectPath(
UFlibAssetManageHelper::LongPackageNameToPackagePath(LongPackageName.ToString())
);
FString PackagePath = UFlibAssetManageHelper::LongPackageNameToPackagePath(LongPackageName.ToString());

FSoftObjectPath ObjectPath(PackagePath);
UFlibAssetManageHelper::UpdateAssetRegistryData(ObjectPath.GetLongPackageName());

FAssetData AssetData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ bool FAssetDependenciesInfo::HasAsset(const FString& InAssetPackageName)const
return bHas;
}

TArray<FAssetDetail> FAssetDependenciesInfo::GetAssetDetails()const
TArray<FAssetDetail>& FAssetDependenciesInfo::GetAssetDetails()const
{
SCOPED_NAMED_EVENT_TEXT("FAssetDependenciesInfo::GetAssetDetails",FColor::Red);
TArray<FAssetDetail> OutAssetDetails;

OutAssetDetails.Empty();
AssetDetails.Empty();
TArray<FString> Keys;
AssetsDependenciesMap.GetKeys(Keys);

Expand All @@ -59,11 +58,11 @@ TArray<FAssetDetail> FAssetDependenciesInfo::GetAssetDetails()const
for (const auto& ModuleAssetKey : ModuleAssetKeys)
{
FScopeLock Lock(&SynchronizationObject);
OutAssetDetails.Add(*ModuleAssetDetails.Find(ModuleAssetKey));
AssetDetails.Add(*ModuleAssetDetails.Find(ModuleAssetKey));
}
},GForceSingleThread);

return OutAssetDetails;
return AssetDetails;
}

bool FAssetDependenciesInfo::GetAssetDetailByPackageName(const FString& InAssetPackageName,FAssetDetail& OutDetail) const
Expand Down Expand Up @@ -92,3 +91,8 @@ TArray<FString> FAssetDependenciesInfo::GetAssetLongPackageNames()const
}
return OutAssetLongPackageName;
}

void FAssetDependenciesInfo::RemoveAssetDetail(const FAssetDetail& AssetDetail)
{
AssetDetails.Remove(AssetDetail);
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ TSet<FName> FAssetDependenciesParser::GatherAssetDependicesInfoRecursively(
const TSet<FName>& IgnoreAssetTypes,
FScanedCachesType& InScanedCaches)
{
static bool bVerboseLog = FParse::Param(FCommandLine::Get(), TEXT("VerboseLog"));

TSet<FName> AssetDependencies;
SCOPED_NAMED_EVENT_TEXT("GatherAssetDependicesInfoRecursively",FColor::Red);
TArray<FString> TempForceSkipPackageNames = ForceSkipPackageNames;
Expand Down Expand Up @@ -297,10 +299,13 @@ TSet<FName> FAssetDependenciesParser::GatherAssetDependicesInfoRecursively(
{
TSet<FName> Dependencies;
#if ASSET_DEPENDENCIES_DEBUG_LOG
UE_LOG(LogHotPatcher,Display,TEXT("AssetParser %s Dependencies:"),*InLongPackageName.ToString());
for(const auto& AssetPackageName:AssetDependencies)
if(bVerboseLog)
{
UE_LOG(LogHotPatcher,Display,TEXT("\t%s"),*AssetPackageName.ToString());
UE_LOG(LogHotPatcher,Display,TEXT("AssetParser %s Dependencies: (%d)"),*InLongPackageName.ToString(),AssetDependencies.Num());
for(const auto& AssetPackageName:AssetDependencies)
{
UE_LOG(LogHotPatcher,Display,TEXT("\t%s"),*AssetPackageName.ToString());
}
}
#endif
for(const auto& AssetPackageName:AssetDependencies)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ struct HOTPATCHERRUNTIME_API FAssetDependenciesInfo

void AddAssetsDetail(const FAssetDetail& AssetDetail);
bool HasAsset(const FString& InAssetPackageName)const;
TArray<FAssetDetail> GetAssetDetails()const;
TArray<FAssetDetail>& GetAssetDetails()const;
bool GetAssetDetailByPackageName(const FString& InAssetPackageName,FAssetDetail& OutDetail)const;
TArray<FString> GetAssetLongPackageNames()const;
void RemoveAssetDetail(const FAssetDetail& AssetDetail);
protected:
mutable TArray<FAssetDetail> AssetDetails;
};

2 changes: 1 addition & 1 deletion Mods/HotMultiCooker

0 comments on commit 5d281bc

Please sign in to comment.