modeling.Selection.EnableStaticMeshLocking

modeling.Selection.EnableStaticMeshLocking

#Overview

name: modeling.Selection.EnableStaticMeshLocking

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.EnableStaticMeshLocking is to control whether Selection Locking is enabled by default for Static Meshes in the Unreal Engine’s modeling system.

This setting variable is primarily used in the Mesh Modeling Toolset plugin, specifically within the ModelingComponentsEditorOnly module. It affects the behavior of the Static Mesh selection system.

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 Static Meshes.

The associated variable CVarEnableModelingSelectionStaticMeshLocking directly interacts with this setting. It’s used to retrieve the current value of the setting in the code.

Developers must be aware that this variable affects the default behavior of Static Mesh selection locking. When enabled, it may impact how users interact with Static Meshes in the editor, particularly in terms of selection and modification capabilities.

Best practices when using this variable include:

  1. Consider the impact on user workflow before changing the default value.
  2. Provide clear documentation or user interface indicators if the behavior is changed.
  3. Ensure that any tools or systems that interact with Static Mesh selection are aware of and respect this setting.

Regarding the associated variable CVarEnableModelingSelectionStaticMeshLocking:

Its purpose is to provide a programmatic way to access the value of the modeling.Selection.EnableStaticMeshLocking setting within the C++ code.

This variable is used within the FStaticMeshSelector class to determine whether Static Meshes are lockable and whether they are currently locked. It’s accessed using the GetValueOnGameThread() method, which suggests that the value can be changed at runtime.

The value of this variable is set by the TAutoConsoleVariable constructor, which links it to the modeling.Selection.EnableStaticMeshLocking console variable.

Developers should be aware that changes to this variable will directly affect the behavior of the FStaticMeshSelector class and potentially other parts of the Static Mesh selection system.

Best practices for using this variable include:

  1. Use the GetValueOnGameThread() method to access the current value, as it ensures thread-safe access.
  2. Consider caching the value if it’s accessed frequently in performance-critical code sections.
  3. Be aware that the value can change at runtime, so don’t assume it remains constant throughout the application’s lifecycle.

#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/StaticMeshSelector.cpp:28

Scope: file

Source code excerpt:


static TAutoConsoleVariable<bool> CVarEnableModelingSelectionStaticMeshLocking(
	TEXT("modeling.Selection.EnableStaticMeshLocking"),
	true,
	TEXT("Control whether Selection Locking is enabled by default for Static Meshes"));

namespace UEGlobal
{
	/**

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

#define LOCTEXT_NAMESPACE "FStaticMeshSelector"

static TAutoConsoleVariable<bool> CVarEnableModelingSelectionStaticMeshLocking(
	TEXT("modeling.Selection.EnableStaticMeshLocking"),
	true,
	TEXT("Control whether Selection Locking is enabled by default for Static Meshes"));

namespace UEGlobal
{

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

Scope (from outer to inner):

file
function     bool FStaticMeshSelector::IsLockable

Source code excerpt:

bool FStaticMeshSelector::IsLockable() const 
{ 
	return CVarEnableModelingSelectionStaticMeshLocking.GetValueOnGameThread();
}


bool FStaticMeshSelector::IsLocked() const
{
	if (CVarEnableModelingSelectionStaticMeshLocking.GetValueOnGameThread())
	{
		return WeakStaticMesh != nullptr && (UEGlobal::UnlockedStaticMeshes.Contains(WeakStaticMesh.Get()) == false);
	}
	else
	{
		return (WeakStaticMesh == nullptr);