r.VT.MenuRestricted
r.VT.MenuRestricted
#Overview
name: r.VT.MenuRestricted
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Restrict virtual texture menu options
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VT.MenuRestricted is to control the visibility and accessibility of Virtual Texture (VT) related options in the Unreal Engine 5 editor menu. It is primarily used for managing the user interface related to Virtual Textures.
This setting variable is primarily utilized by the Engine and Editor subsystems, specifically in the texture-related modules. Based on the callsites, it’s used in the EngineAssetDefinitions plugin and the TextureEditor module.
The value of this variable is set through the console variable system. It’s defined as a TAutoConsoleVariable with a default value of 0, meaning the VT menu options are not restricted by default.
The associated variable CVarVirtualTexturesMenuRestricted interacts directly with r.VT.MenuRestricted. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the visibility of Virtual Texture conversion options in the asset context menu. When set to 1 (true), it restricts these options, potentially limiting the ability to convert textures to and from Virtual Textures through the UI.
Best practices when using this variable include:
- Use it in conjunction with the CVarVirtualTexturesEnabled variable to ensure consistency in the VT feature availability.
- Consider the implications on user workflow when enabling this restriction, as it may impact texture asset management.
- Be cautious when changing this value at runtime, as it could lead to unexpected UI behavior.
Regarding the associated variable CVarVirtualTexturesMenuRestricted:
- Its purpose is identical to r.VT.MenuRestricted, serving as a programmatic interface to the same setting.
- It’s used in the EngineAssetDefinitions plugin to determine whether to show VT conversion options in the asset context menu.
- The value is retrieved using GetValueOnAnyThread(), suggesting it can be accessed from multiple threads.
- Developers should ensure consistency between uses of r.VT.MenuRestricted and CVarVirtualTexturesMenuRestricted to avoid conflicting behavior.
- Best practices include using the associated variable in C++ code for type safety and easier refactoring, while r.VT.MenuRestricted is more suitable for console commands or configuration files.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Texture.cpp:74
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarVirtualTexturesMenuRestricted(
TEXT("r.VT.MenuRestricted"),
0,
TEXT("Restrict virtual texture menu options"),
ECVF_Default);
static TAutoConsoleVariable<int32> CVarTexturesComputeChannelMinMaxDuringSave(
TEXT("r.TexturesComputeChannelMinMaxDuringSave"),
#Loc: <Workspace>/Engine/Plugins/Editor/EngineAssetDefinitions/Source/Private/AssetDefinition_Texture.cpp:205
Scope (from outer to inner):
file
lambda-function
lambda-function
Source code excerpt:
bool bVTEnabled = !! CVarVirtualTexturesEnabled->GetValueOnAnyThread();
static const auto CVarVirtualTexturesMenuRestricted = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.VT.MenuRestricted"));
check(CVarVirtualTexturesMenuRestricted);
bool bVTMenuRestricted = !! CVarVirtualTexturesMenuRestricted->GetValueOnAnyThread();
if ( bVTEnabled && ! bVTMenuRestricted )
{
const bool bHasVirtualTextures =
Algo::AnyOf(Context->SelectedAssets, [](const FAssetData& AssetData){
bool VirtualTextured = false;
AssetData.GetTagValue<bool>("VirtualTextureStreaming", VirtualTextured);
return VirtualTextured;
});
const bool bHasNonVirtualTextures =
Algo::AnyOf(Context->SelectedAssets, [](const FAssetData& AssetData){
bool VirtualTextured = false;
AssetData.GetTagValue<bool>("VirtualTextureStreaming", VirtualTextured);
return !VirtualTextured;
});
if (bHasVirtualTextures)
{
const TAttribute<FText> Label = LOCTEXT("Texture_ConvertToRegular", "Convert VT to Regular Texture");
const TAttribute<FText> ToolTip = LOCTEXT("Texture_ConvertToRegularTooltip", "Converts this texture to a regular 2D texture if it is a virtual texture.");
const FSlateIcon Icon = FSlateIcon(FAppStyle::GetAppStyleSetName(), "ClassIcon.Texture2D");
const FToolMenuExecuteAction UIAction = FToolMenuExecuteAction::CreateStatic(&ExecuteConvertToRegularTexture);
InSection.AddMenuEntry("Texture_ConvertToRegular", Label, ToolTip, Icon, UIAction);
}
if (bHasNonVirtualTextures)
{
const TAttribute<FText> Label = LOCTEXT("Texture_ConvertToVT", "Convert to Virtual Texture");
const TAttribute<FText> ToolTip = LOCTEXT("Texture_ConvertToVTTooltip", "Converts this texture to a virtual texture if it exceeds the specified size.");
const FSlateIcon Icon = FSlateIcon(FAppStyle::GetAppStyleSetName(), "ClassIcon.Texture2D");
const FToolMenuExecuteAction UIAction = FToolMenuExecuteAction::CreateStatic(&ExecuteConvertToVirtualTexture);
InSection.AddMenuEntry("Texture_ConvertToVT", Label, ToolTip, Icon, UIAction);
}
}
}
}));
}
}));
});
}
#undef LOCTEXT_NAMESPACE
#Loc: <Workspace>/Engine/Source/Editor/TextureEditor/Private/TextureEditorToolkit.cpp:1237
Scope (from outer to inner):
file
function TSharedRef<SWidget> FTextureEditorToolkit::BuildTexturePropertiesWidget
Source code excerpt:
// todo, maybe :
// check cvar "r.VT.MenuRestricted"
// if set, hide the "VirtualTextureStreaming" property
// TexturePropertiesWidget->SetIsPropertyVisibleDelegate(FIsPropertyVisible::CreateSP(this, &FTextureEditorToolkit::ShowTextureProperty));
return TexturePropertiesWidget.ToSharedRef();
}
#Associated Variable and Callsites
This variable is associated with another variable named CVarVirtualTexturesMenuRestricted
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Editor/EngineAssetDefinitions/Source/Private/AssetDefinition_Texture.cpp:205
Scope (from outer to inner):
file
lambda-function
lambda-function
Source code excerpt:
bool bVTEnabled = !! CVarVirtualTexturesEnabled->GetValueOnAnyThread();
static const auto CVarVirtualTexturesMenuRestricted = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.VT.MenuRestricted"));
check(CVarVirtualTexturesMenuRestricted);
bool bVTMenuRestricted = !! CVarVirtualTexturesMenuRestricted->GetValueOnAnyThread();
if ( bVTEnabled && ! bVTMenuRestricted )
{
const bool bHasVirtualTextures =
Algo::AnyOf(Context->SelectedAssets, [](const FAssetData& AssetData){
bool VirtualTextured = false;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Texture.cpp:73
Scope: file
Source code excerpt:
ECVF_Default);
static TAutoConsoleVariable<int32> CVarVirtualTexturesMenuRestricted(
TEXT("r.VT.MenuRestricted"),
0,
TEXT("Restrict virtual texture menu options"),
ECVF_Default);
static TAutoConsoleVariable<int32> CVarTexturesComputeChannelMinMaxDuringSave(