ShowFlag.WidgetComponents
ShowFlag.WidgetComponents
#Overview
name: ShowFlag.WidgetComponents
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 19
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.WidgetComponents is to control the visibility of Widget Components in the Unreal Engine scene. This setting is primarily used for rendering and visualization purposes.
ShowFlag.WidgetComponents is mainly used by the rendering system in Unreal Engine. It is referenced in various parts of the engine, including:
- The engine’s core rendering system
- The VR Editor subsystem
- The UMG (Unreal Motion Graphics) module
The value of this variable is typically set through the engine’s show flags system, which allows developers and users to toggle various rendering features on and off.
This variable interacts with other rendering-related variables and systems, particularly those related to visibility and scene composition. It’s often used in conjunction with other show flags to determine what elements should be rendered in a given view.
Developers should be aware that:
- This flag affects the visibility of all Widget Components in the scene.
- It’s part of the engine’s show flags system, which is used for debugging and visualization purposes.
- Disabling this flag can improve performance by reducing the number of elements rendered, but at the cost of hiding potentially important UI elements.
Best practices when using this variable include:
- Use it for debugging and development purposes to isolate UI-related rendering issues.
- Be cautious when disabling it in shipping builds, as it may hide important UI elements.
- Consider performance implications when deciding whether to render Widget Components in performance-critical scenarios.
Regarding the associated variable WidgetComponents:
The purpose of WidgetComponents is to store and manage a collection of UVREditorWidgetComponent objects, which are likely used to represent UI elements in a VR editing environment.
This variable is primarily used in the VR Editor subsystem of Unreal Engine. It’s referenced in various functions related to setting up, managing, and interacting with UI elements in a VR editing context.
The value of this variable is set and modified within the VREditorRadialFloatingUI class, which appears to be responsible for managing a radial UI in VR.
WidgetComponents interacts closely with other parts of the VR editing system, including input handling, UI layout, and rendering.
Developers should be aware that:
- This variable represents the core UI elements in a VR editing environment.
- Modifying this collection can have significant impacts on the VR editor’s user interface.
- It’s closely tied to VR-specific functionality and may not be relevant in non-VR contexts.
Best practices when using this variable include:
- Ensure proper setup and teardown of widget components to avoid memory leaks or rendering artifacts.
- Consider performance implications when adding or removing widget components, especially in VR where maintaining high frame rates is crucial.
- Coordinate changes to this collection with other parts of the VR editing system to maintain consistency in the user interface.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:377
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, VirtualTexturePendingMips, SFG_Hidden, NSLOCTEXT("UnrealEd", "VirtualTexturePendingMips", "Virtual Texture Pending Mips"))
/** If WidgetComponents should be rendered in the scene */
SHOWFLAG_ALWAYS_ACCESSIBLE(WidgetComponents, SFG_Normal, NSLOCTEXT("UnrealEd", "WidgetComponentsSF", "Widget Components"))
/** Draw the bones of all skeletal meshes */
SHOWFLAG_FIXED_IN_SHIPPING(0, Bones, SFG_Developer, NSLOCTEXT("UnrealEd", "BoneSF", "Bones"))
/** Draw debug rendering from the Dedicated Server during Play In Editor (with Use Dedicated Server checked) in this client viewport */
SHOWFLAG_FIXED_IN_SHIPPING(0, ServerDrawDebug, SFG_Developer, NSLOCTEXT("UnrealEd", "ServerDrawDebugSF", "Dedicated Server Debug Drawing"))
/** If media planes should be shown */
SHOWFLAG_ALWAYS_ACCESSIBLE(MediaPlanes, SFG_Normal, NSLOCTEXT("UnrealEd", "MediaPlanesSF", "Media Planes"))
#Associated Variable and Callsites
This variable is associated with another variable named WidgetComponents
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Runtime/nDisplay/Source/DisplayCluster/Private/Game/EngineClasses/Scene/DisplayClusterWidgetComponent.cpp:193
Scope (from outer to inner):
file
class class FEditorWidgetBillboardProxy final : public FPrimitiveSceneProxy
function virtual FPrimitiveViewRelevance GetViewRelevance
Source code excerpt:
}
Result.bDrawRelevance = IsShown(View) && View->Family->EngineShowFlags.WidgetComponents;
Result.bDynamicRelevance = true;
Result.bShadowRelevance = IsShadowCast(View);
Result.bEditorPrimitiveRelevance = UseEditorCompositing(View);
return Result;
}
#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorRadialFloatingUI.cpp:139
Scope (from outer to inner):
file
function void AVREditorRadialFloatingUI::SetupWidgetComponent
Source code excerpt:
NewWidgetComponent->SetBlendMode( EWidgetBlendMode::Masked );
const int32 PositionSoFar = WidgetComponents.Num();
const float Radius = 14.0f * WorldScaleFactor;
float RadialX = -Radius * FMath::Sin(PositionSoFar * ((2.0f*PI) / NumberOfEntries));
float RadialY = Radius * FMath::Cos(PositionSoFar * ((2.0f*PI) / NumberOfEntries));
NewWidgetComponent->SetRelativeScale3D(FVector(1.0f / 25.0f) * WorldScaleFactor);
NewWidgetComponent->SetRelativeLocation(FVector(0.0f, RadialX, RadialY));
#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorRadialFloatingUI.cpp:156
Scope (from outer to inner):
file
function void AVREditorRadialFloatingUI::SetupWidgetComponent
Source code excerpt:
}
WidgetComponents.Add(NewWidgetComponent);
}
void AVREditorRadialFloatingUI::Reset()
{
for (UVREditorWidgetComponent* WidgetComponent : WidgetComponents)
{
if (WidgetComponent != nullptr)
{
// NOTE: We're nulling out widgets so that we don't have to wait for a GC to free up Slate resources (avoid shutdown crash)
WidgetComponent->SetSlateWidget(nullptr);
WidgetComponent->DestroyComponent();
#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorRadialFloatingUI.cpp:176
Scope (from outer to inner):
file
function void AVREditorRadialFloatingUI::Reset
Source code excerpt:
SlateWidget = nullptr;
}
WidgetComponents.Empty();
SlateWidgets.Empty();
}
void AVREditorRadialFloatingUI::SetSlateWidget(UVREditorUISystem& InitOwner, const TSharedRef<SWidget>& InitSlateWidget, const FIntPoint InitResolution, const float InitScale, const EDockedTo InitDockedTo)
{
Owner = &InitOwner;
#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorRadialFloatingUI.cpp:202
Scope (from outer to inner):
file
function void AVREditorRadialFloatingUI::Destroyed
Source code excerpt:
void AVREditorRadialFloatingUI::Destroyed()
{
for (UVREditorWidgetComponent* WidgetComponent : WidgetComponents)
{
if (WidgetComponent != nullptr)
{
// NOTE: We're nulling out widgets so that we don't have to wait for a GC to free up Slate resources (avoid shutdown crash)
WidgetComponent->SetSlateWidget(nullptr);
WidgetComponent = nullptr;
#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorRadialFloatingUI.cpp:245
Scope (from outer to inner):
file
function void AVREditorRadialFloatingUI::SetTransform
Source code excerpt:
CentralWidgetComponent->SetRelativeScale3D(FVector(1.0f / 100.0f) * WorldScaleFactor);
for (int32 Index = 0; Index < WidgetComponents.Num(); Index++)
{
const float Radius = 14.0f * WorldScaleFactor;
float RadialX = -Radius * FMath::Sin(Index * ((2.0f*PI) / NumberOfEntries));
float RadialY = Radius * FMath::Cos(Index * ((2.0f*PI) / NumberOfEntries));
WidgetComponents[Index]->SetRelativeLocation(FVector(0.0f, RadialX, RadialY));
}
CentralWidgetComponent->SetRelativeLocation(FVector(2.0f*(WorldScaleFactor), 0.0f, 0.0f));
WindowMeshComponent->SetRelativeLocation(FVector(-4.0f*(WorldScaleFactor), 0.0f, 0.0f));
}
#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorRadialFloatingUI.cpp:336
Scope (from outer to inner):
file
function void AVREditorRadialFloatingUI::UpdateFadingState
Source code excerpt:
// Set material color
const float UIBrightness = FadeAlpha * GetDefault<UVRModeSettings>()->UIBrightness;;
for (UVREditorWidgetComponent* WidgetComponent : WidgetComponents)
{
WidgetComponent->SetTintColorAndOpacity(FLinearColor(UIBrightness, UIBrightness, UIBrightness).CopyWithNewOpacity(FadeAlpha));
}
}
}
#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorRadialFloatingUI.cpp:367
Scope (from outer to inner):
file
function void AVREditorRadialFloatingUI::SetCollision
Source code excerpt:
WindowMeshComponent->SetCollisionObjectType(InCollisionChannel);
for (UVREditorWidgetComponent* WidgetComponent : WidgetComponents)
{
WidgetComponent->SetCollisionEnabled(InCollisionType);
WidgetComponent->SetCollisionResponseToAllChannels(InCollisionResponse);
WidgetComponent->SetCollisionObjectType(InCollisionChannel);
}
}
#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorRadialFloatingUI.cpp:504
Scope (from outer to inner):
file
function const void AVREditorRadialFloatingUI::HighlightSlot
Source code excerpt:
const int32 Index = (int32) (Angle / AnglePerItem);
// Make sure we are checking for a valid radial menu widget
if (WidgetComponents.IsValidIndex(Index) && WidgetComponents[Index]->GetSlateWidget())
{
TSharedRef<SWidget> CurrentChild = WidgetComponents[Index]->GetSlateWidget().ToSharedRef();
TestWidget = UVREditorUISystem::FindWidgetOfType(CurrentChild, ButtonTypeOverride);
}
if (TestWidget != SNullWidget::NullWidget)
{
CurrentlyHoveredButton = StaticCastSharedRef<SButton>(TestWidget);
CurrentlyHoveredWidget = WidgetComponents[Index];
// Simulate mouse entering event for the button if it was not previously hovered
if (!(CurrentlyHoveredButton->IsHovered()))
{
CurrentlyHoveredButton->OnMouseEnter(ChildGeometry, SimulatedPointer);
Owner->OnHoverBeginEffect(CurrentlyHoveredWidget);
#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorRadialFloatingUI.cpp:524
Scope (from outer to inner):
file
function const void AVREditorRadialFloatingUI::HighlightSlot
Source code excerpt:
for (int32 ButtonCount = 0; ButtonCount < (NumberOfEntries); ButtonCount++)
{
if (ButtonCount != Index && WidgetComponents.IsValidIndex(ButtonCount) && WidgetComponents[ButtonCount]->GetSlateWidget())
{
TSharedRef<SWidget> ChildWidget = WidgetComponents[ButtonCount]->GetSlateWidget().ToSharedRef();
TestWidget = UVREditorUISystem::FindWidgetOfType(ChildWidget, ButtonTypeOverride);
TSharedRef<SButton> TestButton = StaticCastSharedRef<SButton>(TestWidget);
if (TestButton->IsHovered())
{
TestButton->OnMouseLeave(SimulatedPointer);
Owner->OnHoverEndEffect(WidgetComponents[ButtonCount]);
}
}
}
}
#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorRadialFloatingUI.h:42
Scope (from outer to inner):
file
class class AVREditorRadialFloatingUI : public AVREditorBaseActor
function const TArray<class UVREditorWidgetComponent*>& GetWidgetComponents
Source code excerpt:
const TArray<class UVREditorWidgetComponent*>& GetWidgetComponents() const
{
return WidgetComponents;
}
/** Returns the mesh component for this UI, or nullptr if not spawned right now */
class UStaticMeshComponent* GetMeshComponent()
{
return WindowMeshComponent;
#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorRadialFloatingUI.h:155
Scope (from outer to inner):
file
class class AVREditorRadialFloatingUI : public AVREditorBaseActor
Source code excerpt:
/** When in a spawned state, this is the widget component to represent the widget */
UPROPERTY()
TArray<TObjectPtr<class UVREditorWidgetComponent>> WidgetComponents;
/** The floating window mesh */
UPROPERTY()
TObjectPtr<class UStaticMeshComponent> WindowMeshComponent;
/** The arrow indicator mesh */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:376
Scope: file
Source code excerpt:
/** Compare the required mip level to the resident virtual texture mip level. */
SHOWFLAG_FIXED_IN_SHIPPING(0, VirtualTexturePendingMips, SFG_Hidden, NSLOCTEXT("UnrealEd", "VirtualTexturePendingMips", "Virtual Texture Pending Mips"))
/** If WidgetComponents should be rendered in the scene */
SHOWFLAG_ALWAYS_ACCESSIBLE(WidgetComponents, SFG_Normal, NSLOCTEXT("UnrealEd", "WidgetComponentsSF", "Widget Components"))
/** Draw the bones of all skeletal meshes */
SHOWFLAG_FIXED_IN_SHIPPING(0, Bones, SFG_Developer, NSLOCTEXT("UnrealEd", "BoneSF", "Bones"))
/** Draw debug rendering from the Dedicated Server during Play In Editor (with Use Dedicated Server checked) in this client viewport */
SHOWFLAG_FIXED_IN_SHIPPING(0, ServerDrawDebug, SFG_Developer, NSLOCTEXT("UnrealEd", "ServerDrawDebugSF", "Dedicated Server Debug Drawing"))
/** If media planes should be shown */
SHOWFLAG_ALWAYS_ACCESSIBLE(MediaPlanes, SFG_Normal, NSLOCTEXT("UnrealEd", "MediaPlanesSF", "Media Planes"))
#Loc: <Workspace>/Engine/Source/Runtime/UMG/Private/Animation/MovieSceneWidgetMaterialSystem.cpp:99
Scope (from outer to inner):
file
function UMovieSceneWidgetMaterialSystem::UMovieSceneWidgetMaterialSystem
Source code excerpt:
FBuiltInComponentTypes* BuiltInComponents = FBuiltInComponentTypes::Get();
FMovieSceneUMGComponentTypes* WidgetComponents = FMovieSceneUMGComponentTypes::Get();
FMovieSceneTracksComponentTypes* TracksComponents = FMovieSceneTracksComponentTypes::Get();
RelevantComponent = WidgetComponents->WidgetMaterialHandle;
Phase = ESystemPhase::Instantiation;
if (HasAnyFlags(RF_ClassDefaultObject))
{
DefineComponentConsumer(GetClass(), BuiltInComponents->ObjectResult);
DefineComponentConsumer(GetClass(), BuiltInComponents->BoundObject);
#Loc: <Workspace>/Engine/Source/Runtime/UMG/Private/Animation/MovieSceneWidgetMaterialSystem.cpp:119
Scope (from outer to inner):
file
function void UMovieSceneWidgetMaterialSystem::OnLink
Source code excerpt:
FBuiltInComponentTypes* BuiltInComponents = FBuiltInComponentTypes::Get();
FMovieSceneUMGComponentTypes* WidgetComponents = FMovieSceneUMGComponentTypes::Get();
SystemImpl.MaterialSwitcherStorage = Linker->PreAnimatedState.GetOrCreateStorage<FPreAnimatedWidgetMaterialSwitcherStorage>();
SystemImpl.MaterialParameterStorage = Linker->PreAnimatedState.GetOrCreateStorage<FPreAnimatedWidgetMaterialParameterStorage>();
SystemImpl.OnLink(Linker, BuiltInComponents->BoundObject, WidgetComponents->WidgetMaterialHandle);
}
void UMovieSceneWidgetMaterialSystem::OnUnlink()
{
SystemImpl.OnUnlink(Linker);
}
#Loc: <Workspace>/Engine/Source/Runtime/UMG/Private/Animation/MovieSceneWidgetMaterialSystem.cpp:137
Scope (from outer to inner):
file
function void UMovieSceneWidgetMaterialSystem::OnRun
Source code excerpt:
FBuiltInComponentTypes* BuiltInComponents = FBuiltInComponentTypes::Get();
FMovieSceneUMGComponentTypes* WidgetComponents = FMovieSceneUMGComponentTypes::Get();
SystemImpl.OnRun(Linker, BuiltInComponents->BoundObject, WidgetComponents->WidgetMaterialHandle, InPrerequisites, Subsequents);
}
void UMovieSceneWidgetMaterialSystem::SavePreAnimatedState(const FPreAnimationParameters& InParameters)
{
using namespace UE::MovieScene;
FBuiltInComponentTypes* BuiltInComponents = FBuiltInComponentTypes::Get();
FMovieSceneUMGComponentTypes* WidgetComponents = FMovieSceneUMGComponentTypes::Get();
SystemImpl.SavePreAnimatedState(Linker, BuiltInComponents->BoundObject, WidgetComponents->WidgetMaterialHandle, InParameters);
}
#Loc: <Workspace>/Engine/Source/Runtime/UMG/Private/Animation/MovieSceneWidgetMaterialTrack.cpp:37
Scope (from outer to inner):
file
function void UMovieSceneWidgetMaterialTrack::ExtendEntityImpl
Source code excerpt:
FBuiltInComponentTypes* BuiltInComponents = FBuiltInComponentTypes::Get();
FMovieSceneUMGComponentTypes* WidgetComponents = FMovieSceneUMGComponentTypes::Get();
OutImportedEntity->AddBuilder(
FEntityBuilder()
.Add(WidgetComponents->WidgetMaterialPath, FWidgetMaterialPath(BrushPropertyNamePath))
// If the section has no valid blend type (legacy data), make it use absolute blending.
// Otherwise, the base section class will add the appropriate blend type tag in BuildDefaultComponents.
.AddTagConditional(BuiltInComponents->Tags.AbsoluteBlend, !Section->GetBlendType().IsValid())
);
}
#Loc: <Workspace>/Engine/Source/Runtime/UMG/Private/Components/WidgetComponent.cpp:553
Scope (from outer to inner):
file
class class FWidget3DSceneProxy final : public FPrimitiveSceneProxy
function virtual FPrimitiveViewRelevance GetViewRelevance
Source code excerpt:
MaterialRelevance.SetPrimitiveViewRelevance(Result);
Result.bDrawRelevance = IsShown(View) && bVisible && View->Family->EngineShowFlags.WidgetComponents;
Result.bDynamicRelevance = true;
Result.bRenderCustomDepth = ShouldRenderCustomDepth();
Result.bRenderInMainPass = ShouldRenderInMainPass();
Result.bUsesLightingChannels = GetLightingChannelMask() != GetDefaultLightingChannelMask();
Result.bShadowRelevance = IsShadowCast(View);
Result.bTranslucentSelfShadow = bCastVolumetricTranslucentShadow;