SettingsEditor.HideSetAsDefaultButton
SettingsEditor.HideSetAsDefaultButton
#Overview
name: SettingsEditor.HideSetAsDefaultButton
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Hide the Settings Editor button to save to default config.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of SettingsEditor.HideSetAsDefaultButton is to control the visibility of the “Set As Default” button in the Unreal Engine Settings Editor. This setting is specifically related to the user interface of the Settings Editor, which is part of the engine’s development tools.
This setting variable is primarily used in the SettingsEditor module, which is part of Unreal Engine’s development tools subsystem. It’s specifically implemented in the SSettingsSectionHeader widget, which is responsible for rendering the header of a settings section in the Settings Editor.
The value of this variable is set through a console variable (CVar) system. It’s initialized as a boolean value (false by default) and can be changed at runtime using console commands or through code that interacts with the CVar system.
The associated variable bHideSetAsDefaultButton directly interacts with SettingsEditor.HideSetAsDefaultButton. They share the same value, with bHideSetAsDefaultButton being the actual boolean variable used in the code logic.
Developers must be aware that this variable is used as a workaround to hide the “Set As Default” button. The comment in the code suggests that this is a temporary solution until a better way is found to determine if a config file is cooked (pre-processed for distribution).
Best practices when using this variable include:
- Use it cautiously, as it’s described as a workaround in the comments.
- Be aware that changing this setting will affect the user interface of the Settings Editor, potentially confusing users who expect to see the “Set As Default” button.
- If modifying this setting, ensure to document the change and communicate it to other developers who might be using the Settings Editor.
- Consider the implications of hiding the “Set As Default” functionality, as it may impact workflows that rely on this feature.
Regarding the associated variable bHideSetAsDefaultButton:
This boolean variable is the actual flag used in the code to determine whether the “Set As Default” button should be hidden. It’s used in the HandleSetAsDefaultButtonVisibility() function to control the visibility of the button in the UI. When true, the button will be hidden (collapsed); when false, it will be visible if the section can save defaults.
Developers should be aware that modifying bHideSetAsDefaultButton directly in code will have the same effect as changing the SettingsEditor.HideSetAsDefaultButton console variable. They should use this variable when implementing logic related to the visibility of the “Set As Default” button within the SSettingsSectionHeader class or related components.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/SettingsEditor/Private/Widgets/SSettingsSectionHeader.cpp:24
Scope: file
Source code excerpt:
// Currently the only way to know is to check if MakeDefaultConfigFileWritable returns false, but that can't happen before the button is clicked
bool bHideSetAsDefaultButton = false;
FAutoConsoleVariableRef CVarHideSetAsDefaultButton(TEXT("SettingsEditor.HideSetAsDefaultButton"), bHideSetAsDefaultButton, TEXT("Hide the Settings Editor button to save to default config."));
void SSettingsSectionHeader::Construct(const FArguments& InArgs, const UObject* InSettingsObject, ISettingsEditorModelPtr InModel, TSharedPtr<IDetailsView> InDetailsView, const TSharedPtr<ITableRow>& InTableRow)
{
Model = InModel;
SettingsObject = MakeWeakObjectPtr(const_cast<UObject*>(InSettingsObject));
SettingsSection = Model->GetSectionFromSectionObject(InSettingsObject);
#Associated Variable and Callsites
This variable is associated with another variable named bHideSetAsDefaultButton
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Developer/SettingsEditor/Private/Widgets/SSettingsSectionHeader.cpp:23
Scope: file
Source code excerpt:
// Workaround to hide Set As Default button until there's a better way to determine if config file is cooked
// Currently the only way to know is to check if MakeDefaultConfigFileWritable returns false, but that can't happen before the button is clicked
bool bHideSetAsDefaultButton = false;
FAutoConsoleVariableRef CVarHideSetAsDefaultButton(TEXT("SettingsEditor.HideSetAsDefaultButton"), bHideSetAsDefaultButton, TEXT("Hide the Settings Editor button to save to default config."));
void SSettingsSectionHeader::Construct(const FArguments& InArgs, const UObject* InSettingsObject, ISettingsEditorModelPtr InModel, TSharedPtr<IDetailsView> InDetailsView, const TSharedPtr<ITableRow>& InTableRow)
{
Model = InModel;
SettingsObject = MakeWeakObjectPtr(const_cast<UObject*>(InSettingsObject));
SettingsSection = Model->GetSectionFromSectionObject(InSettingsObject);
#Loc: <Workspace>/Engine/Source/Developer/SettingsEditor/Private/Widgets/SSettingsSectionHeader.cpp:326
Scope (from outer to inner):
file
function EVisibility SSettingsSectionHeader::HandleSetAsDefaultButtonVisibility
Source code excerpt:
EVisibility SSettingsSectionHeader::HandleSetAsDefaultButtonVisibility() const
{
return (!bHideSetAsDefaultButton && (SettingsSection.IsValid() && SettingsSection->CanSaveDefaults())) ? EVisibility::Visible : EVisibility::Collapsed;
}
FReply SSettingsSectionHeader::HandleSetAsDefaultButtonClicked()
{
if(SettingsSection.IsValid())
{