bAutoApplyLightingEnable
bAutoApplyLightingEnable
#Overview
name: bAutoApplyLightingEnable
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 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bAutoApplyLightingEnable is to control whether lighting changes are automatically applied in the Unreal Engine editor. This setting is part of the Level Editor’s miscellaneous settings and affects the lighting system.
This setting variable is primarily relied upon by the Unreal Engine’s editor subsystem, specifically the lighting and level editing modules. It’s used in the EditorBuildPromotionTests and the StaticLightingSystem.
The value of this variable is set in the ULevelEditorMiscSettings class, which is part of the editor’s configuration. It’s initialized to true by default in the constructor of ULevelEditorMiscSettings.
This variable interacts with other parts of the lighting system, particularly in the CanAutoApplyLighting() function of the FStaticLightingSystem class. Here, it’s used in conjunction with other conditions to determine if lighting can be automatically applied.
Developers must be aware that this setting can significantly impact the editor’s behavior when working with lighting. When enabled, lighting changes will be automatically applied, which can be convenient but may also lead to unexpected performance impacts if large or complex lighting changes are made frequently.
Best practices when using this variable include:
- Consider disabling it temporarily when making multiple lighting changes to avoid unnecessary rebuilds.
- Be aware of its state when debugging lighting-related issues, as it may affect the behavior of lighting updates.
- Use it in conjunction with manual lighting builds for more control over when lighting is updated, especially in larger or more complex scenes.
- When writing editor utilities or automation scripts, check and possibly modify this setting to ensure consistent behavior across different editor configurations.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:197, section: [/Script/UnrealEd.LevelEditorMiscSettings]
- INI Section:
/Script/UnrealEd.LevelEditorMiscSettings
- Raw value:
true
- Is Array:
False
#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:1193
Scope (from outer to inner):
file
namespace BuildPromotionTestHelper
function bool Lighting_BuildLighting_Part1
Source code excerpt:
//Force AutoApplyLighting on
ULevelEditorMiscSettings* LevelEdSettings = GetMutableDefault<ULevelEditorMiscSettings>();
bDisableAutoApplyLighting = !LevelEdSettings->bAutoApplyLightingEnable;
LevelEdSettings->bAutoApplyLightingEnable = true;
//Build Lighting
EditorBuildPromotionTestUtils::BuildLighting();
return true;
}
#Loc: <Workspace>/Engine/Plugins/Tests/EditorTests/Source/EditorTests/Private/UnrealEd/EditorBuildPromotionTests.cpp:1213
Scope (from outer to inner):
file
namespace BuildPromotionTestHelper
function bool Lighting_BuildLighting_Part2
Source code excerpt:
{
ULevelEditorMiscSettings* LevelEdSettings = GetMutableDefault<ULevelEditorMiscSettings>();
LevelEdSettings->bAutoApplyLightingEnable = false;
}
UE_LOG(LogEditorBuildPromotionTests, Display, TEXT("Built Lighting"));
return true;
}
return false;
}
#Loc: <Workspace>/Engine/Plugins/Tests/EditorTests/Source/EditorTests/Private/UnrealEd/EditorBuildPromotionTests.cpp:2265
Scope (from outer to inner):
file
namespace BuildPromotionTestHelper
function bool Building_BuildLevel_Part3
Source code excerpt:
//Force AutoApplyLighting on
ULevelEditorMiscSettings* LevelEdSettings = GetMutableDefault<ULevelEditorMiscSettings>();
bDisableAutoApplyLighting = !LevelEdSettings->bAutoApplyLightingEnable;
LevelEdSettings->bAutoApplyLightingEnable = true;
//Build Lighting
EditorBuildPromotionTestUtils::BuildLighting();
return true;
}
#Loc: <Workspace>/Engine/Plugins/Tests/EditorTests/Source/EditorTests/Private/UnrealEd/EditorBuildPromotionTests.cpp:2287
Scope (from outer to inner):
file
namespace BuildPromotionTestHelper
function bool Building_BuildLevel_Part4
Source code excerpt:
{
ULevelEditorMiscSettings* LevelEdSettings = GetMutableDefault<ULevelEditorMiscSettings>();
LevelEdSettings->bAutoApplyLightingEnable = false;
}
UE_LOG(LogEditorBuildPromotionTests, Display, TEXT("Saved the Level (EditorBuildPromotionTest)"));
UWorld* World = GEditor->GetEditorWorldContext().World();
ULevel* Level = World->GetCurrentLevel();
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/LevelEditorMiscSettings.h:25
Scope (from outer to inner):
file
class class ULevelEditorMiscSettings : public UDeveloperSettings
Source code excerpt:
*/
UPROPERTY(EditAnywhere, config, Category=Editing, meta=(DisplayName="Apply Lighting Automatically"))
uint32 bAutoApplyLightingEnable:1;
/** If true, BSP will auto-update */
UPROPERTY(EditAnywhere, config, Category=Editing, meta=( DisplayName = "Update BSP Automatically" ))
uint32 bBSPAutoUpdate:1;
/** If true, the pivot offset for BSP will be automatically moved to stay centered on its vertices */
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/SettingsClasses.cpp:456
Scope (from outer to inner):
file
function ULevelEditorMiscSettings::ULevelEditorMiscSettings
Source code excerpt:
: Super(ObjectInitializer)
{
bAutoApplyLightingEnable = true;
SectionName = TEXT("Misc");
CategoryName = TEXT("LevelEditor");
EditorScreenshotSaveDirectory.Path = FPaths::ScreenShotDir();
bPromptWhenAddingToLevelBeforeCheckout = true;
bPromptWhenAddingToLevelOutsideBounds = true;
PercentageThresholdForPrompt = 20.0f;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/StaticLightingSystem/StaticLightingSystem.cpp:2470
Scope (from outer to inner):
file
function bool FStaticLightingSystem::CanAutoApplyLighting
Source code excerpt:
bool FStaticLightingSystem::CanAutoApplyLighting() const
{
const bool bAutoApplyEnabled = GetDefault<ULevelEditorMiscSettings>()->bAutoApplyLightingEnable;
const bool bSlowTask = GIsSlowTask;
const bool bPlayWorldValid = GEditor->PlayWorld != nullptr;
const bool bAnyMenusVisible = (FSlateApplication::IsInitialized() && FSlateApplication::Get().AnyMenusVisible());
//const bool bIsInteratcting = false;// FSlateApplication::Get().GetMouseCaptor().IsValid() || GEditor->IsUserInteracting();
const bool bHasGameOrProjectLoaded = FApp::HasProjectName();