r.StaticMesh.EnableSaveGeneratedLODsInPackage
r.StaticMesh.EnableSaveGeneratedLODsInPackage
#Overview
name: r.StaticMesh.EnableSaveGeneratedLODsInPackage
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables saving generated LODs in the Package.\n0 - Do not save (and hide this menu option) [default].\n1 - Enable this option and save the LODs in the Package.\n
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.StaticMesh.EnableSaveGeneratedLODsInPackage is to control the saving of generated LODs (Levels of Detail) in the package for static meshes. This setting is primarily used in the context of static mesh editing and asset management within Unreal Engine.
This setting variable is utilized by the Static Mesh Editor module and the Engine Asset Definitions plugin. These subsystems rely on this variable to determine whether to expose and enable the functionality for saving generated LODs as part of the static mesh package.
The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 0, which means the feature is disabled by default.
The associated variable CVarEnableSaveGeneratedLODsInPackage interacts directly with r.StaticMesh.EnableSaveGeneratedLODsInPackage. They share the same value and purpose.
Developers must be aware that:
- This variable is a toggle (0 or 1) that enables or disables the feature.
- When disabled (0), the option to save generated LODs will be hidden from menus.
- When enabled (1), it allows saving of generated LODs in the package and exposes this option in relevant menus.
Best practices when using this variable include:
- Only enable it when you specifically need to save generated LODs as part of the package.
- Be mindful of the potential increase in package size when enabling this feature.
- Consider performance implications, as saving generated LODs might impact build times and asset processing.
Regarding the associated variable CVarEnableSaveGeneratedLODsInPackage:
- It serves the same purpose as r.StaticMesh.EnableSaveGeneratedLODsInPackage.
- It is defined as a TAutoConsoleVariable, allowing it to be changed at runtime through console commands.
- The variable is used to conditionally add menu entries and execute functions related to saving generated LODs.
- Developers should treat it identically to r.StaticMesh.EnableSaveGeneratedLODsInPackage in terms of usage and best practices.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Editor/EngineAssetDefinitions/Source/Private/AssetDefinition_StaticMesh.cpp:49
Scope (from outer to inner):
file
namespace MenuExtension_StaticMesh
Source code excerpt:
static TAutoConsoleVariable<int32> CVarEnableSaveGeneratedLODsInPackage(
TEXT("r.StaticMesh.EnableSaveGeneratedLODsInPackage"),
0,
TEXT("Enables saving generated LODs in the Package.\n") \
TEXT("0 - Do not save (and hide this menu option) [default].\n") \
TEXT("1 - Enable this option and save the LODs in the Package.\n"),
ECVF_Default
);
#Loc: <Workspace>/Engine/Source/Editor/StaticMeshEditor/Private/StaticMeshEditor.cpp:122
Scope (from outer to inner):
file
namespace StaticMeshEditor
function static void PopulateCollisionMenu
lambda-function
Source code excerpt:
Section.AddDynamicEntry("SaveGeneratedLODs", FNewToolMenuSectionDelegate::CreateLambda([](FToolMenuSection& InSection)
{
static auto* CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.StaticMesh.EnableSaveGeneratedLODsInPackage"));
if (CVar && CVar->GetValueOnGameThread() != 0)
{
InSection.AddMenuEntry(FStaticMeshEditorCommands::Get().SaveGeneratedLODs);
}
}));
}
}
static TSharedPtr<FStaticMeshEditor> GetStaticMeshEditorFromMenuContext(UAssetEditorToolkitMenuContext* InContext)
{
if (InContext)
{
if (TSharedPtr<FAssetEditorToolkit> Toolkit = InContext->Toolkit.Pin())
#Loc: <Workspace>/Engine/Source/Editor/StaticMeshEditor/Private/StaticMeshEditor.cpp:538
Scope (from outer to inner):
file
lambda-function
lambda-function
Source code excerpt:
InSection.AddDynamicEntry("SaveGeneratedLODs", FNewToolMenuSectionDelegate::CreateLambda([](FToolMenuSection& InSection)
{
static auto* CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.StaticMesh.EnableSaveGeneratedLODsInPackage"));
if (CVar && CVar->GetValueOnGameThread() != 0)
{
InSection.AddMenuEntry(FStaticMeshEditorCommands::Get().SaveGeneratedLODs);
}
}));
}));
}
void FStaticMeshEditor::AddReferencedObjects( FReferenceCollector& Collector )
{
Collector.AddReferencedObject( StaticMesh );
}
#Associated Variable and Callsites
This variable is associated with another variable named CVarEnableSaveGeneratedLODsInPackage
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Editor/EngineAssetDefinitions/Source/Private/AssetDefinition_StaticMesh.cpp:48
Scope (from outer to inner):
file
namespace MenuExtension_StaticMesh
Source code excerpt:
static TWeakObjectPtr<UStaticMesh> LODCopyMesh;
static TAutoConsoleVariable<int32> CVarEnableSaveGeneratedLODsInPackage(
TEXT("r.StaticMesh.EnableSaveGeneratedLODsInPackage"),
0,
TEXT("Enables saving generated LODs in the Package.\n") \
TEXT("0 - Do not save (and hide this menu option) [default].\n") \
TEXT("1 - Enable this option and save the LODs in the Package.\n"),
ECVF_Default
#Loc: <Workspace>/Engine/Plugins/Editor/EngineAssetDefinitions/Source/Private/AssetDefinition_StaticMesh.cpp:508
Scope (from outer to inner):
file
lambda-function
lambda-function
Source code excerpt:
if (const UContentBrowserAssetContextMenuContext* Context = UContentBrowserAssetContextMenuContext::FindContextWithAssets(InSection))
{
if (CVarEnableSaveGeneratedLODsInPackage.GetValueOnGameThread() != 0)
{
const TAttribute<FText> Label = LOCTEXT("ObjectContext_SaveGeneratedLODsInPackage", "Save Generated LODs");
const TAttribute<FText> ToolTip = LOCTEXT("ObjectContext_SaveGeneratedLODsInPackageTooltip", "Run the mesh reduce and save the generated LODs as part of the package.");
const FSlateIcon Icon = FSlateIcon();
FToolUIAction UIAction;