ShowFlag.VisLog

ShowFlag.VisLog

#Overview

name: ShowFlag.VisLog

This variable is created as a Console Variable (cvar).

It is referenced in 9 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.VisLog is to enable or disable debug drawing for the Visual Logger system in Unreal Engine 5. This setting variable is primarily used for debugging and visualization purposes within the engine.

This setting variable is relied upon by several Unreal Engine subsystems and modules, including:

  1. The Visual Logger system itself
  2. The AI Module (specifically the CrowdManager)
  3. The Gameplay Abilities system
  4. The Instanced Actors system
  5. The Chaos Solver Engine (for physics debugging)

The value of this variable is typically set through the engine’s show flags system, which allows developers to toggle various debug visualization options. It’s defined in the ShowFlagsValues.inl file and is set to be fixed in shipping builds (i.e., it’s only available in development builds).

The associated variable VisLog interacts with ShowFlag.VisLog in various parts of the engine. It’s used to control whether certain debug information should be recorded or displayed in the Visual Logger.

Developers should be aware of the following when using this variable:

  1. It’s only available in development builds, not in shipping builds.
  2. Enabling this flag can impact performance, so it should be used judiciously during development and debugging.
  3. It affects multiple systems across the engine, so enabling it may produce a lot of debug information.

Best practices when using this variable include:

  1. Only enable it when actively debugging visual logging issues.
  2. Be prepared to handle additional visual information in the viewport when this flag is enabled.
  3. Remember to disable it when not needed to avoid performance impacts.
  4. Use it in conjunction with other debugging tools and flags for comprehensive debugging.

Regarding the associated variable VisLog: The purpose of VisLog is to control more fine-grained aspects of visual logging in specific systems. It’s used in various parts of the engine to determine whether certain debug information should be logged or visualized.

This variable is used in several subsystems, including:

  1. The Gameplay Abilities system
  2. The Instanced Actors system
  3. The AI Module’s CrowdManager

The value of VisLog is typically set within the specific systems that use it, often controlled by console variables or debug settings.

Developers should be aware that:

  1. VisLog may have different effects in different systems.
  2. It’s often used in conjunction with ShowFlag.VisLog, but may provide more granular control.

Best practices for using VisLog include:

  1. Understanding the specific system you’re debugging and how it uses VisLog.
  2. Using it in combination with ShowFlag.VisLog for comprehensive visual debugging.
  3. Being aware of any performance implications in the specific systems where it’s used.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:165

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, DebugAI, SFG_Developer, NSLOCTEXT("UnrealEd", "DebugAISF", "AI Debug"))
/** calls debug drawing for whatever LogVisualizer wants to draw */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisLog, SFG_Developer, NSLOCTEXT("UnrealEd", "VisLogSF", "Log Visualizer"))
/** whether to draw navigation data */
SHOWFLAG_FIXED_IN_SHIPPING(0, Navigation, SFG_Normal, NSLOCTEXT("UnrealEd", "NavigationSF", "Navigation"))
/** used by gameplay debugging components to debug-draw on screen */
SHOWFLAG_FIXED_IN_SHIPPING(0, GameplayDebug, SFG_Developer, NSLOCTEXT("UnrealEd", "GameplayDebugSF", "Gameplay Debug"))
/** LightProfiles, usually 1d textures to have a light (IES), for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(TexturedLightProfiles,  SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "TexturedLightProfilesSF", "Textured Light Profiles (IES Texture)"))

#Associated Variable and Callsites

This variable is associated with another variable named VisLog. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Public/GameplayEffect.h:1625

Scope (from outer to inner):

file
function     struct GAMEPLAYABILITIES_API FActiveGameplayEffectsContainer : public FFastArraySerializer { GENERATED_USTRUCT_BODY

Source code excerpt:

	TArray<DebugExecutedGameplayEffectData> DebugExecutedGameplayEffects;

	/** Report our current state to the VisLog */
	void DescribeSelfToVisLog(FVisualLogEntry* Snapshot) const;
#endif // ENABLE_VISUAL_LOG

	void GetActiveGameplayEffectDataByAttribute(TMultiMap<FGameplayAttribute, FActiveGameplayEffectsContainer::DebugExecutedGameplayEffectData>& EffectMap) const;

	void RegisterWithOwner(UAbilitySystemComponent* Owner);	

#Loc: <Workspace>/Engine/Plugins/Runtime/InstancedActors/Source/InstancedActors/Public/InstancedActorsDebug.h:31

Scope (from outer to inner):

file
namespace    UE::InstancedActors::Debug
namespace    DrawMode

