modeling.EnablePresets
modeling.EnablePresets
#Overview
name: modeling.EnablePresets
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable tool preset features and UX
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of modeling.EnablePresets is to enable or disable tool preset features and user experience (UX) in the Modeling Tools Editor Mode of Unreal Engine 5. This setting variable is primarily used for controlling the availability of tool presets in the modeling toolset.
The Modeling Tools Editor Mode plugin relies on this setting variable. Specifically, it is used in the ModelingToolsEditorModeToolkit module, which is part of the Editor’s modeling tools functionality.
The value of this variable is set as a console variable with a default value of 1 (enabled). It can be changed at runtime through the console or programmatically.
This variable interacts directly with its associated variable CVarEnableToolPresets. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable controls the visibility and functionality of tool preset features in the Modeling Tools Editor Mode. When disabled (set to 0), the preset panel and related features will not be available to users.
Best practices when using this variable include:
- Only disable it if you want to restrict access to tool presets for all users.
- Consider the impact on user workflow before changing its value, as users may rely on presets for efficient modeling.
- If you’re extending the Modeling Tools Editor Mode, check this variable’s value before implementing preset-related features to ensure consistency with the engine’s behavior.
Regarding the associated variable CVarEnableToolPresets:
The purpose of CVarEnableToolPresets is identical to modeling.EnablePresets. It’s an internal representation of the console variable used within the C++ code.
This variable is used directly in the ModelingToolsEditorModeToolkit to determine whether to display the preset panel. It’s checked in the MakePresetPanel function to decide if the preset features should be enabled.
The value of CVarEnableToolPresets is set through the console variable system and can be accessed using the GetValueOnGameThread() method.
Developers should be aware that changes to CVarEnableToolPresets will immediately affect the availability of tool presets in the editor. It’s also used in conjunction with the InRestrictiveMode() check, which suggests that there might be additional restrictions on when presets are available.
Best practices for CVarEnableToolPresets include:
- Use GetValueOnGameThread() to access its current value in a thread-safe manner.
- Consider caching the value if it’s accessed frequently, as console variable lookups can have a performance cost.
- If implementing new features related to tool presets, always check this variable to ensure consistency with the rest of the Modeling Tools Editor Mode.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Editor/ModelingToolsEditorMode/Source/ModelingToolsEditorMode/Private/ModelingToolsEditorModeToolkit.cpp:80
Scope: file
Source code excerpt:
TEXT("Enable prototype PolyEdit tab"));
static TAutoConsoleVariable<int32> CVarEnableToolPresets(
TEXT("modeling.EnablePresets"),
1,
TEXT("Enable tool preset features and UX"));
namespace FModelingToolsEditorModeToolkitLocals
{
typedef TFunction<void(UInteractiveToolsPresetCollectionAsset& Preset, UInteractiveTool& Tool)> PresetAndToolFunc;
#Associated Variable and Callsites
This variable is associated with another variable named CVarEnableToolPresets
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Editor/ModelingToolsEditorMode/Source/ModelingToolsEditorMode/Private/ModelingToolsEditorModeToolkit.cpp:79
Scope: file
Source code excerpt:
0,
TEXT("Enable prototype PolyEdit tab"));
static TAutoConsoleVariable<int32> CVarEnableToolPresets(
TEXT("modeling.EnablePresets"),
1,
TEXT("Enable tool preset features and UX"));
namespace FModelingToolsEditorModeToolkitLocals
{
#Loc: <Workspace>/Engine/Plugins/Editor/ModelingToolsEditorMode/Source/ModelingToolsEditorMode/Private/ModelingToolsEditorModeToolkit.cpp:1103
Scope (from outer to inner):
file
function TSharedPtr<SWidget> FModelingToolsEditorModeToolkit::MakePresetPanel
Source code excerpt:
UModelingToolsEditorModeSettings* Settings = GetMutableDefault<UModelingToolsEditorModeSettings>();
bool bEnableToolPresets = (CVarEnableToolPresets.GetValueOnGameThread() > 0);
if (!bEnableToolPresets || Settings->InRestrictiveMode())
{
return SNew(SVerticalBox);
}
const TSharedPtr<SHorizontalBox> NewContent = SNew(SHorizontalBox);