Files
vertical-partition-system-p…/Source/VerticalPartition/Public/VerticalPartitionVolume.h
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

90 lines
3.4 KiB
C++

// Copyright IHY. Vertical Partition Streaming plugin.
//
// The authoring volume. Drop one around the whole playable spiral, tune the
// settings, and press Build. Bounds come from a UBoxComponent so they are trivial
// to read at both editor and runtime (no BSP brush).
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "VerticalPartitionTypes.h"
#include "VerticalPartitionVolume.generated.h"
class UBoxComponent;
class UVerticalPartitionDescriptor;
class AVerticalPartitionVolume;
/**
* Decouples the runtime volume from the editor-only builder. The editor module
* installs Handler in StartupModule; the volume's CallInEditor buttons and the
* vp.* build console commands route through it. Lives in the runtime module so the
* volume can reference it, but is only ever populated in editor builds.
*/
struct VERTICALPARTITION_API FVerticalPartitionEditorBridge
{
#if WITH_EDITOR
static TFunction<void(AVerticalPartitionVolume*, EVerticalPartitionAction)> Handler;
static void Execute(AVerticalPartitionVolume* Volume, EVerticalPartitionAction Action)
{
if (Handler) { Handler(Volume, Action); }
}
#endif
};
UCLASS(HideCategories=(Collision, Physics, Navigation, HLOD, Input, Replication))
class VERTICALPARTITION_API AVerticalPartitionVolume : public AActor
{
GENERATED_BODY()
public:
AVerticalPartitionVolume();
/** Box that defines the bounded playable region to partition. */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="VerticalPartition")
TObjectPtr<UBoxComponent> Box;
/** Per-volume settings (seeded from project defaults on placement). */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VerticalPartition", meta=(ShowOnlyInnerProperties))
FVerticalPartitionSettings Settings;
/** Descriptor produced by Build; consumed by the runtime manager. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VerticalPartition")
TSoftObjectPtr<UVerticalPartitionDescriptor> Descriptor;
/** World-space bounds of the volume (box transform * extent). */
UFUNCTION(BlueprintPure, Category="VerticalPartition")
FBox GetVolumeBounds() const;
virtual void OnConstruction(const FTransform& Transform) override;
#if WITH_EDITOR
// ---- Detail-panel buttons (mirror the editor tool window) ----
UFUNCTION(CallInEditor, Category="Vertical Partition|1 - Analyze")
void AnalyzeCurrentLevel();
UFUNCTION(CallInEditor, Category="Vertical Partition|2 - Build")
void BuildVerticalPartition();
UFUNCTION(CallInEditor, Category="Vertical Partition|2 - Build")
void RebuildChangedCells();
UFUNCTION(CallInEditor, Category="Vertical Partition|2 - Build")
void RebuildHLOD();
UFUNCTION(CallInEditor, Category="Vertical Partition|3 - Validate")
void ValidateCells();
UFUNCTION(CallInEditor, Category="Vertical Partition|3 - Validate")
void PreviewChunks();
UFUNCTION(CallInEditor, Category="Vertical Partition|3 - Validate")
void SpawnHLODPreview();
UFUNCTION(CallInEditor, Category="Vertical Partition|3 - Validate")
void ClearPreview();
UFUNCTION(CallInEditor, Category="Vertical Partition|4 - Commit")
void CommitConversion();
UFUNCTION(CallInEditor, Category="Vertical Partition|4 - Commit")
void RestoreFromBackup();
UFUNCTION(CallInEditor, Category="Vertical Partition|5 - Maintenance")
void ClearGeneratedData();
UFUNCTION(CallInEditor, Category="Vertical Partition|5 - Maintenance")
void DumpReport();
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
#endif
};