Source code excerpt:

		constexpr int32 None = 0;
		constexpr int32 DebugDraw = 1;
		constexpr int32 VisLog = 2;
		constexpr int32 Both = 3;
	};

	FORCEINLINE bool ShouldDebugDraw(const int32& DebugDrawMode) { return DebugDrawMode == DrawMode::DebugDraw || DebugDrawMode >= DrawMode::Both; }
	FORCEINLINE bool ShouldVisLog(const int32& DebugDrawMode) { return DebugDrawMode == DrawMode::VisLog || DebugDrawMode >= DrawMode::Both; }

	void DebugDrawManager(const int32& DebugDrawMode, const AInstancedActorsManager& Manager);
	void LogInstanceCountsOnScreen(const int32& DebugDrawMode, const AInstancedActorsManager& Manager, float TimeToDisplay = 4.0f, FColor Color = FColor::Magenta);
	void DebugDrawAllInstanceLocations(const int32& DebugDrawMode, ELogVerbosity::Type Verbosity, const AInstancedActorsManager& Manager, const TOptional<FColor> Color, const UObject* LogOwner, const FName& CategoryName = TEXT("LogInstancedActors"));
	void DebugDrawModifierVolumeBounds(const int32& DebugDrawMode, const UInstancedActorsModifierVolumeComponent& ModifierVolume, const FColor& Color); 
	void DebugDrawModifierVolumeAddedToManager(const int32& DebugDrawMode, const AInstancedActorsManager& Manager, const UInstancedActorsModifierVolumeComponent& AddedModifierVolume);

#Loc: <Workspace>/Engine/Source/Developer/LogVisualizer/Private/SVisualLogger.cpp:368

Scope (from outer to inner):

file
function     void SVisualLogger::Construct

Source code excerpt:

	VisualLoggerCanvasRenderer = MakeShareable(new FVisualLoggerCanvasRenderer());

	DrawOnCanvasDelegateHandle = UDebugDrawService::Register(TEXT("VisLog"), FDebugDrawDelegate::CreateRaw(VisualLoggerCanvasRenderer.Get(), &FVisualLoggerCanvasRenderer::DrawOnCanvas));

	Cast<AVisualLoggerRenderingActor>(FVisualLoggerEditorInterface::Get()->GetHelperActor(LastUsedWorld.Get()));
}

void SVisualLogger::OnNewLogEntry(const FVisualLogDevice::FVisualLogEntryItem& Entry)
{

#Loc: <Workspace>/Engine/Source/Developer/LogVisualizer/Private/VisualLoggerRenderingActorBase.cpp:30

Scope (from outer to inner):

file
class        class FVisualLoggerSceneProxy final : public FDebugRenderSceneProxy
function     FVisualLoggerSceneProxy

Source code excerpt:

	{
		DrawType = SolidAndWireMeshes;
		ViewFlagName = TEXT("VisLog");
		ViewFlagIndex = uint32(FEngineShowFlags::FindIndexByName(*ViewFlagName));
		bWantsSelectionOutline = false;
	}

	virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView* View) const override
	{

#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/Navigation/CrowdManager.cpp:47

Scope (from outer to inner):

file
namespace    FCrowdDebug

Source code excerpt:

		TEXT("Enable debug drawing for selected crowd agent.\n0: Disable, 1: Enable"), ECVF_Default);

	/** if set, basic debug information will be recorded in VisLog for all agents */
	int32 DebugVisLog = 0;
	FAutoConsoleVariableRef CVarDebugVisLog(TEXT("ai.crowd.DebugVisLog"), DebugVisLog,
		TEXT("Enable detailed vislog recording for all crowd agents.\n0: Disable, 1: Enable"), ECVF_Default);

	/** debug flags, works only for selected actor */
	int32 DrawDebugCorners = 1;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:165

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, DebugAI, SFG_Developer, NSLOCTEXT("UnrealEd", "DebugAISF", "AI Debug"))
/** calls debug drawing for whatever LogVisualizer wants to draw */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisLog, SFG_Developer, NSLOCTEXT("UnrealEd", "VisLogSF", "Log Visualizer"))
/** whether to draw navigation data */
SHOWFLAG_FIXED_IN_SHIPPING(0, Navigation, SFG_Normal, NSLOCTEXT("UnrealEd", "NavigationSF", "Navigation"))
/** used by gameplay debugging components to debug-draw on screen */
SHOWFLAG_FIXED_IN_SHIPPING(0, GameplayDebug, SFG_Developer, NSLOCTEXT("UnrealEd", "GameplayDebugSF", "Gameplay Debug"))
/** LightProfiles, usually 1d textures to have a light (IES), for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(TexturedLightProfiles,  SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "TexturedLightProfilesSF", "Textured Light Profiles (IES Texture)"))

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/VisualLogger/VisualLogger.h:728

Scope: file

Source code excerpt:

	bool IsRecordingOnServer() const { return !!bIsRecordingOnServer; }

	/** Configure whether VisLog should be using decorated, unique names */
	ENGINE_API void SetUseUniqueNames(const bool bEnable);

	/** Add visual logger output device */
	void AddDevice(FVisualLogDevice* InDevice) { OutputDevices.AddUnique(InDevice); }
	/** Remove visual logger output device */
	void RemoveDevice(FVisualLogDevice* InDevice) { OutputDevices.RemoveSwap(InDevice); }

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/ChaosSolverEngine/Private/Chaos/ChaosDebugDrawComponent.cpp:146

Scope (from outer to inner):

file
function     void DebugDrawChaos

Source code excerpt:

	}

	// Draw all the captured elements in the VisLog
	const bool bDrawVisLog = bChaosDebugDraw_DrawMode != 0;
	if (bDrawVisLog)
	{
		for (const FLatentDrawCommand& Command : DrawCommands)
		{
			const AActor* Actor = (Command.TestBaseActor) ? Command.TestBaseActor : DebugDrawActor;