bShowBackground

bShowBackground

#Overview

name: bShowBackground

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 15 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bShowBackground is to control the visibility of background elements in various Unreal Engine 5 subsystems and user interface components. This variable is used across different modules and plugins to toggle the display of background elements, which can affect the visual presentation and user experience in different contexts.

bShowBackground is utilized in several Unreal Engine subsystems, plugins, and modules, including:

  1. Niagara Editor: Used in the SNiagaraSystemViewport class to control the visibility of the preview background.
  2. Online Subsystem: Used in the OnlineExternalUIInterface to manage the display of background elements in web-based UI components.
  3. XR Base: Used in the StereoLayerManager to control the visibility of background layers in XR applications.
  4. World Partition Editor: Used to control the background display of actor labels in the 2D grid view.
  5. Slate: Used in the MenuStack to determine whether a background should be shown for menu content.

The value of this variable is typically set within the specific contexts where it’s used. For example:

bShowBackground often interacts with other variables related to UI and rendering settings, such as bShowCloseButton, bHideCursor, and other visibility flags.

Developers should be aware that:

  1. The effect of bShowBackground can vary depending on the context in which it’s used.
  2. Changing this value may affect performance, especially in rendering-intensive scenarios like XR applications.
  3. It may impact the user experience and the visibility of other UI elements.

Best practices when using this variable include:

  1. Consider the performance implications, especially in performance-critical areas.
  2. Ensure that toggling the background doesn’t negatively impact the visibility or usability of other UI elements.
  3. Use it consistently within a given context to maintain a coherent user experience.
  4. When working with XR applications, be mindful of how background visibility affects the immersive experience.
  5. In editor tools, provide users with the option to toggle the background visibility when appropriate.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:483, section: [/Script/UnrealEd.MaterialEditorOptions]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/Widgets/SNiagaraSystemViewport.cpp:760

Scope (from outer to inner):

file
function     void SNiagaraSystemViewport::Construct

Source code excerpt:

	DrawFlags |= Settings->IsShowStatelessInfo() ? EDrawElements::StatelessInfo : 0;

	bShowBackground = false;
	PreviewComponent = nullptr;
	AdvancedPreviewScene = MakeShareable(new FAdvancedPreviewScene(FPreviewScene::ConstructionValues()));
	AdvancedPreviewScene->SetFloorVisibility(false);

	float Pitch = -40.0;
	float Yaw = 128.0;

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/Widgets/SNiagaraSystemViewport.cpp:1109

Scope (from outer to inner):

file
function     void SNiagaraSystemViewport::TogglePreviewBackground

Source code excerpt:

void SNiagaraSystemViewport::TogglePreviewBackground()
{
	bShowBackground = !bShowBackground;
	// @todo DB: Set the background mesh for the preview viewport.
	RefreshViewport();
}

bool SNiagaraSystemViewport::IsTogglePreviewBackgroundChecked() const
{
	return bShowBackground;
}

TSharedRef<FEditorViewportClient> SNiagaraSystemViewport::MakeEditorViewportClient()
{
	SystemViewportClient = MakeShareable( new FNiagaraSystemViewportClient(*AdvancedPreviewScene.Get(), SharedThis(this),
		FNiagaraSystemViewportClient::FOnScreenShotCaptured::CreateSP(this, &SNiagaraSystemViewport::OnScreenShotCaptured) ) );

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/Widgets/SNiagaraSystemViewport.h:54

Scope (from outer to inner):

file
class        class SNiagaraSystemViewport : public SEditorViewport, public FGCObject, public ICommonEditorViewportToolbarInfoProvider

Source code excerpt:

	
	/** If true, render background object in the preview scene. */
	bool bShowBackground;

	TSharedRef<class FAdvancedPreviewScene> GetPreviewScene() const { return AdvancedPreviewScene.ToSharedRef(); }
	TWeakPtr<FNiagaraSystemViewModel> GetSystemViewModel() { return SystemViewModel; }
	
	/** The material editor has been added to a tab */
	void OnAddedToTab( const TSharedRef<SDockTab>& OwnerTab );

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystem/Source/Public/Interfaces/OnlineExternalUIInterface.h:170

Scope: file

Source code excerpt:

	bool bShowCloseButton;
	/** Show the built in background */
	bool bShowBackground;
	/** Hide the mouse cursor */
	bool bHideCursor;
	/** Rest cookies before invoking web browser */
	bool bResetCookies;
	/** x offset in pixels from top left */
	int32 OffsetX;

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystem/Source/Public/Interfaces/OnlineExternalUIInterface.h:194

Scope (from outer to inner):

file
function     FShowWebUrlParams

Source code excerpt:

		: bEmbedded(InbEmbedded)
		, bShowCloseButton(false)
		, bShowBackground(false)
		, bHideCursor(false)
		, bResetCookies(false)
		, OffsetX(InOffsetX)
		, OffsetY(InOffsetY)
		, SizeX(InSizeX)
		, SizeY(InSizeY)

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystem/Source/Public/Interfaces/OnlineExternalUIInterface.h:209

Scope (from outer to inner):

file
function     FShowWebUrlParams

Source code excerpt:

		: bEmbedded(false)
		, bShowCloseButton(false)
		, bShowBackground(false)
		, bHideCursor(false)
		, bResetCookies(false)
		, OffsetX(0)
		, OffsetY(0)
		, SizeX(0)
		, SizeY(0)

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/OnlineEngineInterfaceImpl.cpp:518

Scope (from outer to inner):

file
function     void UOnlineEngineInterfaceImpl::ShowWebURL

Source code excerpt:

			::FShowWebUrlParams Params;
			Params.bEmbedded = ShowParams.bEmbedded;
			Params.bShowBackground = ShowParams.bShowBackground;
			Params.bShowCloseButton = ShowParams.bShowCloseButton;
			Params.bHideCursor = ShowParams.bHideCursor;
			Params.OffsetX = ShowParams.OffsetX;
			Params.OffsetY = ShowParams.OffsetY;
			Params.SizeX = ShowParams.SizeX;
			Params.SizeY = ShowParams.SizeY;

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Public/StereoLayerManager.h:85

Scope (from outer to inner):

file
class        class TStereoLayerManager : public IStereoLayers

Source code excerpt:

		TMap<uint32, LayerType> Layers;
		uint32 NextLayerId;
		bool bShowBackground;

		FLayerData(uint32 InNext, bool bInShowBackground = true) : Layers(), NextLayerId(InNext), bShowBackground(bInShowBackground) {}
		FLayerData(const FLayerData& In) : Layers(In.Layers), NextLayerId(In.NextLayerId), bShowBackground(In.bShowBackground) {}
	};
	TArray<FLayerData> LayerStack;

	FLayerData& LayerState(int Level=0) { return LayerStack.Last(Level); }
	//const FLayerData& LayerState(int Level = 0) const { return LayerStack.Last(Level); }
	TMap<uint32, LayerType>& StereoLayers(int Level = 0) { return LayerState(Level).Layers; }

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Public/StereoLayerManager.h:299

