You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
UE-191200 - "Add UE support for [at]editable fields of optional types"
Add's support for `[at]editable` on optionals:
`FOptionalProperty` changes:
- Added custom `__INIT__` logic for `FOptionalProperty::ExportText` which previously could output no text as the optional value was initialized but returned an empty string as its export text (ie: empty arrays, maps, sets, etc). This caused the future text imports to be incorrect.
`FPropertyNode` changes:
- Added `OptionalValueNode` as private member similar in idea to existing `PropertyKeyNode`. It stores the generated `FPropertyNode` for a FOptionalValue's Value when it is set.
- Added helper function `GetOrCreateOptionalValueNode` which either returns the existing `OptionalValueNode` OR creates one if appropriate.
- Note: This is where we bind a lambda to our Optional's Value FPropertyNode's `RebuildChildren` event which is how we update/rebuild when needed. In places where we would update/rebuild we instead call our Value to do so instead if set and then update after that has been done via this callback.
Added new widget `SPropertyEditorOptional`
- This either:
- shows a dropdown of "Set all" or "Unset all" if we have multiple values selected
- generates the editor for whatever our set value is if we have a single value (See `GetSingleReadAddress`)
- shows a 'set value' button if we are not set
#JIRA UE-191200
#rb karen.jirak
#rb kurtis.schmidt
[CL 28253719 by jared cotton in ue5-main branch]
This commit is contained in:
@@ -175,6 +175,37 @@ namespace PropertyCustomizationHelpers
|
||||
.IsFocusable( false );
|
||||
}
|
||||
|
||||
TSharedRef<SWidget> MakeSetOptionalButton(FSimpleDelegate OnSetOptionalClicked, TAttribute<FText> OptionalToolTipText, TAttribute<bool> IsEnabled)
|
||||
{
|
||||
// Custom widget for this button as it has no image and should fill a larger space
|
||||
return SNew(SBox)
|
||||
.HAlign(HAlign_Left)
|
||||
.VAlign(VAlign_Center)
|
||||
.ToolTipText(OptionalToolTipText.Get().IsEmpty() ? LOCTEXT("SetButtonToolTipText", "Set Optional to default value.") : OptionalToolTipText)
|
||||
[
|
||||
SNew(SButton)
|
||||
.ButtonStyle(FAppStyle::Get(), "Button")
|
||||
.OnClicked_Lambda([OnSetOptionalClicked](){
|
||||
OnSetOptionalClicked.ExecuteIfBound();
|
||||
return FReply::Handled();
|
||||
})
|
||||
.Text(LOCTEXT("SetButtonText", "Set to Value"))
|
||||
.ContentPadding(0)
|
||||
.IsFocusable(false)
|
||||
];
|
||||
}
|
||||
|
||||
TSharedRef<SWidget> MakeClearOptionalButton(FSimpleDelegate OnClearOptionalClicked, TAttribute<FText> OptionalToolTipText, TAttribute<bool> IsEnabled)
|
||||
{
|
||||
return
|
||||
SNew(SPropertyEditorButton)
|
||||
.Text(OptionalToolTipText.Get().IsEmpty() ? LOCTEXT("ClearButtonToolTipText", "Clear Optional") : OptionalToolTipText)
|
||||
.Image(FAppStyle::Get().GetBrush("Icons.X"))
|
||||
.OnClickAction(OnClearOptionalClicked)
|
||||
.IsEnabled(IsEnabled)
|
||||
.IsFocusable(false);
|
||||
}
|
||||
|
||||
FText GetVisibilityDisplay(TAttribute<bool> bEnabled)
|
||||
{
|
||||
return bEnabled.Get() ? FEditorFontGlyphs::Eye : FEditorFontGlyphs::Eye_Slash;
|
||||
|
||||
Reference in New Issue
Block a user