Hello, I am currently trying to modify the ResavePackages commandlet to support rebuilding the landscapes for nanite, physical materials, etc.
I am doing this in UResavePackagesCommandlet::PerformAdditionalOperations function of the ContentCommandlet.cpp file.
In that function I added code so that if the user specifies a -BuildLandscape switch, it will call:
- LandscapeSubsystem::BuildAll()
then the rest of the funcion runs normally, and eventually, the rest of the vanilla commandlet code will save the package.
Things seem to work. I get all the same rebuild log messages in the output as when rebuilding a landscape from the editor.
However after I open the map in the editor, I still keep getting the warning about Landscape actor being outdated and that it needs to be rebuilt. I even passed -AllowCommandletRendering incase the process required GPU access, but got the same result.
This doesn’t happen if I rebuild the landscape from the editor, and as far as I could tell, it calls the same functions essentially.
Do you know what am I missing here?
Thanks!
`if (bBuildLandscapes)
{
ULandscapeSubsystem* LandscapeSubsystemPtr = World->GetSubsystem();
if (IsValid(LandscapeSubsystemPtr))
{
TArray<TTuple<ALandscapeProxy*, UE::Landscape::EOutdatedDataFlags>> ProxyDetails =
LandscapeSubsystemPtr->GetOutdatedProxyDetails(UE::Landscape::EOutdatedDataFlags::All, false);
bShouldProceedWithRebuild = bShouldBuildNavigationData;
for (auto Proxy : ProxyDetails)
{
ULevel* OuterLevel = Cast(Proxy.Key->GetLandscapeActor()->GetOuter());
if (OuterLevel && OuterLevel->IsPersistentLevel())
{
FString MapPackageName;
if (!FPackageName::DoesPackageExist(World->GetPackage()->GetName(), &MapPackageName))
{
continue;
}
// Maybe not needed, but checked out here just in case
// that was the issue. Checking out does work
if (!CheckoutFile(MapPackageName))
{
continue;
}
LandscapeSubsystemPtr->BuildAll();
bShouldProceedWithRebuild = true;
break;
}
}
}
else if (!bShouldBuildNavigationData)
{
bShouldProceedWithRebuild = false;
}
}`