ShowFlag.Paper2DSprites
ShowFlag.Paper2DSprites
#Overview
name: ShowFlag.Paper2DSprites
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 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.Paper2DSprites is to control the rendering of Paper2D sprites in the Unreal Engine 5 environment. It’s primarily used for the 2D rendering system, specifically for the Paper2D plugin.
This setting variable is primarily relied upon by the Paper2D plugin, which is part of Unreal Engine’s 2D game development toolset. It’s used in the rendering pipeline to determine whether Paper2D sprites should be drawn or not.
The value of this variable is set through the engine’s show flags system. It’s defined as SHOWFLAG_ALWAYS_ACCESSIBLE, which means it’s always available to be toggled, even in shipping builds.
The Paper2DSprites variable interacts closely with the EngineShowFlags.Paper2DSprites variable. They share the same value and are used interchangeably in different parts of the code.
Developers should be aware that this flag affects both the rendering of the sprites themselves and their bounding boxes in non-shipping builds. It’s also used in determining view relevance for Paper2D render scene proxies.
Best practices when using this variable include:
- Use it to toggle visibility of Paper2D sprites for debugging or performance testing.
- Be aware that it affects both editor and runtime visibility of sprites.
- Remember that it’s always accessible, even in shipping builds, which could be useful for runtime toggling of sprite visibility.
Regarding the associated variable EngineShowFlags.Paper2DSprites:
This variable is used in the same context as ShowFlag.Paper2DSprites. It’s primarily used in the Paper2D plugin’s rendering code to determine if Paper2D sprites should be rendered.
It’s referenced in the GetDynamicMeshElements and GetViewRelevance functions of the FPaperRenderSceneProxy class, which are crucial for rendering Paper2D sprites.
The value is typically set through the engine’s show flags system, but can also be manually overridden in certain view modes.
Developers should be aware that this flag not only controls the rendering of the sprites but also the rendering of their bounding boxes in non-shipping builds, which can be useful for debugging.
Best practices include using this flag for debugging sprite rendering issues, and being aware of its impact on performance when many sprites are present in a scene.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:331
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, VolumeLightingSamples, SFG_Visualize, NSLOCTEXT("UnrealEd", "VolumeLightingSamplesSF", "Volume Lighting Samples"))
/** Render Paper2D sprites, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(Paper2DSprites, SFG_Advanced, NSLOCTEXT("UnrealEd", "Paper2DSpritesSF", "Paper 2D Sprites"))
/** Visualization of distance field AO */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeDistanceFieldAO, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeDistanceFieldAOSF", "Distance Field Ambient Occlusion"))
/** Mesh Distance fields */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeMeshDistanceFields, SFG_Visualize, NSLOCTEXT("UnrealEd", "MeshDistanceFieldsSF", "Mesh DistanceFields"))
/** Physics field */
SHOWFLAG_FIXED_IN_SHIPPING(0, PhysicsField, SFG_Visualize, NSLOCTEXT("UnrealEd", "PhysicsField", "Physics Field"))
#Associated Variable and Callsites
This variable is associated with another variable named Paper2DSprites
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/2D/Paper2D/Source/Paper2D/Private/PaperRenderSceneProxy.cpp:332
Scope (from outer to inner):
file
function void FPaperRenderSceneProxy::GetDynamicMeshElements
Source code excerpt:
// Draw bounds
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
if (EngineShowFlags.Paper2DSprites)
{
RenderBounds(Collector.GetPDI(ViewIndex), EngineShowFlags, GetBounds(), (Owner == nullptr) || IsSelected());
}
#endif
}
}
#Loc: <Workspace>/Engine/Plugins/2D/Paper2D/Source/Paper2D/Private/PaperRenderSceneProxy.cpp:507
Scope (from outer to inner):
file
function FPrimitiveViewRelevance FPaperRenderSceneProxy::GetViewRelevance
Source code excerpt:
FPrimitiveViewRelevance Result;
Result.bDrawRelevance = IsShown(View) && EngineShowFlags.Paper2DSprites;
Result.bRenderCustomDepth = ShouldRenderCustomDepth();
Result.bRenderInMainPass = ShouldRenderInMainPass();
Result.bUsesLightingChannels = GetLightingChannelMask() != GetDefaultLightingChannelMask();
Result.bShadowRelevance = IsShadowCast(View);
Result.bTranslucentSelfShadow = bCastVolumetricTranslucentShadow;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShowFlags.cpp:658
Scope (from outer to inner):
file
function void EngineShowFlagOverride
Source code excerpt:
DISABLE_ENGINE_SHOWFLAG(NaniteMeshes)
DISABLE_ENGINE_SHOWFLAG(BSP)
DISABLE_ENGINE_SHOWFLAG(Paper2DSprites)
#undef DISABLE_ENGINE_SHOWFLAG
}
}
#endif
// Force some show flags to be 0 or 1
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:331
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, VolumeLightingSamples, SFG_Visualize, NSLOCTEXT("UnrealEd", "VolumeLightingSamplesSF", "Volume Lighting Samples"))
/** Render Paper2D sprites, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(Paper2DSprites, SFG_Advanced, NSLOCTEXT("UnrealEd", "Paper2DSpritesSF", "Paper 2D Sprites"))
/** Visualization of distance field AO */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeDistanceFieldAO, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeDistanceFieldAOSF", "Distance Field Ambient Occlusion"))
/** Mesh Distance fields */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeMeshDistanceFields, SFG_Visualize, NSLOCTEXT("UnrealEd", "MeshDistanceFieldsSF", "Mesh DistanceFields"))
/** Physics field */
SHOWFLAG_FIXED_IN_SHIPPING(0, PhysicsField, SFG_Visualize, NSLOCTEXT("UnrealEd", "PhysicsField", "Physics Field"))