Scope (from outer to inner):

file
class        class TStereoLayerManager : public IStereoLayers
function     virtual void PushLayerState

Source code excerpt:


			// New layers should continue using unique layer ids
			LayerStack.Emplace(CurrentState.NextLayerId, CurrentState.bShowBackground);
			bStereoLayersDirty = true;
		}
	}

	virtual void PopLayerState() override
	{

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Public/StereoLayerManager.h:370

Scope (from outer to inner):

file
class        class TStereoLayerManager : public IStereoLayers
function     virtual void HideBackgroundLayer

Source code excerpt:

	virtual bool SupportsLayerState() override { return true; }

	virtual void HideBackgroundLayer() { LayerState().bShowBackground = false; }
	virtual void ShowBackgroundLayer() { LayerState().bShowBackground = true; }
	virtual bool IsBackgroundLayerVisible() const { return LayerStack.Last().bShowBackground; }

	virtual void UpdateSplashScreen() override { IXRLoadingScreen::ShowLoadingScreen_Compat(bSplashIsShown, (bSplashShowMovie && SplashMovie.IsValid()) ? SplashMovie : SplashTexture, SplashOffset, SplashScale); }

};

class XRBASE_API FSimpleLayerManager : public TStereoLayerManager<IStereoLayers::FLayerDesc>

#Loc: <Workspace>/Engine/Source/Editor/WorldPartitionEditor/Private/WorldPartition/SWorldPartitionEditorGrid2D.cpp:1437

Scope (from outer to inner):

file
function     uint32 SWorldPartitionEditorGrid2D::PaintActors
lambda-function

Source code excerpt:

	}

	auto DrawActorLabel = [this, &OutDrawElements, &LayerId, &AllottedGeometry](const FString& Label, const FVector2D& Pos, const FPaintGeometry& Geometry, const FLinearColor& Color, const FSlateFontInfo& Font, bool bShowBackground)
	{
		const FVector2D LabelTextSize = FSlateApplication::Get().GetRenderer()->GetFontMeasureService()->Measure(Label, Font);

		if (LabelTextSize.X > 0)
		{
			const FVector2D BackgroundGrowSize(2.0f);
			const FVector2D LabelTextPos = Pos - LabelTextSize * 0.5f;

			if (bShowBackground)
			{
				const FSlateColorBrush BackgroundBrush(USlateThemeManager::Get().GetColor(EStyleColor::Black));
				const FLinearColor LabelBackgroundColor = USlateThemeManager::Get().GetColor(EStyleColor::Black).CopyWithNewOpacity(Color.A * 0.1f);

				FSlateDrawElement::MakeBox(
					OutDrawElements,

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/OnlineEngineInterface.h:199

Scope (from outer to inner):

file
class        class UOnlineEngineInterface : public UObject

Source code excerpt:

		bool bShowCloseButton;
		/** Show the built in background */
		bool bShowBackground;
		/** Hide the mouse cursor */
		bool bHideCursor;
		/** Rest cookies before invoking web browser */
		bool bResetCookies;
		/** x offset in pixels from top left */
		int32 OffsetX;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/OnlineEngineInterface.h:223

Scope (from outer to inner):

file
class        class UOnlineEngineInterface : public UObject
function     FShowWebUrlParams

Source code excerpt:

			: bEmbedded(InbEmbedded)
			, bShowCloseButton(false)
			, bShowBackground(false)
			, bHideCursor(false)
			, bResetCookies(false)
			, OffsetX(InOffsetX)
			, OffsetY(InOffsetY)
			, SizeX(InSizeX)
			, SizeY(InSizeY)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/OnlineEngineInterface.h:239

Scope (from outer to inner):

file
class        class UOnlineEngineInterface : public UObject
function     FShowWebUrlParams

Source code excerpt:

			: bEmbedded(false)
			, bShowCloseButton(false)
			, bShowBackground(false)
			, bHideCursor(false)
			, bResetCookies(false)
			, OffsetX(0)
			, OffsetY(0)
			, SizeX(0)
			, SizeY(0)

#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/MenuStack.cpp:763

Scope (from outer to inner):

file
function     TSharedRef<SWidget> FMenuStack::WrapContent

Source code excerpt:

		.OptionalMinMenuWidth(OptionalMinWidth)
		.OptionalMinMenuHeight(OptionalMinHeight)
		.bShowBackground(bShouldShowBackground)
		.MenuContent()
		[
				InContent
		];
}