1. 程式人生 > >[UE4]C++匯出LandScapeInfo,高度圖和MASK

[UE4]C++匯出LandScapeInfo,高度圖和MASK

TArray<UObject*> Results;

GetObjectsOfClass(ALandscapeProxy::StaticClass(), Results);

for(auto& Object:Results)

{

ALandscapeProxy *LandscapeProxy = Cast<ALandscapeProxy>(Object);

if(LandscapeProxy)

{

   ALandscapeProxy*LandscapeInfo = LandscapeProxy->GetLandscapeInfo();

if(LandscapeInfo == nullptr)

continue;

for(int32 i = 0; i < LandscapeInfor->Layers.Num(); ++i)

{

ULandscapeLayerInfoObject* LayerInfo = LandscapeInfo->Layers[i].LayerInfoObj;

if(LayerInfo)

{

FString LayerName = "D:/" + LayerInfo->LayerName.ToString() + ".png";

LandscapeInfor->ExportLayer(LayerInfo, LayerName);

}

}

}

 

 

}