Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #7

Merged
merged 22 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9e81449
Partially moved building columns-related logic from Settings BP to co…
JanSeliv Nov 7, 2023
64a45a3
Moved all theme-related logic from Settings BP to subwidgets BPs
JanSeliv Nov 8, 2023
d4e2962
Rewritten ToolTip logic from Settings BP to code
JanSeliv Nov 9, 2023
36a0af9
Simplified Setting ScrollBox by removing its unnecessary
JanSeliv Nov 13, 2023
06cb388
ScrollBox is part of Column widget now
JanSeliv Nov 13, 2023
6ba5213
Moved AddSetting-related logic directly to setting sub-widgets
JanSeliv Nov 17, 2023
b53e5bf
Moved column logic to its sub-widget
JanSeliv Nov 17, 2023
d85ac16
[Bug][Build] Fixed Settings data registry doesn't work after restarti…
JanSeliv Nov 18, 2023
db3df65
[Bug] Fixed crash on exiting the game through 'Stop' button (but not …
JanSeliv Dec 20, 2023
ad3986e
Updated binaries
JanSeliv Dec 28, 2023
3611afb
Fixed crash on 'stop' simulation button with dirty assets
JanSeliv Dec 29, 2023
f72702e
[UE5.4] Updated to newest engine version
JanSeliv Apr 1, 2024
01826f9
[UE5.4] Updated binaries
JanSeliv Apr 1, 2024
0e9496a
Added 'CallableWithoutWorldContext' meta to the static functions with…
JanSeliv Apr 20, 2024
3fe6c39
[UE5.4] Updated binaries from Preview to 5.4-release version
JanSeliv Apr 28, 2024
49cf20c
[UE5.4] Fixed missing includes
JanSeliv May 18, 2024
284ceda
Added Transient specifier for all BindWidget-properties as it's requi…
JanSeliv May 25, 2024
ba38d5d
[Bug] Fixed `Update Settings` property prevents referenced options fr…
JanSeliv Jun 2, 2024
1345d7a
[UE5.4][Bug] Fixed Settings Data Registry fails to call only in cook …
JanSeliv Jun 2, 2024
1e817f4
[Bug] Fixed setting buttons receive pressed event on every Settings W…
JanSeliv Jun 21, 2024
09b2e91
Added `AdvancedDisplay` specifier to properties with `VisibleInstance…
JanSeliv Aug 14, 2024
ceb8383
Updated readme to newest
JanSeliv Dec 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Binaries/Win64/UnrealEditor-SettingsWidgetConstructor.dll
Binary file not shown.
Binary file modified Binaries/Win64/UnrealEditor-SettingsWidgetConstructor.pdb
Binary file not shown.
Binary file not shown.
Binary file modified Binaries/Win64/UnrealEditor-SettingsWidgetConstructorEditor.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion Binaries/Win64/UnrealEditor.modules
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"BuildId": "27405482",
"BuildId": "33043543",
"Modules":
{
"SettingsWidgetConstructor": "UnrealEditor-SettingsWidgetConstructor.dll",
Expand Down
18 changes: 10 additions & 8 deletions Config/BaseSettingsWidgetConstructor.ini
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
[/Script/SettingsWidgetConstructorEditor.SettingsWidgetFactory]
SettingsWidgetClassInternal=WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/WBP_SettingsWidgetConstructor.WBP_SettingsWidgetConstructor_C'
SettingsWidgetClassInternal=/Script/UMG.WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/WBP_SettingsWidgetConstructor.WBP_SettingsWidgetConstructor_C'

[/Script/SettingsWidgetConstructor.SettingsDataAsset]
SettingsDataTableInternal=
SettingsDataRegistryInternal=/SettingsWidgetConstructor/Data/DR_SettingsDataTables.DR_SettingsDataTables
ButtonClassInternal=WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/Subwidgets/WBP_SettingsButton.WBP_SettingsButton_C'
CheckboxClassInternal=WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/Subwidgets/WBP_SettingsCheckBox.WBP_SettingsCheckBox_C'
ComboboxClassInternal=WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/Subwidgets/WBP_SettingsCombobox.WBP_SettingsCombobox_C'
SliderClassInternal=WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/Subwidgets/WBP_SettingsSlider.WBP_SettingsSlider_C'
TextLineClassInternal=WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/Subwidgets/WBP_SettingsTextLine.WBP_SettingsTextLine_C'
UserInputClassInternal=WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/Subwidgets/WBP_SettingsTextInput.WBP_SettingsTextInput_C'
ButtonClassInternal=/Script/UMG.WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/Subwidgets/WBP_SettingsButton.WBP_SettingsButton_C'
CheckboxClassInternal=/Script/UMG.WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/Subwidgets/WBP_SettingsCheckBox.WBP_SettingsCheckBox_C'
ComboboxClassInternal=/Script/UMG.WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/Subwidgets/WBP_SettingsCombobox.WBP_SettingsCombobox_C'
SliderClassInternal=/Script/UMG.WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/Subwidgets/WBP_SettingsSlider.WBP_SettingsSlider_C'
TextLineClassInternal=/Script/UMG.WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/Subwidgets/WBP_SettingsTextLine.WBP_SettingsTextLine_C'
UserInputClassInternal=/Script/UMG.WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/Subwidgets/WBP_SettingsTextInput.WBP_SettingsTextInput_C'
TooltipClassInternal=/Script/UMG.WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/Subwidgets/WBP_SettingsToolTip.WBP_SettingsToolTip_C'
ColumnClassInternal=/Script/UMG.WidgetBlueprintGeneratedClass'/SettingsWidgetConstructor/Subwidgets/WBP_SettingsMenuColumn.WBP_SettingsMenuColumn_C'
bAutoConstructInternal=True
bAutoFocusOnOpenInternal=True
SettingsPercentSizeInternal=(X=0.600000,Y=0.400000)
SettingsPaddingInternal=(Left=50.000000,Top=50.000000,Right=50.000000,Bottom=50.000000)
ScrollboxPercentHeightInternal=1.000000
ScrollboxPaddingInternal=(Left=0.000000,Top=0.000000,Right=0.000000,Bottom=0.000000)
ColumnPaddingInternal=(Left=10.000000,Top=0.000000,Right=10.000000,Bottom=0.000000)
SpaceBetweenColumnsInternal=10.000000
ButtonThemeDataInternal=(PressedPadding=(Left=0.000000,Top=0.000000,Right=0.000000,Bottom=0.000000),Texture=Texture2D'"/SettingsWidgetConstructor/Textures/T_Settings_Button.T_Settings_Button"',Size=(X=128.000000,Y=128.000000),DrawAs=Box,Margin=(Left=0.250000,Top=0.250000,Right=0.250000,Bottom=0.250000),Padding=(Left=0.000000,Top=0.000000,Right=0.000000,Bottom=0.000000))
CheckboxThemeDataInternal=(CheckedTexture=Texture2D'"/SettingsWidgetConstructor/Textures/T_Settings_Checkbox_checked.T_Settings_Checkbox_checked"',UndeterminedTexture=None,Texture=Texture2D'"/SettingsWidgetConstructor/Textures/T_Settings_Checkbox_unchecked.T_Settings_Checkbox_unchecked"',Size=(X=24.000000,Y=24.000000),DrawAs=Image,Margin=(Left=0.000000,Top=0.000000,Right=0.000000,Bottom=0.000000),Padding=(Left=0.000000,Top=0.000000,Right=0.000000,Bottom=0.000000))
Expand Down
Binary file modified Content/Subwidgets/WBP_SettingsButton.uasset
Binary file not shown.
Binary file modified Content/Subwidgets/WBP_SettingsCheckBox.uasset
Binary file not shown.
Binary file modified Content/Subwidgets/WBP_SettingsCombobox.uasset
Binary file not shown.
Binary file modified Content/Subwidgets/WBP_SettingsMenuColumn.uasset
Binary file not shown.
Binary file removed Content/Subwidgets/WBP_SettingsScrollItem.uasset
Binary file not shown.
Binary file removed Content/Subwidgets/WBP_SettingsScrollWrapper.uasset
Binary file not shown.
Binary file removed Content/Subwidgets/WBP_SettingsScrollbox.uasset
Binary file not shown.
Binary file modified Content/Subwidgets/WBP_SettingsSlider.uasset
Binary file not shown.
Binary file removed Content/Subwidgets/WBP_SettingsSpacer.uasset
Binary file not shown.
Binary file modified Content/Subwidgets/WBP_SettingsTextInput.uasset
Binary file not shown.
Binary file modified Content/Subwidgets/WBP_SettingsTextLine.uasset
Binary file not shown.
Binary file modified Content/Subwidgets/WBP_SettingsToolTip.uasset
Binary file not shown.
Binary file modified Content/WBP_SettingsWidgetConstructor.uasset
Binary file not shown.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Check out our [Release](https://github.com/JanSeliv/SettingsWidgetConstructor/re
Also, explore this [game project repository](https://github.com/JanSeliv/Bomber) to view the Settings Widget Constructor in action.

## 📅 Changelog
#### 2024-12-26
- Updated to **Unreal Engine 5.4**.
- Moved a significant chunk of the logic from blueprints to code and simplified amount of widgets used.
#### 2023-10-12
- Updated to **Unreal Engine 5.3**
- Added **multiple Settings Data Tables** support ([see doc](https://docs.google.com/document/d/1IXnOqrgaXTClP-0cIo28a9f6GHc9N1BCgTNnMk-X9VQ/edit#heading=h.cix3vjszb2vm)).
Expand Down
2 changes: 1 addition & 1 deletion SettingsWidgetConstructor.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "mailto:[email protected]",
"EngineVersion": "5.3.0",
"EngineVersion": "5.4.0",
"EnabledByDefault": true,
"CanContainContent": true,
"IsBetaVersion": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ void FSettingsButton::BindSetting(USettingsWidget& SettingsWidget, const FSettin
SettingsWidget.BindButton(PrimaryData, *this);
}

// Calls the Add function of the Settings Widget of this setting type
void FSettingsButton::AddSetting(USettingsWidget& SettingsWidget, const FSettingsPrimary& PrimaryData)
{
SettingsWidget.AddButton(PrimaryData, *this);
}

/*********************************************************************************************
* FSettingsCheckbox
********************************************************************************************* */
Expand Down Expand Up @@ -67,12 +61,6 @@ void FSettingsCheckbox::BindSetting(USettingsWidget& SettingsWidget, const FSett
SettingsWidget.BindCheckbox(PrimaryData, *this);
}

// Calls the Add function of the Settings Widget of this setting type
void FSettingsCheckbox::AddSetting(USettingsWidget& SettingsWidget, const FSettingsPrimary& InOutPrimaryData)
{
SettingsWidget.AddCheckbox(InOutPrimaryData, *this);
}

/*********************************************************************************************
* FSettingsCombobox
********************************************************************************************* */
Expand Down Expand Up @@ -120,12 +108,6 @@ void FSettingsCombobox::BindSetting(USettingsWidget& SettingsWidget, const FSett
SettingsWidget.BindCombobox(PrimaryData, *this);
}

// Calls the Add function of the Settings Widget of this setting type
void FSettingsCombobox::AddSetting(USettingsWidget& SettingsWidget, const FSettingsPrimary& InOutPrimaryData)
{
SettingsWidget.AddCombobox(InOutPrimaryData, *this);
}

/*********************************************************************************************
* FSettingsSlider
********************************************************************************************* */
Expand Down Expand Up @@ -156,12 +138,6 @@ void FSettingsSlider::BindSetting(USettingsWidget& SettingsWidget, const FSettin
SettingsWidget.BindSlider(PrimaryData, *this);
}

// Calls the Add function of the Settings Widget of this setting type
void FSettingsSlider::AddSetting(USettingsWidget& SettingsWidget, const FSettingsPrimary& InOutPrimaryData)
{
SettingsWidget.AddSlider(InOutPrimaryData, *this);
}

/*********************************************************************************************
* FSettingsTextLine
********************************************************************************************* */
Expand Down Expand Up @@ -193,12 +169,6 @@ void FSettingsTextLine::BindSetting(USettingsWidget& SettingsWidget, const FSett
SettingsWidget.BindTextLine(PrimaryData, *this);
}

// Calls the Add function of the Settings Widget of this setting type
void FSettingsTextLine::AddSetting(USettingsWidget& SettingsWidget, const FSettingsPrimary& InOutPrimaryData)
{
SettingsWidget.AddTextLine(InOutPrimaryData, *this);
}

/*********************************************************************************************
* FSettingsUserInput
********************************************************************************************* */
Expand Down Expand Up @@ -229,12 +199,6 @@ void FSettingsUserInput::BindSetting(USettingsWidget& SettingsWidget, const FSet
SettingsWidget.BindUserInput(PrimaryData, *this);
}

// Calls the Add function of the Settings Widget of this setting type
void FSettingsUserInput::AddSetting(USettingsWidget& SettingsWidget, const FSettingsPrimary& InOutPrimaryData)
{
SettingsWidget.AddUserInput(InOutPrimaryData, *this);
}

/*********************************************************************************************
* FSettingsCustomWidget
********************************************************************************************* */
Expand All @@ -257,9 +221,3 @@ void FSettingsCustomWidget::BindSetting(USettingsWidget& SettingsWidget, const F
{
SettingsWidget.BindCustomWidget(PrimaryData, *this);
}

// Calls the Add function of the Settings Widget of this setting type
void FSettingsCustomWidget::AddSetting(USettingsWidget& SettingsWidget, const FSettingsPrimary& InOutPrimaryData)
{
SettingsWidget.AddCustomWidget(InOutPrimaryData, *this);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#include "Data/SettingsDataTable.h"
#include "MyUtilsLibraries/SettingsUtilsLibrary.h"
//---
#include "DataRegistry.h"
#include "Engine/Engine.h"
#include "Misc/CoreDelegates.h"
//---
#include UE_INLINE_GENERATED_CPP_BY_NAME(SettingsDataAsset)

// Returns the data table, it has to be set manually
Expand All @@ -14,7 +18,7 @@ const USettingsDataTable* USettingsDataAsset::GetSettingsDataTable() const
}

// Returns the Settings Data Registry asset, is automatically set by default to which 'Settings Data Table' is added by itself
const UDataRegistry* USettingsDataAsset::GetSettingsDataRegistry() const
UDataRegistry* USettingsDataAsset::GetSettingsDataRegistry() const
{
return SettingsDataRegistryInternal.LoadSynchronous();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ USettingsDataTable::USettingsDataTable()
RowStruct = FSettingsRow::StaticStruct();
}

// Returns the table rows
void USettingsDataTable::GetSettingRows(TMap<FName, FSettingsRow>& OutRows) const
{
GetRows(OutRows);
}

#if WITH_EDITOR
// Called on every change in this data table to automatic set the key name by specified setting tag
void USettingsDataTable::OnThisDataTableChanged(FName RowKey, const uint8& RowData)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ class FSWCWidgetUtilsLibrary
* As an example, it returns SCheckbox slate widget from UCheckBox widget. */
template <typename T>
static FORCEINLINE TSharedPtr<T> GetSlateWidget(const UWidget* ForWidget) { return ForWidget ? StaticCastSharedPtr<T>(ForWidget->GetCachedWidget()) : nullptr; }

/** Completely destroys specified widget.
* Is useful for MGF-modules unloading in runtime.
* In most gameplay cases it should not be used, since it's expensive: prefer collapse widget instead. */
static void DestroyWidget(UUserWidget& ParentWidget);
};
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ UGameUserSettings* USettingsUtilsLibrary::GetGameUserSettings(const UObject* Opt
}

// Returns all Settings Rows from project's Settings Data Table and all other additional Data Tables from 'SettingsDataTable' Data Registry
void USettingsUtilsLibrary::GetAllSettingRows(TMap<FName, FSettingsRow>& OutSettingRows)
void USettingsUtilsLibrary::GenerateAllSettingRows(TMap<FName, FSettingsPicker>& OutSettingRows)
{
if (!OutSettingRows.IsEmpty())
{
Expand Down Expand Up @@ -102,7 +102,7 @@ void USettingsUtilsLibrary::GetAllSettingRows(TMap<FName, FSettingsRow>& OutSett
for (const FSettingsRow& Row : OrderedSettings)
{
const FName Tag = Row.SettingsPicker.PrimaryData.Tag.GetTagName();
OutSettingRows.Add(Tag, Row);
OutSettingRows.Add(Tag, Row.SettingsPicker);

// Check if there's an override block for this tag
const FSettingTag SettingTag = Row.SettingsPicker.PrimaryData.Tag;
Expand All @@ -113,7 +113,7 @@ void USettingsUtilsLibrary::GetAllSettingRows(TMap<FName, FSettingsRow>& OutSett
for (const FSettingsRow& OverrideRow : *OverrideBlock)
{
const FName OverrideTag = OverrideRow.SettingsPicker.PrimaryData.Tag.GetTagName();
OutSettingRows.Add(OverrideTag, OverrideRow);
OutSettingRows.Add(OverrideTag, OverrideRow.SettingsPicker);
}
}
}
Expand All @@ -129,7 +129,7 @@ void USettingsUtilsLibrary::RegisterDataTable(const TSoftObjectPtr<const USettin
UDataRegistrySubsystem* DataRegistrySubsystem = UDataRegistrySubsystem::Get();
checkf(DataRegistrySubsystem, TEXT("ERROR: [%i] %s:\n'DataRegistrySubsystem' is null!"), __LINE__, *FString(__FUNCTION__));

const TSoftObjectPtr<const UDataRegistry>& SettingsDataRegistry = USettingsDataAsset::Get().GetSettingsDataRegistrySoft();
const TSoftObjectPtr<UDataRegistry>& SettingsDataRegistry = USettingsDataAsset::Get().GetSettingsDataRegistrySoft();
if (ensureMsgf(!SettingsDataRegistry.IsNull(), TEXT("ASSERT: 'SettingsDataRegistry' is null, it has to be set automatically, something went wrong!")))
{
// Initialize the Settings Data Registry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,37 @@ UUserWidget* FSWCWidgetUtilsLibrary::FindWidgetOfClass(UObject* WorldContextObje
{
TArray<UUserWidget*> FoundWidgets;
UWidgetBlueprintLibrary::GetAllWidgetsOfClass(WorldContextObject, /*out*/FoundWidgets, ParentWidgetClass);
return !FoundWidgets.IsEmpty()? FoundWidgets[0] : nullptr;
return !FoundWidgets.IsEmpty() ? FoundWidgets[0] : nullptr;
}

// Completely destroys specified widget
void FSWCWidgetUtilsLibrary::DestroyWidget(UUserWidget& ParentWidget)
{
// Get an array of all child widgets
TArray<UWidget*> ChildWidgets;
const UWidgetTree* WidgetTree = ParentWidget.WidgetTree;
WidgetTree->GetAllWidgets(ChildWidgets);

// Iterate through the child widgets
for (UWidget* ChildWidgetIt : ChildWidgets)
{
UUserWidget* ChildUserWidget = Cast<UUserWidget>(ChildWidgetIt);
const UWidgetTree* WidgetTreeIt = IsValid(ChildUserWidget) ? ChildUserWidget->WidgetTree : nullptr;
const bool bHasChildWidgets = WidgetTreeIt && WidgetTreeIt->RootWidget;

if (bHasChildWidgets)
{
// If the child widget has its own child widgets, recursively remove and destroy them
DestroyWidget(*ChildUserWidget);
}
}

// Hide widget to let last chance react on visibility change
ParentWidget.SetVisibility(ESlateVisibility::Collapsed);

// Remove the child widget from the viewport
ParentWidget.RemoveFromParent();

// RemoveFromParent() does not completely destroy widget, so schedule the child widget for destruction
ParentWidget.ConditionalBeginDestroy();
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Copyright (c) Yevhenii Selivanov.

#include "SettingsWidgetConstructorModule.h"

#define LOCTEXT_NAMESPACE "FSettingsWidgetConstructorModule"

//---
#include "Modules/ModuleManager.h"
// Called right after the module DLL has been loaded and the module object has been created
void FSettingsWidgetConstructorModule::StartupModule()
{
Expand All @@ -17,6 +16,4 @@ void FSettingsWidgetConstructorModule::ShutdownModule()
// we call this function before unloading the module.
}

#undef LOCTEXT_NAMESPACE

IMPLEMENT_MODULE(FSettingsWidgetConstructorModule, SettingsWidgetConstructor)
Loading