ShowFlag.EditingLevelInstance
ShowFlag.EditingLevelInstance
#Overview
name: ShowFlag.EditingLevelInstance
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Allows to override a specific showflag (works in editor and game, \
It is referenced in 10
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.EditingLevelInstance is to enable visualization of level instance editing in Unreal Engine’s post-processing pipeline. This setting variable is used primarily in the editor for debugging and visualization purposes.
Key points about ShowFlag.EditingLevelInstance:
-
It is used by the rendering system, specifically in the post-processing passes.
-
The Unreal Engine editor and the LevelInstanceEditor module rely on this setting variable.
-
The value is set based on several conditions:
- It’s only enabled in the editor (GIsEditor is true)
- EngineShowFlags.EditingLevelInstance must be true
- EngineShowFlags.VisualizeLevelInstanceEditing must be true
- HDR visualization must be disabled (bVisualizeHDR is false)
-
It interacts with other engine show flags and visualization settings.
-
Developers should be aware that this variable is only relevant in editor builds and won’t have any effect in shipping builds.
-
Best practices include using this flag in conjunction with other level instance editing tools and visualizations for effective debugging and editing of level instances.
Regarding the associated variable EditingLevelInstance:
The purpose of EditingLevelInstance is to track whether a level instance is currently being edited. It is used in various parts of the engine to modify behavior when editing a level instance.
Key points about EditingLevelInstance:
-
It is used by the LevelInstanceEditor module and other parts of the engine that need to be aware of level instance editing.
-
The value is typically set by the LevelInstanceSubsystem when entering or exiting level instance editing mode.
-
It affects various engine systems, including selection, actor interaction, and viewport rendering.
-
Developers should be aware that this variable can affect the behavior of many engine systems when working with level instances.
-
Best practices include properly managing this variable when implementing custom level instance editing tools or workflows.
Both variables work together to enable and visualize level instance editing in the Unreal Engine editor, providing developers with tools to work effectively with level instances.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:253
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeLevelInstanceEditing, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeLevelInstanceEditingSF", "Visualize Level Instance Editing"))
/** Used to determine whether there are any editing LevelInstances to enable the post processing pass */
SHOWFLAG_FIXED_IN_SHIPPING(0, EditingLevelInstance, SFG_Transient, NSLOCTEXT("UnrealEd", "EditingLevelInstanceSF", "Editing LevelInstance"))
/** Draws mode specific widgets and controls in the viewports (should only be set on viewport clients that are editing the level itself) */
SHOWFLAG_FIXED_IN_SHIPPING(0, ModeWidgets, SFG_Advanced, NSLOCTEXT("UnrealEd", "ModeWidgetsSF", "Mode Widgets"))
/** */
SHOWFLAG_FIXED_IN_SHIPPING(0, Bounds, SFG_Advanced, NSLOCTEXT("UnrealEd", "BoundsSF", "Bounds"))
/** Draws each hit proxy in the scene with a different color, for now only available in the editor */
SHOWFLAG_FIXED_IN_SHIPPING(0, HitProxies, SFG_Developer, NSLOCTEXT("UnrealEd", "HitProxiesSF", "Hit Proxies"))
#Associated Variable and Callsites
This variable is associated with another variable named EditingLevelInstance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Editor/LevelInstanceEditor/Private/LevelInstanceEditorMode.cpp:50
Scope (from outer to inner):
file
function void ULevelInstanceEditorMode::UpdateEngineShowFlags
Source code excerpt:
const bool bEditingLevelInstance = IsContextRestrictedForWorld(LevelVC->GetWorld());
// Make sure we update both Game/Editor showflags
LevelVC->EngineShowFlags.EditingLevelInstance = bEditingLevelInstance;
LevelVC->LastEngineShowFlags.EditingLevelInstance = bEditingLevelInstance;
}
}
}
}
void ULevelInstanceEditorMode::Enter()
#Loc: <Workspace>/Engine/Source/Editor/LevelInstanceEditor/Private/LevelInstanceEditorMode.cpp:149
Scope (from outer to inner):
file
function bool ULevelInstanceEditorMode::IsSelectionDisallowed
Source code excerpt:
if (ULevelInstanceSubsystem* LevelInstanceSubsystem = World->GetSubsystem<ULevelInstanceSubsystem>())
{
ILevelInstanceInterface* EditingLevelInstance = LevelInstanceSubsystem->GetEditingLevelInstance();
ILevelInstanceInterface* LevelInstance = LevelInstanceSubsystem->GetParentLevelInstance(InActor);
// Allow selection on actors that are part of the currently edited Level Instance hierarchy because AActor::GetRootSelectionParent() will eventually
// Bubble up the selection to its parent.
while (LevelInstance != nullptr)
{
if (LevelInstance == EditingLevelInstance)
{
return false;
}
LevelInstance = LevelInstanceSubsystem->GetParentLevelInstance(CastChecked<AActor>(LevelInstance));
}
return EditingLevelInstance != nullptr;
}
}
return bRestrict;
}
#Loc: <Workspace>/Engine/Source/Editor/LevelInstanceEditor/Private/LevelInstanceEditorMode.cpp:200
Scope (from outer to inner):
file
function bool ULevelInstanceEditorMode::IsContextRestrictedForWorld
Source code excerpt:
if (ULevelInstanceSubsystem* LevelInstanceSubsystem = InWorld? InWorld->GetSubsystem<ULevelInstanceSubsystem>() : nullptr)
{
if (ILevelInstanceInterface* EditingLevelInstance = LevelInstanceSubsystem->GetEditingLevelInstance())
{
return bContextRestriction && LevelInstanceSubsystem->GetLevelInstanceLevel(EditingLevelInstance) == InWorld->GetCurrentLevel();
}
}
return false;
}
#Loc: <Workspace>/Engine/Source/Editor/LevelInstanceEditor/Private/LevelInstanceEditorModeToolkit.cpp:36
Scope (from outer to inner):
file
function void FLevelInstanceEditorModeToolkit::Init
Source code excerpt:
check(LevelInstanceSubsystem);
const ILevelInstanceInterface* EditingLevelInstance = LevelInstanceSubsystem->GetEditingLevelInstance();
check(EditingLevelInstance);
const TSoftObjectPtr<UWorld> WorldAsset = EditingLevelInstance->GetWorldAsset();
const FString WorldAssetName = WorldAsset.GetAssetName();
FText DisplayText = FText::FromString(WorldAsset.GetAssetName());
ILevelInstanceEditorModule& EditorModule = FModuleManager::GetModuleChecked<ILevelInstanceEditorModule>("LevelInstanceEditor");
// ViewportOverlay
#Loc: <Workspace>/Engine/Source/Editor/SceneOutliner/Private/ActorFolderTreeItem.cpp:407
Scope (from outer to inner):
file
function bool FActorFolderTreeItem::CanInteract
Source code excerpt:
if (ULevelInstanceSubsystem* LevelInstanceSubsystem = World.IsValid() ? World->GetSubsystem<ULevelInstanceSubsystem>() : nullptr)
{
if (ILevelInstanceInterface* EditingLevelInstance = LevelInstanceSubsystem->GetEditingLevelInstance())
{
if (GetRootObject() != FFolder::FRootObject(CastChecked<AActor>(EditingLevelInstance)))
{
return false;
}
}
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/WorldFolders.cpp:200
Scope (from outer to inner):
file
function FFolder UWorldFolders::GetActorEditorContextFolder
Source code excerpt:
{
ULevelInstanceSubsystem* LevelInstanceSubsystem = GetWorld()->GetSubsystem<ULevelInstanceSubsystem>();
ILevelInstanceInterface* EditingLevelInstance = LevelInstanceSubsystem ? LevelInstanceSubsystem->GetEditingLevelInstance() : nullptr;
if (UObject* EditingLevelInstanceObject = EditingLevelInstance ? CastChecked<UObject>(EditingLevelInstance) : nullptr)
{
FFolder::FRootObject RootObject = FFolder::FRootObject(EditingLevelInstanceObject);
if (Folder.GetRootObject() == RootObject)
{
return Folder;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LevelInstance/LevelInstanceSubsystem.cpp:1456
Scope (from outer to inner):
file
function ILevelInstanceInterface* ULevelInstanceSubsystem::CreateLevelInstanceFrom
Source code excerpt:
// After commit, CurrentLevel goes back to world's PersistentLevel. Set it back to the current editing level instance (if any).
if (ILevelInstanceInterface* EditingLevelInstance = GetEditingLevelInstance())
{
SetCurrent(EditingLevelInstance);
}
return GetLevelInstance(NewLevelInstanceID);
}
bool ULevelInstanceSubsystem::BreakLevelInstance(ILevelInstanceInterface* LevelInstance, uint32 Levels /* = 1 */,
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:253
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeLevelInstanceEditing, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeLevelInstanceEditingSF", "Visualize Level Instance Editing"))
/** Used to determine whether there are any editing LevelInstances to enable the post processing pass */
SHOWFLAG_FIXED_IN_SHIPPING(0, EditingLevelInstance, SFG_Transient, NSLOCTEXT("UnrealEd", "EditingLevelInstanceSF", "Editing LevelInstance"))
/** Draws mode specific widgets and controls in the viewports (should only be set on viewport clients that are editing the level itself) */
SHOWFLAG_FIXED_IN_SHIPPING(0, ModeWidgets, SFG_Advanced, NSLOCTEXT("UnrealEd", "ModeWidgetsSF", "Mode Widgets"))
/** */
SHOWFLAG_FIXED_IN_SHIPPING(0, Bounds, SFG_Advanced, NSLOCTEXT("UnrealEd", "BoundsSF", "Bounds"))
/** Draws each hit proxy in the scene with a different color, for now only available in the editor */
SHOWFLAG_FIXED_IN_SHIPPING(0, HitProxies, SFG_Developer, NSLOCTEXT("UnrealEd", "HitProxiesSF", "Hit Proxies"))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:472
Scope (from outer to inner):
file
function void AddPostProcessingPasses
Source code excerpt:
PassSequence.SetEnabled(EPass::VisualizeSkyLightIlluminanceMeter, Scene&& Scene->SkyLight && View.Family && View.Family->EngineShowFlags.VisualizeSkyLightIlluminance);
PassSequence.SetEnabled(EPass::VisualizeLightFunctionAtlas, Scene && Scene->LightFunctionAtlasSceneData.GetLightFunctionAtlasEnabled() && View.Family && View.Family->EngineShowFlags.VisualizeLightFunctionAtlas);
PassSequence.SetEnabled(EPass::VisualizeLevelInstance, GIsEditor && EngineShowFlags.EditingLevelInstance && EngineShowFlags.VisualizeLevelInstanceEditing && !bVisualizeHDR);
PassSequence.SetEnabled(EPass::SelectionOutline, GIsEditor && EngineShowFlags.Selection && EngineShowFlags.SelectionOutline && !EngineShowFlags.Wireframe && !bVisualizeHDR);
PassSequence.SetEnabled(EPass::EditorPrimitive, FSceneRenderer::ShouldCompositeEditorPrimitives(View));
#else
PassSequence.SetEnabled(EPass::VisualizeSkyAtmosphere, false);
PassSequence.SetEnabled(EPass::VisualizeSkyLightIlluminanceMeter, false);
PassSequence.SetEnabled(EPass::VisualizeLightFunctionAtlas, false);