OnlyBuildCurrentLevel

OnlyBuildCurrentLevel

#Overview

name: OnlyBuildCurrentLevel

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 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of OnlyBuildCurrentLevel is to control the scope of lighting builds in Unreal Engine 5. Specifically, it’s used to limit the lighting build process to only the currently active level in the editor.

This setting variable is primarily used in the lighting and level editing systems of Unreal Engine. It’s referenced in the EditorBuildUtils, LevelEditor, and EditorTests modules, indicating its importance in the editor’s build process.

The value of this variable is typically set and retrieved from the GEditorPerProjectIni configuration file. It’s accessed using the GConfig->GetBool() and GConfig->SetBool() functions, with the section name “LightingBuildOptions” and the key name “OnlyBuildCurrentLevel”.

OnlyBuildCurrentLevel interacts with several other lighting build option variables, such as OnlyBuildSelected, OnlyBuildSelectedLevels, and OnlyBuildVisibility. These variables work together to fine-tune the lighting build process.

Developers must be aware that enabling this option will restrict the lighting build to the current level, which can be useful for faster iterations but may not reflect the final lighting state of the entire project. It’s particularly useful when working on large projects where building lighting for all levels would be time-consuming.

Best practices when using this variable include:

  1. Enable it during the initial stages of level design to speed up iteration times.
  2. Disable it when doing final lighting builds to ensure consistency across all levels.
  3. Use it in conjunction with other lighting build options to create an efficient workflow.
  4. Remember to perform a full lighting build (with this option disabled) before finalizing the project to ensure all levels have up-to-date lighting.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:503, section: [LightingBuildOptions]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Tests/EditorTests/Source/EditorTests/Private/UnrealEd/EditorBuildPromotionTests.cpp:356

Scope (from outer to inner):

file
namespace    EditorBuildPromotionTestUtils
function     static void BuildLighting

Source code excerpt:

		// Retrieve settings from ini.
		GConfig->GetBool(TEXT("LightingBuildOptions"), TEXT("OnlyBuildSelected"), LightingBuildOptions.bOnlyBuildSelected, GEditorPerProjectIni);
		GConfig->GetBool(TEXT("LightingBuildOptions"), TEXT("OnlyBuildCurrentLevel"), LightingBuildOptions.bOnlyBuildCurrentLevel, GEditorPerProjectIni);
		GConfig->GetBool(TEXT("LightingBuildOptions"), TEXT("OnlyBuildSelectedLevels"), LightingBuildOptions.bOnlyBuildSelectedLevels, GEditorPerProjectIni);
		GConfig->GetBool(TEXT("LightingBuildOptions"), TEXT("OnlyBuildVisibility"), LightingBuildOptions.bOnlyBuildVisibility, GEditorPerProjectIni);
		GConfig->GetBool(TEXT("LightingBuildOptions"), TEXT("UseErrorColoring"), LightingBuildOptions.bUseErrorColoring, GEditorPerProjectIni);
		GConfig->GetBool(TEXT("LightingBuildOptions"), TEXT("ShowLightingBuildInfo"), LightingBuildOptions.bShowLightingBuildInfo, GEditorPerProjectIni);
		int32 QualityLevel;
		GConfig->GetInt(TEXT("LightingBuildOptions"), TEXT("QualityLevel"), QualityLevel, GEditorPerProjectIni);

#Loc: <Workspace>/Engine/Source/Editor/LevelEditor/Private/LevelEditorActions.cpp:729

Scope (from outer to inner):

file
function     void FLevelEditorActionCallbacks::ConfigureLightingBuildOptions

Source code excerpt:

{
	GConfig->SetBool( TEXT("LightingBuildOptions"), TEXT("OnlyBuildSelected"),		Options.bOnlyBuildSelected,			GEditorPerProjectIni );
	GConfig->SetBool( TEXT("LightingBuildOptions"), TEXT("OnlyBuildCurrentLevel"),	Options.bOnlyBuildCurrentLevel,		GEditorPerProjectIni );
	GConfig->SetBool( TEXT("LightingBuildOptions"), TEXT("OnlyBuildSelectedLevels"),Options.bOnlyBuildSelectedLevels,	GEditorPerProjectIni );
	GConfig->SetBool( TEXT("LightingBuildOptions"), TEXT("OnlyBuildVisibility"),	Options.bOnlyBuildVisibility,		GEditorPerProjectIni );
}

bool FLevelEditorActionCallbacks::CanBuildLighting()
{

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorBuildUtils.cpp:302

Scope (from outer to inner):

file
function     bool FEditorBuildUtils::EditorBuild

Source code excerpt:

		// Retrieve settings from ini.
		GConfig->GetBool( TEXT("LightingBuildOptions"), TEXT("OnlyBuildSelected"),		LightingBuildOptions.bOnlyBuildSelected,			GEditorPerProjectIni );
		GConfig->GetBool( TEXT("LightingBuildOptions"), TEXT("OnlyBuildCurrentLevel"),	LightingBuildOptions.bOnlyBuildCurrentLevel,		GEditorPerProjectIni );
		GConfig->GetBool( TEXT("LightingBuildOptions"), TEXT("OnlyBuildSelectedLevels"),LightingBuildOptions.bOnlyBuildSelectedLevels,	GEditorPerProjectIni );
		GConfig->GetBool( TEXT("LightingBuildOptions"), TEXT("OnlyBuildVisibility"),	LightingBuildOptions.bOnlyBuildVisibility,		GEditorPerProjectIni );
		GConfig->GetBool( TEXT("LightingBuildOptions"), TEXT("UseErrorColoring"),		LightingBuildOptions.bUseErrorColoring,			GEditorPerProjectIni );
		GConfig->GetBool( TEXT("LightingBuildOptions"), TEXT("ShowLightingBuildInfo"),	LightingBuildOptions.bShowLightingBuildInfo,		GEditorPerProjectIni );
		int32 QualityLevel;
		GConfig->GetInt(  TEXT("LightingBuildOptions"), TEXT("QualityLevel"),			QualityLevel,						GEditorPerProjectIni );

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Tests/AutomationEditorCommon.cpp:998

Scope (from outer to inner):

file
function     bool FBuildLightingCommand::Update

Source code excerpt:

	// Retrieve settings from ini.
	GConfig->GetBool(TEXT("LightingBuildOptions"), TEXT("OnlyBuildSelected"), LightingBuildOptions.bOnlyBuildSelected, GEditorPerProjectIni);
	GConfig->GetBool(TEXT("LightingBuildOptions"), TEXT("OnlyBuildCurrentLevel"), LightingBuildOptions.bOnlyBuildCurrentLevel, GEditorPerProjectIni);
	GConfig->GetBool(TEXT("LightingBuildOptions"), TEXT("OnlyBuildSelectedLevels"), LightingBuildOptions.bOnlyBuildSelectedLevels, GEditorPerProjectIni);
	GConfig->GetBool(TEXT("LightingBuildOptions"), TEXT("OnlyBuildVisibility"), LightingBuildOptions.bOnlyBuildVisibility, GEditorPerProjectIni);
	GConfig->GetBool(TEXT("LightingBuildOptions"), TEXT("UseErrorColoring"), LightingBuildOptions.bUseErrorColoring, GEditorPerProjectIni);
	GConfig->GetBool(TEXT("LightingBuildOptions"), TEXT("ShowLightingBuildInfo"), LightingBuildOptions.bShowLightingBuildInfo, GEditorPerProjectIni);
	int32 QualityLevel;
	GConfig->GetInt(TEXT("LightingBuildOptions"), TEXT("QualityLevel"), QualityLevel, GEditorPerProjectIni);