modeling.Selection.EnableVolumeLocking

modeling.Selection.EnableVolumeLocking

#Overview

name: modeling.Selection.EnableVolumeLocking

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 modeling.Selection.EnableVolumeLocking is to control whether Selection Locking is enabled by default for Volumes in the Unreal Engine modeling system.

This setting variable is primarily used by the Mesh Modeling Toolset plugin, specifically within the ModelingComponentsEditorOnly module. It affects the behavior of volume selection and locking functionality in the modeling tools.

The value of this variable is set as a console variable using TAutoConsoleVariable, with a default value of true. This means that by default, Selection Locking is enabled for Volumes.

The associated variable CVarEnableModelingSelectionVolumeLocking directly interacts with modeling.Selection.EnableVolumeLocking. It is used to access the value of the console variable in the C++ code.

Developers must be aware that this variable affects the default behavior of volume selection locking in the modeling tools. When enabled, it allows for more controlled selection of volumes, which can be beneficial for precise modeling work.

Best practices when using this variable include:

  1. Considering the impact on user experience when changing the default value.
  2. Documenting any changes to this setting for other team members.
  3. Testing the modeling tools thoroughly after modifying this setting to ensure desired behavior.

Regarding the associated variable CVarEnableModelingSelectionVolumeLocking:

The purpose of CVarEnableModelingSelectionVolumeLocking is to provide a programmatic way to access the value of the modeling.Selection.EnableVolumeLocking console variable within the C++ code.

This variable is used within the FVolumeSelector class in the ModelingComponentsEditorOnly module. It directly affects the behavior of the IsLockable() and IsLocked() functions of the FVolumeSelector class.

The value of this variable is set by the TAutoConsoleVariable declaration and is linked to the modeling.Selection.EnableVolumeLocking console variable.

CVarEnableModelingSelectionVolumeLocking interacts closely with the UEGlobal::UnlockedBrushComponents container, which seems to track unlocked brush components.

Developers should be aware that this variable’s value is accessed using the GetValueOnGameThread() method, which suggests it’s designed to be safely accessed from the game thread.

Best practices for using this variable include:

  1. Ensuring that any code depending on this variable’s value is executed on the game thread.
  2. Considering caching the value if it’s accessed frequently, to avoid potential performance impacts from repeated console variable lookups.
  3. Being aware of the potential impact on the modeling tool’s behavior when modifying code that uses this variable.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponentsEditorOnly/Private/Selection/VolumeSelector.cpp:25

Scope: file

Source code excerpt:


static TAutoConsoleVariable<bool> CVarEnableModelingSelectionVolumeLocking(
	TEXT("modeling.Selection.EnableVolumeLocking"),
	true,
	TEXT("Control whether Selection Locking is enabled by default for Volumes"));


namespace UEGlobal
{

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponentsEditorOnly/Private/Selection/VolumeSelector.cpp:24

Scope: file

Source code excerpt:

#define LOCTEXT_NAMESPACE "FVolumeSelector"

static TAutoConsoleVariable<bool> CVarEnableModelingSelectionVolumeLocking(
	TEXT("modeling.Selection.EnableVolumeLocking"),
	true,
	TEXT("Control whether Selection Locking is enabled by default for Volumes"));


namespace UEGlobal

#Loc: <Workspace>/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponentsEditorOnly/Private/Selection/VolumeSelector.cpp:44

Scope (from outer to inner):

file
function     bool FVolumeSelector::IsLockable

Source code excerpt:

bool FVolumeSelector::IsLockable() const
{
	return CVarEnableModelingSelectionVolumeLocking.GetValueOnGameThread();
}


bool FVolumeSelector::IsLocked() const
{
	if (CVarEnableModelingSelectionVolumeLocking.GetValueOnGameThread())
	{
		return BrushComponent != nullptr && (UEGlobal::UnlockedBrushComponents.Contains(BrushComponent) == false);
	}
	else
	{
		return (BrushComponent == nullptr);