wp.Editor.HLOD.AllowShowingHLODsInEditor

wp.Editor.HLOD.AllowShowingHLODsInEditor

#Overview

name: wp.Editor.HLOD.AllowShowingHLODsInEditor

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of wp.Editor.HLOD.AllowShowingHLODsInEditor is to control whether World Partition HLODs (Hierarchical Level of Detail) are displayed in the Unreal Engine editor. This setting is part of the World Partition system, which is used for managing large open-world environments in Unreal Engine 5.

The World Partition Editor module relies on this setting variable. It is used within the HLODEditorSubsystem, which is responsible for managing HLOD functionality in the editor.

The value of this variable is set as a console variable using TAutoConsoleVariable. It is initialized with a default value of true, meaning HLODs are allowed to be shown in the editor by default.

This variable interacts with other variables and settings:

  1. It is associated with CVarHLODInEditorEnabled, which shares the same value.
  2. It is used in conjunction with other settings like bShowHLODsInEditorUserSetting and bWorldPartitionLoadingInEditorEnabled to determine if HLODs should be displayed in the editor.

Developers should be aware that:

  1. This setting affects editor performance and visualization, not the final game build.
  2. Changing this setting may impact editor performance, especially in large worlds with many HLODs.

Best practices when using this variable include:

  1. Consider disabling it temporarily if editor performance is sluggish in large worlds.
  2. Use it in combination with other World Partition settings for optimal editor performance and functionality.
  3. Be aware of its impact on editor visualization when debugging HLOD-related issues.

Regarding the associated variable CVarHLODInEditorEnabled:

The purpose of CVarHLODInEditorEnabled is to provide programmatic access to the wp.Editor.HLOD.AllowShowingHLODsInEditor setting within the C++ code.

It is used in the WorldPartitionEditor module, specifically in the HLODEditorSubsystem.

The value of this variable is set through the TAutoConsoleVariable declaration, which links it to the wp.Editor.HLOD.AllowShowingHLODsInEditor console variable.

CVarHLODInEditorEnabled interacts directly with other editor settings and variables to determine if HLODs should be displayed in the editor.

Developers should be aware that:

  1. This variable provides a way to access the HLOD visibility setting in C++ code.
  2. It is used in conditional statements to control HLOD-related functionality.

Best practices when using CVarHLODInEditorEnabled include:

  1. Use GetValueOnGameThread() when accessing its value to ensure thread safety.
  2. Consider the performance implications when frequently checking this value in performance-critical code paths.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/WorldPartitionEditor/Private/WorldPartition/HLOD/HLODEditorSubsystem.cpp:14

Scope: file

Source code excerpt:


static TAutoConsoleVariable<bool> CVarHLODInEditorEnabled(
	TEXT("wp.Editor.HLOD.AllowShowingHLODsInEditor"),
	true,
	TEXT("Allow showing World Partition HLODs in the editor."));

#define LOCTEXT_NAMESPACE "HLODEditorSubsystem"

static FName NAME_HLODRelevantColorHandler(TEXT("HLODRelevantColorHandler"));

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/WorldPartitionEditor/Private/WorldPartition/HLOD/HLODEditorSubsystem.cpp:13

Scope: file

Source code excerpt:

#include "WorldPartition/WorldPartitionSubsystem.h"

static TAutoConsoleVariable<bool> CVarHLODInEditorEnabled(
	TEXT("wp.Editor.HLOD.AllowShowingHLODsInEditor"),
	true,
	TEXT("Allow showing World Partition HLODs in the editor."));

#define LOCTEXT_NAMESPACE "HLODEditorSubsystem"

#Loc: <Workspace>/Engine/Source/Editor/WorldPartitionEditor/Private/WorldPartition/HLOD/HLODEditorSubsystem.cpp:58

Scope (from outer to inner):

file
function     bool UWorldPartitionHLODEditorSubsystem::IsHLODInEditorEnabled

Source code excerpt:

	const bool bShowHLODsInEditorUserSetting = WorldPartitionEditorModule && WorldPartitionEditorModule->GetShowHLODsInEditor();
	const bool bWorldPartitionLoadingInEditorEnabled = WorldPartitionEditorModule && WorldPartitionEditorModule->GetEnableLoadingInEditor();
	return CVarHLODInEditorEnabled.GetValueOnGameThread() && bShowHLODsInEditorUserSetting && bShowHLODsInEditorForWorld && bWorldPartitionLoadingInEditorEnabled;
}

bool UWorldPartitionHLODEditorSubsystem::DoesSupportWorldType(const EWorldType::Type WorldType) const
{
	return WorldType == EWorldType::Editor && !IsRunningCommandlet();
}