Add BaseLevelNameOverride for dedicated editor maps
PlayerController gets a BaseLevelNameOverride property. When set (e.g. "Warehouse"), scenes are tagged with that level name instead of the auto-detected map name. Use case: editing on "Warehouse_Editor" map but scenes should be associated with the "Warehouse" base level for PROSERVE runtime loading. Save, load list, and scene filtering all respect this override. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,15 @@ public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PS Editor")
|
||||
TSoftObjectPtr<UPS_Editor_MasterCatalog> MasterCatalogAsset;
|
||||
|
||||
/**
|
||||
* Override the level name stored in saved scenes.
|
||||
* If empty, auto-detected from the current map name.
|
||||
* Use this when editing on a dedicated map (e.g. "Warehouse_Editor")
|
||||
* but scenes should be associated with the base level ("Warehouse").
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PS Editor")
|
||||
FString BaseLevelNameOverride;
|
||||
|
||||
// ---- Editor Mode (Normal / SplinePlacement) ----
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "PS Editor")
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "PS_Editor_SpawnManager.h"
|
||||
#include "PS_Editor_SelectionManager.h"
|
||||
#include "PS_Editor_EditableComponent.h"
|
||||
#include "PS_Editor_PlayerController.h"
|
||||
#include "PS_Editor_SplineActor.h"
|
||||
#include "JsonObjectConverter.h"
|
||||
#include "Misc/FileHelper.h"
|
||||
@@ -22,10 +23,14 @@ bool UPS_Editor_SceneSerializer::SaveScene(const FString& SceneName, UPS_Editor_
|
||||
SceneData.SceneName = SceneName;
|
||||
SceneData.Timestamp = FDateTime::Now().ToString();
|
||||
|
||||
// Auto-detect the current level name
|
||||
if (APlayerController* PC = Cast<APlayerController>(GetOuter()))
|
||||
// Use BaseLevelNameOverride if set, otherwise auto-detect from map name
|
||||
if (APS_Editor_PlayerController* EditorPC = Cast<APS_Editor_PlayerController>(GetOuter()))
|
||||
{
|
||||
if (UWorld* World = PC->GetWorld())
|
||||
if (!EditorPC->BaseLevelNameOverride.IsEmpty())
|
||||
{
|
||||
SceneData.LevelName = EditorPC->BaseLevelNameOverride;
|
||||
}
|
||||
else if (UWorld* World = EditorPC->GetWorld())
|
||||
{
|
||||
SceneData.LevelName = World->GetMapName();
|
||||
SceneData.LevelName.RemoveFromStart(World->StreamingLevelsPrefix);
|
||||
|
||||
@@ -570,11 +570,15 @@ void UPS_Editor_MainWidget::PopulateSceneList()
|
||||
UPS_Editor_SceneSerializer* Ser = SceneSerializer.Get();
|
||||
if (!Ser) return;
|
||||
|
||||
// Get current level name for filtering
|
||||
// Get current level name for filtering (use override if set)
|
||||
FString CurrentLevel;
|
||||
if (APlayerController* PC = GetOwningPlayer())
|
||||
if (APS_Editor_PlayerController* EditorPC = Cast<APS_Editor_PlayerController>(GetOwningPlayer()))
|
||||
{
|
||||
if (UWorld* World = PC->GetWorld())
|
||||
if (!EditorPC->BaseLevelNameOverride.IsEmpty())
|
||||
{
|
||||
CurrentLevel = EditorPC->BaseLevelNameOverride;
|
||||
}
|
||||
else if (UWorld* World = EditorPC->GetWorld())
|
||||
{
|
||||
CurrentLevel = World->GetMapName();
|
||||
CurrentLevel.RemoveFromStart(World->StreamingLevelsPrefix);
|
||||
|
||||
Reference in New Issue
Block a user