Skip to content

Commit

Permalink
Improved modifier layout
Browse files Browse the repository at this point in the history
  • Loading branch information
muit committed Oct 21, 2019
1 parent 92fbf52 commit 74313a9
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 35 deletions.
4 changes: 2 additions & 2 deletions AttributesExtension.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 3,
"VersionName": "1.3",
"Version": 4,
"VersionName": "1.3a",
"FriendlyName": "Attributes Extension",
"Description": "A lightweight attributes system for Unreal Engine 4",
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/content/1f0ba37099a14e228a1ce5e4891ed70a",
Expand Down
77 changes: 44 additions & 33 deletions Source/Editor/Private/Customizations/AttrModifierCustomization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,66 +32,77 @@ void FAttrModifierCustomization::CustomizeHeader(TSharedRef<IPropertyHandle> Str

void FAttrModifierCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
StructBuilder.AddCustomRow(LOCTEXT("Search", "Values")).WholeRowContent()
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.Padding(4, 0)
const bool bHideIncrement = StructHandle->HasMetaData("HideIncrement");
const bool bHideLastMultiplier = StructHandle->HasMetaData("HideLastMultiplier");
const bool bHideBaseMultiplier = StructHandle->HasMetaData("HideBaseMultiplier");

TSharedRef<SHorizontalBox> ModListWidget = SNew(SHorizontalBox);

if (!bHideIncrement)
{
ModListWidget->AddSlot()
.HAlign(HAlign_Fill)
.MaxWidth(100.f)
.Padding(2, 0)
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
[
IncrementHandle->CreatePropertyNameWidget()
]
+ SVerticalBox::Slot()
.HAlign(HAlign_Left)
.HAlign(HAlign_Fill)
[
SNew(SBox)
.MinDesiredWidth(120.f)
.MaxDesiredWidth(200.f)
[
IncrementHandle->CreatePropertyValueWidget()
]
IncrementHandle->CreatePropertyValueWidget()
]
]
+ SHorizontalBox::Slot()
.Padding(4, 0)
];
}

if (!bHideLastMultiplier)
{
ModListWidget->AddSlot()
.HAlign(HAlign_Fill)
.MaxWidth(100.f)
.Padding(2, 0)
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
[
LastMultiplierHandle->CreatePropertyNameWidget()
]
+ SVerticalBox::Slot()
.HAlign(HAlign_Left)
.HAlign(HAlign_Fill)
[
SNew(SBox)
.MinDesiredWidth(120.f)
.MaxDesiredWidth(200.f)
[
LastMultiplierHandle->CreatePropertyValueWidget()
]
LastMultiplierHandle->CreatePropertyValueWidget()
]
]
+ SHorizontalBox::Slot()
.Padding(4, 0)
];
}

if (!bHideBaseMultiplier)
{
ModListWidget->AddSlot()
.HAlign(HAlign_Fill)
.MaxWidth(100.f)
.Padding(2, 0)
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
[
BaseMultiplierHandle->CreatePropertyNameWidget()
]
+ SVerticalBox::Slot()
.HAlign(HAlign_Left)
.HAlign(HAlign_Fill)
[
SNew(SBox)
.MinDesiredWidth(120.f)
.MaxDesiredWidth(200.f)
[
BaseMultiplierHandle->CreatePropertyValueWidget()
]
BaseMultiplierHandle->CreatePropertyValueWidget()
]
]
];
}

StructBuilder.AddCustomRow(LOCTEXT("Search", "Values"))
.ValueContent()
.MinDesiredWidth(500.f)
[
ModListWidget
];
}

Expand Down

0 comments on commit 74313a9

Please sign in to comment.