diff --git a/CommonTime.uplugin b/CommonTime.uplugin
index 2c23db8..ef09f70 100644
--- a/CommonTime.uplugin
+++ b/CommonTime.uplugin
@@ -1,20 +1,18 @@
{
"FileVersion": 3,
"Version": 1,
- "VersionName": "1.0",
+ "VersionName": "0.1.0",
"FriendlyName": "CommonTime",
- "Description": "",
+ "Description": "Provides an editor view for editing DateTime and Timespan values.",
"Category": "Editor",
"CreatedBy": "MrRobinOfficial",
"CreatedByURL": "https://github.com/MrRobinOfficial",
- "DocsURL": "",
+ "DocsURL": "https://github.com/MrRobinOfficial/Unreal-CommonTime",
"MarketplaceURL": "",
- "SupportURL": "",
- "EnabledByDefault": true,
+ "SupportURL": "https://github.com/MrRobinOfficial/Unreal-CommonTime/issues",
+ "EngineVersion": "5.3.0",
"CanContainContent": true,
- "IsBetaVersion": false,
- "IsExperimentalVersion": false,
- "Installed": false,
+ "Installed": true,
"Modules": [
{
"Name": "CommonTime",
diff --git a/Config/FilterPlugin.ini b/Config/FilterPlugin.ini
new file mode 100644
index 0000000..ccebca2
--- /dev/null
+++ b/Config/FilterPlugin.ini
@@ -0,0 +1,8 @@
+[FilterPlugin]
+; This section lists additional files which will be packaged along with your plugin. Paths should be listed relative to the root plugin directory, and
+; may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively.
+;
+; Examples:
+; /README.txt
+; /Extras/...
+; /Binaries/ThirdParty/*.dll
diff --git a/README.md b/README.md
index 7240a63..3e3121e 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,42 @@
-# Unreal-CommonTime
\ No newline at end of file
+
+
+
+
+
+CommonTime [Unreal Engine]
+
+
+
+*Provides an editor view for editing DateTime and Timespan values.*
+
+[](https://github.com/mrrobinofficial/unreal-commontime/blob/HEAD/LICENSE.txt)
+
+
+
+
+
+#
+
+## ⚙️ Supported Platforms
+This plug-in was last built against Unreal Engine 5.3.
+
+## ⚒️ Installation
+
+You can install from the release section.
+
+Alternatively, you can install this plugin via terminal with [*git*](https://git-scm.com/). **Here is the command for installing it**.
+
+```console
+git clone git@github.com:MrRobinOfficial/Unreal-CommonTime.git CommonTime
+```
+
+#
+
+
+ 🖼️ Screenshots
+
+
+#
+
+## 🆘 Support
+If you have any questions or issue, just write either to my [YouTube channel](https://www.youtube.com/@mrrobinofficial), [Email](mailto:mrrobin123mail@gmail.com) or [Twitter DM](https://twitter.com/MrRobinOfficial).
diff --git a/Resources/Icon128.png b/Resources/Icon128.png
index 1231d4a..4862a02 100644
Binary files a/Resources/Icon128.png and b/Resources/Icon128.png differ
diff --git a/Source/CommonTime/Private/DetailCustomizations/MyDateTimeDetailCustomization.cpp b/Source/CommonTime/Private/DetailCustomizations/MyDateTimeDetailCustomization.cpp
index 3b15b90..ab3a23c 100644
--- a/Source/CommonTime/Private/DetailCustomizations/MyDateTimeDetailCustomization.cpp
+++ b/Source/CommonTime/Private/DetailCustomizations/MyDateTimeDetailCustomization.cpp
@@ -18,9 +18,13 @@
#include "Widgets/DeclarativeSyntaxSupport.h"
#include "DetailLayoutBuilder.h"
-
#include "Widgets/Input/SNumericEntryBox.h"
#include "Widgets/Input/SVectorInputBox.h"
+#include "Widgets/Input/NumericTypeInterface.h"
+#include "Widgets/Input/NumericUnitTypeInterface.inl"
+#include "Math/UnitConversion.h"
+
+// SExpanderArrow
#define LOCTEXT_NAMESPACE "MyDateTimeDetailCustomization"
@@ -36,8 +40,95 @@ void FMyDateTimeDetailCustomization::CustomizeHeader(TSharedRef
{
PropertyHandle = StructPropertyHandle;
- const FSlateColor FgColor = FSlateColor(FColor::Yellow);
- const FSlateColor BgColor = FSlateColor(FColor::Blue);
+ SAssignNew(YearEntryBox, SNumericEntryBox)
+ .AllowSpin(true)
+ .MinValue(1)
+ .MaxValue(9999)
+ .MinSliderValue(1)
+ .MaxSliderValue(9999)
+ .Font(IDetailLayoutBuilder::GetDetailFont())
+ .Value(this, &FMyDateTimeDetailCustomization::OnGetValue, 3)
+ .OnValueChanged(this, &FMyDateTimeDetailCustomization::OnValueChanged, 3)
+ .OnValueCommitted(this, &FMyDateTimeDetailCustomization::OnValueCommitted, 3)
+ .OnBeginSliderMovement(this, &FMyDateTimeDetailCustomization::OnBeginSliderMovement)
+ .OnEndSliderMovement(this, &FMyDateTimeDetailCustomization::OnEndSliderMovement)
+ .TypeInterface(MakeShareable(new TNumericUnitTypeInterface(EUnit::Years)))
+ .LinearDeltaSensitivity(1);
+
+ SAssignNew(MonthEntryBox, SNumericEntryBox)
+ .AllowSpin(true)
+ .MinValue(1)
+ .MaxValue(12)
+ .MinSliderValue(1)
+ .MaxSliderValue(12)
+ .Font(IDetailLayoutBuilder::GetDetailFont())
+ .Value(this, &FMyDateTimeDetailCustomization::OnGetValue, 4)
+ .OnValueChanged(this, &FMyDateTimeDetailCustomization::OnValueChanged, 4)
+ .OnValueCommitted(this, &FMyDateTimeDetailCustomization::OnValueCommitted, 4)
+ .OnBeginSliderMovement(this, &FMyDateTimeDetailCustomization::OnBeginSliderMovement)
+ .OnEndSliderMovement(this, &FMyDateTimeDetailCustomization::OnEndSliderMovement)
+ .TypeInterface(MakeShareable(new TNumericUnitTypeInterface(EUnit::Months)))
+ .LinearDeltaSensitivity(1);
+
+ SAssignNew(DayEntryBox, SNumericEntryBox)
+ .AllowSpin(true)
+ .MinValue(1)
+ .MaxValue(31)
+ .MinSliderValue(1)
+ .MaxSliderValue(31)
+ .Font(IDetailLayoutBuilder::GetDetailFont())
+ .Value(this, &FMyDateTimeDetailCustomization::OnGetValue, 5)
+ .OnValueChanged(this, &FMyDateTimeDetailCustomization::OnValueChanged, 5)
+ .OnValueCommitted(this, &FMyDateTimeDetailCustomization::OnValueCommitted, 5)
+ .OnBeginSliderMovement(this, &FMyDateTimeDetailCustomization::OnBeginSliderMovement)
+ .OnEndSliderMovement(this, &FMyDateTimeDetailCustomization::OnEndSliderMovement)
+ .TypeInterface(MakeShareable(new TNumericUnitTypeInterface(EUnit::Days)))
+ .LinearDeltaSensitivity(1);
+
+ SAssignNew(HourEntryBox, SNumericEntryBox)
+ .AllowSpin(true)
+ .MinValue(0)
+ .MaxValue(23)
+ .MinSliderValue(0)
+ .MaxSliderValue(23)
+ .Font(IDetailLayoutBuilder::GetDetailFont())
+ .Value(this, &FMyDateTimeDetailCustomization::OnGetValue, 0)
+ .OnValueChanged(this, &FMyDateTimeDetailCustomization::OnValueChanged, 0)
+ .OnValueCommitted(this, &FMyDateTimeDetailCustomization::OnValueCommitted, 0)
+ .OnBeginSliderMovement(this, &FMyDateTimeDetailCustomization::OnBeginSliderMovement)
+ .OnEndSliderMovement(this, &FMyDateTimeDetailCustomization::OnEndSliderMovement)
+ .TypeInterface(MakeShareable(new TNumericUnitTypeInterface(EUnit::Hours)))
+ .LinearDeltaSensitivity(1);
+
+ SAssignNew(MinuteEntryBox, SNumericEntryBox)
+ .AllowSpin(true)
+ .MinValue(0)
+ .MaxValue(59)
+ .MinSliderValue(0)
+ .MaxSliderValue(59)
+ .Font(IDetailLayoutBuilder::GetDetailFont())
+ .Value(this, &FMyDateTimeDetailCustomization::OnGetValue, 1)
+ .OnValueChanged(this, &FMyDateTimeDetailCustomization::OnValueChanged, 1)
+ .OnValueCommitted(this, &FMyDateTimeDetailCustomization::OnValueCommitted, 1)
+ .OnBeginSliderMovement(this, &FMyDateTimeDetailCustomization::OnBeginSliderMovement)
+ .OnEndSliderMovement(this, &FMyDateTimeDetailCustomization::OnEndSliderMovement)
+ .TypeInterface(MakeShareable(new TNumericUnitTypeInterface(EUnit::Minutes)))
+ .LinearDeltaSensitivity(1);
+
+ SAssignNew(SecondEntryBox, SNumericEntryBox)
+ .AllowSpin(true)
+ .MinValue(0)
+ .MaxValue(59)
+ .MinSliderValue(0)
+ .MaxSliderValue(59)
+ .Font(IDetailLayoutBuilder::GetDetailFont())
+ .Value(this, &FMyDateTimeDetailCustomization::OnGetValue, 2)
+ .OnValueChanged(this, &FMyDateTimeDetailCustomization::OnValueChanged, 2)
+ .OnValueCommitted(this, &FMyDateTimeDetailCustomization::OnValueCommitted, 2)
+ .OnBeginSliderMovement(this, &FMyDateTimeDetailCustomization::OnBeginSliderMovement)
+ .OnEndSliderMovement(this, &FMyDateTimeDetailCustomization::OnEndSliderMovement)
+ .TypeInterface(MakeShareable(new TNumericUnitTypeInterface(EUnit::Seconds)))
+ .LinearDeltaSensitivity(1);
HeaderRow
.NameContent()
@@ -45,273 +136,54 @@ void FMyDateTimeDetailCustomization::CustomizeHeader(TSharedRef
StructPropertyHandle->CreatePropertyNameWidget()
]
.ValueContent()
- .MaxDesiredWidth(0.f)
.MinDesiredWidth(125.0f * 3.0f)
- //.HAlign(HAlign_Fill)
+ .MaxDesiredWidth(125.0f * 3.0f)
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
- .HAlign(HAlign_Fill)
.AutoHeight()
- .Padding(0.0f, 1.0f)
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
- .Padding(0.0f, 2.0f)
+ .Padding(0.0f, 0.0f, 2.0f, 0.0f)
[
- SNew(SNumericEntryBox)
- .AllowSpin(true)
- .MinValue(1)
- .MaxValue(9999)
- .MinSliderValue(1)
- .MaxSliderValue(9999)
- .Font(IDetailLayoutBuilder::GetDetailFont())
- .Value(this, &FMyDateTimeDetailCustomization::OnGetValue, 3)
- .OnValueChanged(this, &FMyDateTimeDetailCustomization::OnValueChanged, 3)
- .OnValueCommitted(this, &FMyDateTimeDetailCustomization::OnValueCommitted, 3)
- .OnBeginSliderMovement(this, &FMyDateTimeDetailCustomization::OnBeginSliderMovement)
- .OnEndSliderMovement(this, &FMyDateTimeDetailCustomization::OnEndSliderMovement)
- .ToolTipText(this, &FMyDateTimeDetailCustomization::GetValueAsText, 3)
- //.ToolTipText(MakeAttributeLambda([Value, TooltipText]
- //{
- // if (Value.Get().IsSet())
- // {
- // return FText::Format(TooltipText, Value.Get().GetValue());
- // }
- // return NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values");
- //}))
- //.UndeterminedString(NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values"))
- //.ContextMenuExtender(OnContextMenuExtenderComponent)
- //.TypeInterface(InArgs._TypeInterface)
- //.MinValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinVector))
- //.MaxValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxVector))
- //.MinSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinSliderVector))
- //.MaxSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxSliderVector))
- .LinearDeltaSensitivity(1)
- /*.Delta(InArgs._SpinDelta)*/
- /*.OnBeginSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnBeginSliderMovement, OnComponentBeginSliderMovement))*/
- /*.OnEndSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnEndSliderMovement, OnComponentEndSliderMovement))*/
- /*.DisplayToggle(InArgs._DisplayToggle)
- .TogglePadding(InArgs._TogglePadding)
- .ToggleChecked(ToggleChecked)
- .OnToggleChanged(OnToggleChanged)*/
+ YearEntryBox.ToSharedRef()
]
+ SHorizontalBox::Slot()
- .Padding(3.75f, 2.0f)
+ .Padding(2.0f, 0.0f)
[
- SNew(SNumericEntryBox)
- .AllowSpin(true)
- .MinValue(1)
- .MaxValue(12)
- .MinSliderValue(1)
- .MaxSliderValue(12)
- .Font(IDetailLayoutBuilder::GetDetailFont())
- .Value(this, &FMyDateTimeDetailCustomization::OnGetValue, 4)
- .OnValueChanged(this, &FMyDateTimeDetailCustomization::OnValueChanged, 4)
- .OnValueCommitted(this, &FMyDateTimeDetailCustomization::OnValueCommitted, 4)
- .OnBeginSliderMovement(this, &FMyDateTimeDetailCustomization::OnBeginSliderMovement)
- .OnEndSliderMovement(this, &FMyDateTimeDetailCustomization::OnEndSliderMovement)
- .ToolTipText(this, &FMyDateTimeDetailCustomization::GetValueAsText, 4)
- //.OnValueChanged(CreatePerComponentChanged(ComponentIndex, OnComponentChanged, InArgs._ConstrainVector))
- //.OnValueCommitted(CreatePerComponentCommitted(ComponentIndex, OnComponentCommitted, InArgs._ConstrainVector))
- //.ToolTipText(MakeAttributeLambda([Value, TooltipText]
- //{
- // if (Value.Get().IsSet())
- // {
- // return FText::Format(TooltipText, Value.Get().GetValue());
- // }
- // return NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values");
- //}))
- //.UndeterminedString(NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values"))
- //.ContextMenuExtender(OnContextMenuExtenderComponent)
- //.TypeInterface(InArgs._TypeInterface)
- //.MinValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinVector))
- //.MaxValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxVector))
- //.MinSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinSliderVector))
- //.MaxSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxSliderVector))
- .LinearDeltaSensitivity(1)
- /*.Delta(InArgs._SpinDelta)*/
- /*.OnBeginSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnBeginSliderMovement, OnComponentBeginSliderMovement))*/
- /*.OnEndSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnEndSliderMovement, OnComponentEndSliderMovement))*/
- /*.DisplayToggle(InArgs._DisplayToggle)
- .TogglePadding(InArgs._TogglePadding)
- .ToggleChecked(ToggleChecked)
- .OnToggleChanged(OnToggleChanged)*/
+ MonthEntryBox.ToSharedRef()
]
+ SHorizontalBox::Slot()
- .Padding(0.0f, 2.0f)
+ .Padding(2.0f, 0.0f, 0.0f, 0.0f)
[
- SNew(SNumericEntryBox)
- .AllowSpin(true)
- .MinValue(1)
- .MaxValue(31)
- .MinSliderValue(1)
- .MaxSliderValue(31)
- .Font(IDetailLayoutBuilder::GetDetailFont())
- .Value(this, &FMyDateTimeDetailCustomization::OnGetValue, 5)
- .OnValueChanged(this, &FMyDateTimeDetailCustomization::OnValueChanged, 5)
- .OnValueCommitted(this, &FMyDateTimeDetailCustomization::OnValueCommitted, 5)
- .OnBeginSliderMovement(this, &FMyDateTimeDetailCustomization::OnBeginSliderMovement)
- .OnEndSliderMovement(this, &FMyDateTimeDetailCustomization::OnEndSliderMovement)
- .ToolTipText(this, &FMyDateTimeDetailCustomization::GetValueAsText, 5)
- //.OnValueChanged(CreatePerComponentChanged(ComponentIndex, OnComponentChanged, InArgs._ConstrainVector))
- //.OnValueCommitted(CreatePerComponentCommitted(ComponentIndex, OnComponentCommitted, InArgs._ConstrainVector))
- //.ToolTipText(MakeAttributeLambda([Value, TooltipText]
- //{
- // if (Value.Get().IsSet())
- // {
- // return FText::Format(TooltipText, Value.Get().GetValue());
- // }
- // return NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values");
- //}))
- //.UndeterminedString(NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values"))
- //.ContextMenuExtender(OnContextMenuExtenderComponent)
- //.TypeInterface(InArgs._TypeInterface)
- //.MinValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinVector))
- //.MaxValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxVector))
- //.MinSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinSliderVector))
- //.MaxSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxSliderVector))
- .LinearDeltaSensitivity(1)
- /*.Delta(InArgs._SpinDelta)*/
- /*.OnBeginSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnBeginSliderMovement, OnComponentBeginSliderMovement))*/
- /*.OnEndSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnEndSliderMovement, OnComponentEndSliderMovement))*/
- /*.DisplayToggle(InArgs._DisplayToggle)
- .TogglePadding(InArgs._TogglePadding)
- .ToggleChecked(ToggleChecked)
- .OnToggleChanged(OnToggleChanged)*/
+ DayEntryBox.ToSharedRef()
]
]
+ SVerticalBox::Slot()
- .HAlign(HAlign_Fill)
.AutoHeight()
- .Padding(0.0f, 1.0f)
+ [
+ SNew(SSpacer)
+ .Size(FVector2D(8.0f))
+ ]
+ + SVerticalBox::Slot()
+ .AutoHeight()
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
- .Padding(0.0f, 2.0f)
+ .Padding(0.0f, 0.0f, 2.0f, 0.0f)
[
- SNew(SNumericEntryBox)
- .AllowSpin(true)
- .MinValue(0)
- .MaxValue(23)
- .MinSliderValue(0)
- .MaxSliderValue(23)
- .Font(IDetailLayoutBuilder::GetDetailFont())
- .Value(this, &FMyDateTimeDetailCustomization::OnGetValue, 0)
- .OnValueChanged(this, &FMyDateTimeDetailCustomization::OnValueChanged, 0)
- .OnValueCommitted(this, &FMyDateTimeDetailCustomization::OnValueCommitted, 0)
- .OnBeginSliderMovement(this, &FMyDateTimeDetailCustomization::OnBeginSliderMovement)
- .OnEndSliderMovement(this, &FMyDateTimeDetailCustomization::OnEndSliderMovement)
- .ToolTipText(this, &FMyDateTimeDetailCustomization::GetValueAsText, 0)
- //.OnValueChanged(CreatePerComponentChanged(ComponentIndex, OnComponentChanged, InArgs._ConstrainVector))
- //.OnValueCommitted(CreatePerComponentCommitted(ComponentIndex, OnComponentCommitted, InArgs._ConstrainVector))
- //.ToolTipText(MakeAttributeLambda([Value, TooltipText]
- //{
- // if (Value.Get().IsSet())
- // {
- // return FText::Format(TooltipText, Value.Get().GetValue());
- // }
- // return NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values");
- //}))
- //.UndeterminedString(NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values"))
- //.ContextMenuExtender(OnContextMenuExtenderComponent)
- //.TypeInterface(InArgs._TypeInterface)
- //.MinValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinVector))
- //.MaxValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxVector))
- //.MinSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinSliderVector))
- //.MaxSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxSliderVector))
- .LinearDeltaSensitivity(1)
- /*.Delta(InArgs._SpinDelta)*/
- /*.OnBeginSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnBeginSliderMovement, OnComponentBeginSliderMovement))*/
- /*.OnEndSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnEndSliderMovement, OnComponentEndSliderMovement))*/
- /*.DisplayToggle(InArgs._DisplayToggle)
- .TogglePadding(InArgs._TogglePadding)
- .ToggleChecked(ToggleChecked)
- .OnToggleChanged(OnToggleChanged)*/
+ HourEntryBox.ToSharedRef()
]
+ SHorizontalBox::Slot()
- .Padding(3.75f, 2.0f)
+ .Padding(2.0f, 0.0f)
[
- SNew(SNumericEntryBox)
- .AllowSpin(true)
- .MinValue(0)
- .MaxValue(59)
- .MinSliderValue(0)
- .MaxSliderValue(59)
- .Font(IDetailLayoutBuilder::GetDetailFont())
- .Value(this, &FMyDateTimeDetailCustomization::OnGetValue, 1)
- .OnValueChanged(this, &FMyDateTimeDetailCustomization::OnValueChanged, 1)
- .OnValueCommitted(this, &FMyDateTimeDetailCustomization::OnValueCommitted, 1)
- .OnBeginSliderMovement(this, &FMyDateTimeDetailCustomization::OnBeginSliderMovement)
- .OnEndSliderMovement(this, &FMyDateTimeDetailCustomization::OnEndSliderMovement)
- .ToolTipText(this, &FMyDateTimeDetailCustomization::GetValueAsText, 1)
- //.OnValueChanged(CreatePerComponentChanged(ComponentIndex, OnComponentChanged, InArgs._ConstrainVector))
- //.OnValueCommitted(CreatePerComponentCommitted(ComponentIndex, OnComponentCommitted, InArgs._ConstrainVector))
- //.ToolTipText(MakeAttributeLambda([Value, TooltipText]
- //{
- // if (Value.Get().IsSet())
- // {
- // return FText::Format(TooltipText, Value.Get().GetValue());
- // }
- // return NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values");
- //}))
- //.UndeterminedString(NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values"))
- //.ContextMenuExtender(OnContextMenuExtenderComponent)
- //.TypeInterface(InArgs._TypeInterface)
- //.MinValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinVector))
- //.MaxValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxVector))
- //.MinSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinSliderVector))
- //.MaxSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxSliderVector))
- .LinearDeltaSensitivity(1)
- /*.Delta(InArgs._SpinDelta)*/
- /*.OnBeginSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnBeginSliderMovement, OnComponentBeginSliderMovement))*/
- /*.OnEndSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnEndSliderMovement, OnComponentEndSliderMovement))*/
- /*.DisplayToggle(InArgs._DisplayToggle)
- .TogglePadding(InArgs._TogglePadding)
- .ToggleChecked(ToggleChecked)
- .OnToggleChanged(OnToggleChanged)*/
+ MinuteEntryBox.ToSharedRef()
]
+ SHorizontalBox::Slot()
- .Padding(0.0f, 2.0f)
+ .Padding(2.0f, 0.0f, 0.0f, 0.0f)
[
- SNew(SNumericEntryBox)
- .AllowSpin(true)
- .MinValue(0)
- .MaxValue(59)
- .MinSliderValue(0)
- .MaxSliderValue(59)
- .Font(IDetailLayoutBuilder::GetDetailFont())
- .Value(this, &FMyDateTimeDetailCustomization::OnGetValue, 2)
- .OnValueChanged(this, &FMyDateTimeDetailCustomization::OnValueChanged, 2)
- .OnValueCommitted(this, &FMyDateTimeDetailCustomization::OnValueCommitted, 2)
- .OnBeginSliderMovement(this, &FMyDateTimeDetailCustomization::OnBeginSliderMovement)
- .OnEndSliderMovement(this, &FMyDateTimeDetailCustomization::OnEndSliderMovement)
- .ToolTipText(this, &FMyDateTimeDetailCustomization::GetValueAsText, 2)
- //.OnValueChanged(CreatePerComponentChanged(ComponentIndex, OnComponentChanged, InArgs._ConstrainVector))
- //.OnValueCommitted(CreatePerComponentCommitted(ComponentIndex, OnComponentCommitted, InArgs._ConstrainVector))
- //.ToolTipText(MakeAttributeLambda([Value, TooltipText]
- //{
- // if (Value.Get().IsSet())
- // {
- // return FText::Format(TooltipText, Value.Get().GetValue());
- // }
- // return NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values");
- //}))
- //.UndeterminedString(NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values"))
- //.ContextMenuExtender(OnContextMenuExtenderComponent)
- //.TypeInterface(InArgs._TypeInterface)
- //.MinValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinVector))
- //.MaxValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxVector))
- //.MinSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinSliderVector))
- //.MaxSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxSliderVector))
- .LinearDeltaSensitivity(1)
- /*.Delta(InArgs._SpinDelta)*/
- /*.OnBeginSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnBeginSliderMovement, OnComponentBeginSliderMovement))*/
- /*.OnEndSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnEndSliderMovement, OnComponentEndSliderMovement))*/
- /*.DisplayToggle(InArgs._DisplayToggle)
- .TogglePadding(InArgs._TogglePadding)
- .ToggleChecked(ToggleChecked)
- .OnToggleChanged(OnToggleChanged)*/
+ SecondEntryBox.ToSharedRef()
]
]
];
@@ -359,55 +231,6 @@ TOptional FMyDateTimeDetailCustomization::OnGetValue(int32 Index) const
}
}
-FText FMyDateTimeDetailCustomization::GetValueAsText(int32 Index) const
-{
- const TOptional& Value = OnGetValue(Index);
-
- FFormatNamedArguments Args;
-
- switch (Index)
- {
- case 0:
- Args.Add(TEXT("Key"), INVTEXT("Hour"));
- Args.Add(TEXT("Desc"), INVTEXT("A hour between 0-23"));
- break;
-
- case 1:
- Args.Add(TEXT("Key"), INVTEXT("Minute"));
- Args.Add(TEXT("Desc"), INVTEXT("A minute between 0-59"));
- break;
-
- case 2:
- Args.Add(TEXT("Key"), INVTEXT("Second"));
- Args.Add(TEXT("Desc"), INVTEXT("A second between 0-59"));
- break;
-
- case 3:
- Args.Add(TEXT("Key"), INVTEXT("Year"));
- Args.Add(TEXT("Desc"), INVTEXT("A year between 1-9999"));
- break;
-
- case 4:
- Args.Add(TEXT("Key"), INVTEXT("Month"));
- Args.Add(TEXT("Desc"), INVTEXT("A month between 1-12"));
- break;
-
- case 5:
- Args.Add(TEXT("Key"), INVTEXT("Day"));
- Args.Add(TEXT("Desc"), INVTEXT("A day between 1-31"));
- break;
- }
-
-
- if (Value.IsSet() == true)
- {
- Args.Add(TEXT("Value"), Value.GetValue());
- return FText::Format(LOCTEXT("DateTime", "{Key}: {Value} - {Desc}"), Args);
- }
-
- return FText::Format(LOCTEXT("DateTime", "{Key} - {Desc}"), Args);
-}
-
void FMyDateTimeDetailCustomization::OnBeginSliderMovement()
{
bIsUsingSlider = true;
diff --git a/Source/CommonTime/Private/DetailCustomizations/MyTimespanDetailCustomization.cpp b/Source/CommonTime/Private/DetailCustomizations/MyTimespanDetailCustomization.cpp
index 253b0ab..85d7e9f 100644
--- a/Source/CommonTime/Private/DetailCustomizations/MyTimespanDetailCustomization.cpp
+++ b/Source/CommonTime/Private/DetailCustomizations/MyTimespanDetailCustomization.cpp
@@ -19,6 +19,10 @@
#include "DetailLayoutBuilder.h"
#include "Widgets/Input/SNumericEntryBox.h"
+#include "Widgets/Input/SVectorInputBox.h"
+#include "Widgets/Input/NumericTypeInterface.h"
+#include "Widgets/Input/NumericUnitTypeInterface.inl"
+#include "Math/UnitConversion.h"
#define LOCTEXT_NAMESPACE "MyTimespanDetailCustomization"
@@ -40,155 +44,75 @@ void FMyTimespanDetailCustomization::CustomizeHeader(
{
PropertyHandle = StructPropertyHandle;
+ SAssignNew(HourEntryBox, SNumericEntryBox)
+ .AllowSpin(true)
+ .MinValue(0)
+ .MaxValue(23)
+ .MinSliderValue(0)
+ .MaxSliderValue(23)
+ .Font(IDetailLayoutBuilder::GetDetailFont())
+ .Value(this, &FMyTimespanDetailCustomization::OnGetValue, 0)
+ .OnValueChanged(this, &FMyTimespanDetailCustomization::OnValueChanged, 0)
+ .OnValueCommitted(this, &FMyTimespanDetailCustomization::OnValueCommitted, 0)
+ .OnBeginSliderMovement(this, &FMyTimespanDetailCustomization::OnBeginSliderMovement)
+ .OnEndSliderMovement(this, &FMyTimespanDetailCustomization::OnEndSliderMovement)
+ .TypeInterface(MakeShareable(new TNumericUnitTypeInterface(EUnit::Hours)))
+ .LinearDeltaSensitivity(1);
+
+ SAssignNew(MinuteEntryBox, SNumericEntryBox)
+ .AllowSpin(true)
+ .MinValue(0)
+ .MaxValue(59)
+ .MinSliderValue(0)
+ .MaxSliderValue(59)
+ .Font(IDetailLayoutBuilder::GetDetailFont())
+ .Value(this, &FMyTimespanDetailCustomization::OnGetValue, 1)
+ .OnValueChanged(this, &FMyTimespanDetailCustomization::OnValueChanged, 1)
+ .OnValueCommitted(this, &FMyTimespanDetailCustomization::OnValueCommitted, 1)
+ .OnBeginSliderMovement(this, &FMyTimespanDetailCustomization::OnBeginSliderMovement)
+ .OnEndSliderMovement(this, &FMyTimespanDetailCustomization::OnEndSliderMovement)
+ .TypeInterface(MakeShareable(new TNumericUnitTypeInterface(EUnit::Minutes)))
+ .LinearDeltaSensitivity(1);
+
+ SAssignNew(SecondEntryBox, SNumericEntryBox)
+ .AllowSpin(true)
+ .MinValue(0)
+ .MaxValue(59)
+ .MinSliderValue(0)
+ .MaxSliderValue(59)
+ .Font(IDetailLayoutBuilder::GetDetailFont())
+ .Value(this, &FMyTimespanDetailCustomization::OnGetValue, 2)
+ .OnValueChanged(this, &FMyTimespanDetailCustomization::OnValueChanged, 2)
+ .OnValueCommitted(this, &FMyTimespanDetailCustomization::OnValueCommitted, 2)
+ .OnBeginSliderMovement(this, &FMyTimespanDetailCustomization::OnBeginSliderMovement)
+ .OnEndSliderMovement(this, &FMyTimespanDetailCustomization::OnEndSliderMovement)
+ .TypeInterface(MakeShareable(new TNumericUnitTypeInterface(EUnit::Seconds)))
+ .LinearDeltaSensitivity(1);
+
HeaderRow
.NameContent()
[
StructPropertyHandle->CreatePropertyNameWidget()
]
.ValueContent()
- .MaxDesiredWidth(0.f)
.MinDesiredWidth(125.0f * 3.0f)
- //.HAlign(HAlign_Fill)
+ .MaxDesiredWidth(125.0f * 3.0f)
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
- .Padding(0.0f, 2.0f)
+ .Padding(0.0f)
[
- SNew(SNumericEntryBox)
- .AllowSpin(true)
- .MinValue(0)
- .MaxValue(23)
- .MinSliderValue(0)
- .MaxSliderValue(23)
- .Font(IDetailLayoutBuilder::GetDetailFont())
- .Value(this, &FMyTimespanDetailCustomization::OnGetValue, 0)
- .OnValueChanged(this, &FMyTimespanDetailCustomization::OnValueChanged, 0)
- .OnValueCommitted(this, &FMyTimespanDetailCustomization::OnValueCommitted, 0)
- .OnBeginSliderMovement(this, &FMyTimespanDetailCustomization::OnBeginSliderMovement)
- .OnEndSliderMovement(this, &FMyTimespanDetailCustomization::OnEndSliderMovement)
- //.OnValueChanged(CreatePerComponentChanged(ComponentIndex, OnComponentChanged, InArgs._ConstrainVector))
- //.OnValueCommitted(CreatePerComponentCommitted(ComponentIndex, OnComponentCommitted, InArgs._ConstrainVector))
- //.ToolTipText(MakeAttributeLambda([Value, TooltipText]
- //{
- // if (Value.Get().IsSet())
- // {
- // return FText::Format(TooltipText, Value.Get().GetValue());
- // }
- // return NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values");
- //}))
- //.UndeterminedString(NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values"))
- //.ContextMenuExtender(OnContextMenuExtenderComponent)
- //.TypeInterface(InArgs._TypeInterface)
- //.MinValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinVector))
- //.MaxValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxVector))
- //.MinSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinSliderVector))
- //.MaxSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxSliderVector))
- .LinearDeltaSensitivity(1)
- /*.Delta(InArgs._SpinDelta)*/
- /*.OnBeginSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnBeginSliderMovement, OnComponentBeginSliderMovement))*/
- /*.OnEndSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnEndSliderMovement, OnComponentEndSliderMovement))*/
- /*.DisplayToggle(InArgs._DisplayToggle)
- .TogglePadding(InArgs._TogglePadding)
- .ToggleChecked(ToggleChecked)
- .OnToggleChanged(OnToggleChanged)*/
-
- //SNew(SNumericEntryBox)
- // .AllowSpin(true)
- // .Font(IDetailLayoutBuilder::GetDetailFont())
- // .Value(this, &FMyTimespanDetailCustomization::OnGetValue, 0)
- // .MinValue(0)
- // .MaxValue(23)
- // .MinSliderValue(0)
- // .MaxSliderValue(23)
- // .LabelPadding(FMargin(3.f))
- // .LabelLocation(SNumericEntryBox::ELabelLocation::Inside)
- // .UndeterminedString(NSLOCTEXT("PropertyEditor", "MultipleValues", "Multiple Values"))
- // .OnValueCommitted(const_cast(this),&FMyTimespanDetailCustomization::OnValueCommitted, 0)
- // .OnValueChanged(const_cast(this),&FMyTimespanDetailCustomization::OnValueChanged, 0)
- // .OnBeginSliderMovement(const_cast(this), &FMyTimespanDetailCustomization::OnBeginSliderMovement)
- // .OnEndSliderMovement(const_cast(this), &FMyTimespanDetailCustomization::OnEndSliderMovement)
+ HourEntryBox.ToSharedRef()
]
+ SHorizontalBox::Slot()
- .Padding(3.75f, 2.0f)
+ .Padding(2.5f, 0.0f)
[
- SNew(SNumericEntryBox)
- .AllowSpin(true)
- .MinValue(0)
- .MaxValue(59)
- .MinSliderValue(0)
- .MaxSliderValue(59)
- .Font(IDetailLayoutBuilder::GetDetailFont())
- .Value(this, &FMyTimespanDetailCustomization::OnGetValue, 1)
- .OnValueChanged(this, &FMyTimespanDetailCustomization::OnValueChanged, 1)
- .OnValueCommitted(this, &FMyTimespanDetailCustomization::OnValueCommitted, 1)
- .OnBeginSliderMovement(this, &FMyTimespanDetailCustomization::OnBeginSliderMovement)
- .OnEndSliderMovement(this, &FMyTimespanDetailCustomization::OnEndSliderMovement)
- //.OnValueChanged(CreatePerComponentChanged(ComponentIndex, OnComponentChanged, InArgs._ConstrainVector))
- //.OnValueCommitted(CreatePerComponentCommitted(ComponentIndex, OnComponentCommitted, InArgs._ConstrainVector))
- //.ToolTipText(MakeAttributeLambda([Value, TooltipText]
- //{
- // if (Value.Get().IsSet())
- // {
- // return FText::Format(TooltipText, Value.Get().GetValue());
- // }
- // return NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values");
- //}))
- //.UndeterminedString(NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values"))
- //.ContextMenuExtender(OnContextMenuExtenderComponent)
- //.TypeInterface(InArgs._TypeInterface)
- //.MinValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinVector))
- //.MaxValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxVector))
- //.MinSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinSliderVector))
- //.MaxSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxSliderVector))
- .LinearDeltaSensitivity(1)
- /*.Delta(InArgs._SpinDelta)*/
- /*.OnBeginSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnBeginSliderMovement, OnComponentBeginSliderMovement))*/
- /*.OnEndSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnEndSliderMovement, OnComponentEndSliderMovement))*/
- /*.DisplayToggle(InArgs._DisplayToggle)
- .TogglePadding(InArgs._TogglePadding)
- .ToggleChecked(ToggleChecked)
- .OnToggleChanged(OnToggleChanged)*/
+ MinuteEntryBox.ToSharedRef()
]
+ SHorizontalBox::Slot()
- .Padding(0.0f, 2.0f)
+ .Padding(0.0f)
[
- SNew(SNumericEntryBox)
- .AllowSpin(true)
- .MinValue(0)
- .MaxValue(59)
- .MinSliderValue(0)
- .MaxSliderValue(59)
- .Font(IDetailLayoutBuilder::GetDetailFont())
- .Value(this, &FMyTimespanDetailCustomization::OnGetValue, 2)
- .OnValueChanged(this, &FMyTimespanDetailCustomization::OnValueChanged, 2)
- .OnValueCommitted(this, &FMyTimespanDetailCustomization::OnValueCommitted, 2)
- .OnBeginSliderMovement(this, &FMyTimespanDetailCustomization::OnBeginSliderMovement)
- .OnEndSliderMovement(this, &FMyTimespanDetailCustomization::OnEndSliderMovement)
- //.OnValueChanged(CreatePerComponentChanged(ComponentIndex, OnComponentChanged, InArgs._ConstrainVector))
- //.OnValueCommitted(CreatePerComponentCommitted(ComponentIndex, OnComponentCommitted, InArgs._ConstrainVector))
- //.ToolTipText(MakeAttributeLambda([Value, TooltipText]
- //{
- // if (Value.Get().IsSet())
- // {
- // return FText::Format(TooltipText, Value.Get().GetValue());
- // }
- // return NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values");
- //}))
- //.UndeterminedString(NSLOCTEXT("SVectorInputBox", "MultipleValues", "Multiple Values"))
- //.ContextMenuExtender(OnContextMenuExtenderComponent)
- //.TypeInterface(InArgs._TypeInterface)
- //.MinValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinVector))
- //.MaxValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxVector))
- //.MinSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MinSliderVector))
- //.MaxSliderValue(CreatePerComponentGetter(ComponentIndex, TOptional(), InArgs._MaxSliderVector))
- .LinearDeltaSensitivity(1)
- /*.Delta(InArgs._SpinDelta)*/
- /*.OnBeginSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnBeginSliderMovement, OnComponentBeginSliderMovement))*/
- /*.OnEndSliderMovement(CreatePerComponentSliderMovementEvent(InArgs._OnEndSliderMovement, OnComponentEndSliderMovement))*/
- /*.DisplayToggle(InArgs._DisplayToggle)
- .TogglePadding(InArgs._TogglePadding)
- .ToggleChecked(ToggleChecked)
- .OnToggleChanged(OnToggleChanged)*/
+ SecondEntryBox.ToSharedRef()
]
];
}
diff --git a/Source/CommonTime/Public/DetailCustomizations/MyDateTimeDetailCustomization.h b/Source/CommonTime/Public/DetailCustomizations/MyDateTimeDetailCustomization.h
index 0a59a44..a467aa2 100644
--- a/Source/CommonTime/Public/DetailCustomizations/MyDateTimeDetailCustomization.h
+++ b/Source/CommonTime/Public/DetailCustomizations/MyDateTimeDetailCustomization.h
@@ -12,7 +12,7 @@ class IPropertyHandle;
class SEditableTextBox;
/**
- * Implements a details view customization for the FTimespan structure.
+ * Implements a details view customization for the FDateTime structure.
*/
class FMyDateTimeDetailCustomization
: public IPropertyTypeCustomization
@@ -37,8 +37,6 @@ public:
private:
TOptional OnGetValue(int32 Index) const;
- /** @return the value being observed by the Numeric Entry Box as a FText */
- FText GetValueAsText(int32 Index) const;
void OnValueCommitted(int32 NewValue, ETextCommit::Type CommitType, int32 Index);
void OnValueChanged(int32 NewValue, int32 Index);
void OnBeginSliderMovement();
@@ -50,4 +48,11 @@ private:
/** True if a value is being changed by dragging a slider */
bool bIsUsingSlider;
+
+ TSharedPtr YearEntryBox;
+ TSharedPtr MonthEntryBox;
+ TSharedPtr DayEntryBox;
+ TSharedPtr HourEntryBox;
+ TSharedPtr MinuteEntryBox;
+ TSharedPtr SecondEntryBox;
};
diff --git a/Source/CommonTime/Public/DetailCustomizations/MyTimespanDetailCustomization.h b/Source/CommonTime/Public/DetailCustomizations/MyTimespanDetailCustomization.h
index f3fd509..0e0c76e 100644
--- a/Source/CommonTime/Public/DetailCustomizations/MyTimespanDetailCustomization.h
+++ b/Source/CommonTime/Public/DetailCustomizations/MyTimespanDetailCustomization.h
@@ -47,4 +47,8 @@ private:
/** True if a value is being changed by dragging a slider */
bool bIsUsingSlider;
+
+ TSharedPtr HourEntryBox;
+ TSharedPtr MinuteEntryBox;
+ TSharedPtr SecondEntryBox;
};