bBSPAutoUpdate

bBSPAutoUpdate

#Overview

name: bBSPAutoUpdate

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

#Summary

#Usage in the C++ source code

The purpose of bBSPAutoUpdate is to control the automatic updating of Binary Space Partitioning (BSP) in the Unreal Engine editor. BSP is a method used for spatial partitioning and is particularly relevant for level geometry and collision detection.

This setting variable is primarily used in the Unreal Engine’s level editor and affects the behavior of BSP-related operations. Based on the callsites, it’s clear that the DataprepEditor plugin and the UnrealEd module rely on this setting.

The value of this variable is set in the LevelEditorMiscSettings class, which is part of the editor’s configuration. It can be modified through the editor’s settings interface or programmatically.

Several other variables and systems interact with bBSPAutoUpdate:

  1. It’s used in conjunction with level loading and saving operations, particularly in the DataprepEditor.
  2. It affects the behavior of actor pasting in the editor.
  3. It’s checked before rebuilding levels or altered BSP.

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

  1. Disabling BSP auto-update can improve performance during certain operations, but may lead to outdated BSP geometry if not manually updated.
  2. The setting is temporarily disabled during some operations (like pasting actors) to prevent unnecessary rebuilds.
  3. Changing this setting affects the entire editor, not just individual levels or operations.

Best practices when using this variable include:

  1. Consider disabling BSP auto-update temporarily during heavy editing sessions to improve performance, but remember to manually update BSP when necessary.
  2. Be cautious when changing this setting programmatically, as it affects global editor behavior.
  3. Always restore the original value after temporarily changing it for specific operations.
  4. Use this setting in conjunction with other BSP-related settings for optimal level editing performance and accuracy.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:199, section: [/Script/UnrealEd.LevelEditorMiscSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Enterprise/DataprepEditor/Source/DataprepEditor/Private/DataprepSnapshot.cpp:872

Scope (from outer to inner):

file
function     void FDataprepEditor::RestoreFromSnapshot

Source code excerpt:


		FString PackageFilePath = DataprepSnapshotUtil::BuildAssetFileName( TempDir, GetTransientContentFolder() / SessionID ) + TEXT(".asc");
		const bool bBSPAutoUpdate = GetDefault<ULevelEditorMiscSettings>()->bBSPAutoUpdate;
		GetMutableDefault<ULevelEditorMiscSettings>()->bBSPAutoUpdate = false;

		// Load the text file to a string
		FString FileBuffer;
		verify( FFileHelper::LoadFileToString(FileBuffer, *PackageFilePath) );

		// Set the GWorld to the preview world since ULevelFactory::FactoryCreateText uses GWorld

#Loc: <Workspace>/Engine/Plugins/Enterprise/DataprepEditor/Source/DataprepEditor/Private/DataprepSnapshot.cpp:901

Scope (from outer to inner):

file
function     void FDataprepEditor::RestoreFromSnapshot

Source code excerpt:


		// Reinstate old BSP update setting, and force a rebuild - any levels whose geometry has changed while pasting will be rebuilt
		GetMutableDefault<ULevelEditorMiscSettings>()->bBSPAutoUpdate = bBSPAutoUpdate;

		// Restore GWorld
		GWorld = PrevGWorld;
	}
	UE_LOG( LogDataprepEditor, Verbose, TEXT("Level loaded") );

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/LevelEditorMiscSettings.h:29

Scope (from outer to inner):

file
class        class ULevelEditorMiscSettings : public UDeveloperSettings

Source code excerpt:

	/** 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 */
	UPROPERTY(EditAnywhere, config, Category=Editing, meta=( DisplayName = "Move BSP Pivot Offset Automatically" ))
	uint32 bAutoMoveBSPPivotOffset:1;

	/** If true, Navigation will auto-update */

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorActor.cpp:347

Scope (from outer to inner):

file
function     void UUnrealEdEngine::PasteActors

Source code excerpt:


	// Turn off automatic BSP update while pasting to save rebuilding geometry potentially multiple times
	const bool bBSPAutoUpdate = GetDefault<ULevelEditorMiscSettings>()->bBSPAutoUpdate;
	GetMutableDefault<ULevelEditorMiscSettings>()->bBSPAutoUpdate = false;

	// Import the actors.
	ULevelFactory* Factory = NewObject<ULevelFactory>();
	Factory->FactoryCreateText(ULevel::StaticClass(), InWorld->GetCurrentLevel(), InWorld->GetCurrentLevel()->GetFName(), RF_Transactional, NULL, bDuplicate ? TEXT("move") : TEXT("paste"), Paste, Paste + FCString::Strlen(Paste), GWarn);

	// Reinstate old BSP update setting, and force a rebuild - any levels whose geometry has changed while pasting will be rebuilt
	GetMutableDefault<ULevelEditorMiscSettings>()->bBSPAutoUpdate = bBSPAutoUpdate;
	
	// FactoryCreateText set the selection to the new actors, so copy that into OutPastedActors and restore the original selection
	ActorSelection->GetSelectedObjects<AActor>(OutPastedActors);
	FObjectReader(ActorSelection, OriginalSelectionState);

	// Fire ULevel::LevelDirtiedEvent when falling out of scope.

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorServer.cpp:1588

Scope (from outer to inner):

file
function     void UEditorEngine::RebuildLevel

Source code excerpt:

{
	// Early out if BSP auto-updating is disabled
	if (!GetDefault<ULevelEditorMiscSettings>()->bBSPAutoUpdate)
	{
		return;
	}

	FScopedSlowTask SlowTask(2);
	SlowTask.MakeDialogDelayed(3.0f);

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorServer.cpp:1790

Scope (from outer to inner):

file
function     void UEditorEngine::RebuildAlteredBSP

Source code excerpt:

	{
		// Early out if BSP auto-updating is disabled
		if (!GetDefault<ULevelEditorMiscSettings>()->bBSPAutoUpdate)
		{
			return;
		}

		FlushRenderingCommands();