bSnapVertices
bSnapVertices
#Overview
name: bSnapVertices
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 bSnapVertices is to control vertex snapping functionality in the Unreal Engine 5 level editor viewport. This setting variable is used to enable or disable the ability to snap vertices when manipulating objects in the level editor.
The bSnapVertices variable is primarily used by the Level Editor subsystem, specifically within the viewport and snapping utilities. It is referenced in the LevelEditorActions, LevelEditorViewportSettings, and SnappingUtils modules.
The value of this variable is set in several places:
- In the LevelEditorActions.cpp file, it can be toggled on or off through a user action in the editor.
- In the UnrealEdSrv.cpp file, it can be set programmatically through an exec command.
The bSnapVertices variable interacts with other snapping-related variables and functions, such as SnapDistance and IsSnapToVertexEnabled. It is part of the broader snapping system in the Unreal Engine editor.
Developers should be aware that:
- This variable affects the behavior of vertex snapping in the level editor viewport.
- Changing this value will immediately impact the editor’s snapping functionality.
- It is a boolean value, so it can only be true (enabled) or false (disabled).
Best practices when using this variable include:
- Providing a user-friendly way to toggle this setting in the editor UI.
- Considering performance implications when enabling vertex snapping, especially in large levels with many objects.
- Ensuring that related snapping settings (like SnapDistance) are appropriately configured when vertex snapping is enabled.
- Using the IsSnapToVertexEnabled function to check the current state of vertex snapping before performing snapping operations.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:426, section: [/Script/UnrealEd.LevelEditorViewportSettings]
- INI Section:
/Script/UnrealEd.LevelEditorViewportSettings
- Raw value:
False
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/LevelEditor/Private/LevelEditorActions.cpp:3056
Scope (from outer to inner):
file
function void FLevelEditorActionCallbacks::OnEnableVertexSnap
Source code excerpt:
{
ULevelEditorViewportSettings* ViewportSettings = GetMutableDefault<ULevelEditorViewportSettings>();
ViewportSettings->bSnapVertices = !ViewportSettings->bSnapVertices;
}
bool FLevelEditorActionCallbacks::OnIsVertexSnapEnabled()
{
return GetDefault<ULevelEditorViewportSettings>()->bSnapVertices;
}
FText FLevelEditorActionCallbacks::GetActorSnapTooltip()
{
// If the setting is enabled, return the distance, otherwise say disabled
if ( FSnappingUtils::IsSnapToActorEnabled() )
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/LevelEditorViewportSettings.h:472
Scope (from outer to inner):
file
class class ULevelEditorViewportSettings : public UObject
Source code excerpt:
UPROPERTY(config)
bool bSnapVertices;
UPROPERTY(config)
float SnapDistance;
UPROPERTY(config)
int32 CurrentPosGridSize;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/SnappingUtils.cpp:126
Scope (from outer to inner):
file
function bool FEditorViewportSnapping::IsSnapToVertexEnabled
Source code excerpt:
bool FEditorViewportSnapping::IsSnapToVertexEnabled(bool bIsPivot)
{
if( GetDefault<ULevelEditorViewportSettings>()->bSnapVertices )
{
return true;
}
else if( GCurrentLevelEditingViewportClient )
{
FLevelEditorModule& LevelEditor = FModuleManager::GetModuleChecked<FLevelEditorModule>( TEXT("LevelEditor") );
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/UnrealEdSrv.cpp:3058
Scope (from outer to inner):
file
function bool UUnrealEdEngine::Exec_Mode
Source code excerpt:
ULevelEditorViewportSettings* ViewportSettings = GetMutableDefault<ULevelEditorViewportSettings>();
ViewportSettings->bSnapVertices = !!DWord1;
ViewportSettings->PostEditChange();
FEditorSupportDelegates::UpdateUI.Broadcast();
}
if( FParse::Value(Str, TEXT("SHOWBRUSHMARKERPOLYS="), DWord1) )