Files
vertical-partition-system-p…/Source/VerticalPartitionEditor/Private/VerticalPartitionCommandlet.cpp
Bonchellon 04ad6d3f25 Initial commit: Vertical Partition Streaming plugin (UE 5.7)
Bounded vertical route partition / streaming for handcrafted spiral climb maps
(Only Up / Only Climb). Not World Partition, not Level Instances as core arch.

- Z-cell segmentation + optional XY subcells, editor builder + commandlet
- NonDestructive visibility backend + streaming-level backend
- Offline HLOD proxies: MergedMesh / SimplifiedProxy (ProxyLOD)
- Universal Level Instance + Packed Level Actor + HISM support (flatten+merge)
- Vertical-aware runtime streamer (full/preload/HLOD/unload, hysteresis,
  velocity prediction, fall-risk), WP-style debug viz + vp.* console
- Safe-by-default: only static decor streams; sky/lights/gameplay stay persistent

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 17:42:41 +03:00

63 lines
1.8 KiB
C++

// Copyright IHY. Vertical Partition Streaming plugin (editor module).
#include "VerticalPartitionCommandlet.h"
#include "VerticalPartitionBuilder.h"
#include "VerticalPartitionVolume.h"
#include "VerticalPartitionLog.h"
#include "EngineUtils.h"
#include "Engine/World.h"
#include "FileHelpers.h"
#include "Misc/PackageName.h"
#include "UObject/Package.h"
UVerticalPartitionCommandlet::UVerticalPartitionCommandlet()
{
IsClient = false;
IsServer = false;
IsEditor = true;
LogToConsole = true;
}
int32 UVerticalPartitionCommandlet::Main(const FString& Params)
{
FString MapPath;
if (!FParse::Value(*Params, TEXT("Map="), MapPath) || MapPath.IsEmpty())
{
UE_LOG(LogVerticalPartition, Error, TEXT("[VP] Commandlet requires -Map=/Game/Maps/MyMap"));
return 1;
}
UE_LOG(LogVerticalPartition, Log, TEXT("[VP] Commandlet loading map %s ..."), *MapPath);
UWorld* World = UEditorLoadingAndSavingUtils::LoadMap(MapPath);
if (!World)
{
UE_LOG(LogVerticalPartition, Error, TEXT("[VP] Failed to load map %s"), *MapPath);
return 1;
}
AVerticalPartitionVolume* Volume = nullptr;
for (TActorIterator<AVerticalPartitionVolume> It(World); It; ++It)
{
Volume = *It;
break;
}
if (!Volume)
{
UE_LOG(LogVerticalPartition, Error, TEXT("[VP] No AVerticalPartitionVolume in %s"), *MapPath);
return 1;
}
FVerticalPartitionBuildReport Report;
const bool bOk = UVerticalPartitionBuilder::Build(Volume, Report);
UVerticalPartitionBuilder::DumpReport(Report, FPackageName::GetShortName(MapPath));
if (bOk)
{
TArray<UPackage*> ToSave;
ToSave.Add(World->GetOutermost());
FEditorFileUtils::PromptForCheckoutAndSave(ToSave, /*bCheckDirty*/false, /*bPromptToSave*/false);
UE_LOG(LogVerticalPartition, Log, TEXT("[VP] Commandlet build OK: %d cells."), Report.GeneratedCells);
}
return bOk ? 0 : 1;
}