// 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 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 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 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 };