Skip to content

Commit 74313a9

Browse files
committed
Improved modifier layout
1 parent 92fbf52 commit 74313a9

File tree

2 files changed

+46
-35
lines changed

2 files changed

+46
-35
lines changed

AttributesExtension.uplugin

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"FileVersion": 3,
3-
"Version": 3,
4-
"VersionName": "1.3",
3+
"Version": 4,
4+
"VersionName": "1.3a",
55
"FriendlyName": "Attributes Extension",
66
"Description": "A lightweight attributes system for Unreal Engine 4",
77
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/content/1f0ba37099a14e228a1ce5e4891ed70a",

Source/Editor/Private/Customizations/AttrModifierCustomization.cpp

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,66 +32,77 @@ void FAttrModifierCustomization::CustomizeHeader(TSharedRef<IPropertyHandle> Str
3232

3333
void FAttrModifierCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
3434
{
35-
StructBuilder.AddCustomRow(LOCTEXT("Search", "Values")).WholeRowContent()
36-
[
37-
SNew(SHorizontalBox)
38-
+ SHorizontalBox::Slot()
39-
.Padding(4, 0)
35+
const bool bHideIncrement = StructHandle->HasMetaData("HideIncrement");
36+
const bool bHideLastMultiplier = StructHandle->HasMetaData("HideLastMultiplier");
37+
const bool bHideBaseMultiplier = StructHandle->HasMetaData("HideBaseMultiplier");
38+
39+
TSharedRef<SHorizontalBox> ModListWidget = SNew(SHorizontalBox);
40+
41+
if (!bHideIncrement)
42+
{
43+
ModListWidget->AddSlot()
44+
.HAlign(HAlign_Fill)
45+
.MaxWidth(100.f)
46+
.Padding(2, 0)
4047
[
4148
SNew(SVerticalBox)
4249
+ SVerticalBox::Slot()
4350
[
4451
IncrementHandle->CreatePropertyNameWidget()
4552
]
4653
+ SVerticalBox::Slot()
47-
.HAlign(HAlign_Left)
54+
.HAlign(HAlign_Fill)
4855
[
49-
SNew(SBox)
50-
.MinDesiredWidth(120.f)
51-
.MaxDesiredWidth(200.f)
52-
[
53-
IncrementHandle->CreatePropertyValueWidget()
54-
]
56+
IncrementHandle->CreatePropertyValueWidget()
5557
]
56-
]
57-
+ SHorizontalBox::Slot()
58-
.Padding(4, 0)
58+
];
59+
}
60+
61+
if (!bHideLastMultiplier)
62+
{
63+
ModListWidget->AddSlot()
64+
.HAlign(HAlign_Fill)
65+
.MaxWidth(100.f)
66+
.Padding(2, 0)
5967
[
6068
SNew(SVerticalBox)
6169
+ SVerticalBox::Slot()
6270
[
6371
LastMultiplierHandle->CreatePropertyNameWidget()
6472
]
6573
+ SVerticalBox::Slot()
66-
.HAlign(HAlign_Left)
74+
.HAlign(HAlign_Fill)
6775
[
68-
SNew(SBox)
69-
.MinDesiredWidth(120.f)
70-
.MaxDesiredWidth(200.f)
71-
[
72-
LastMultiplierHandle->CreatePropertyValueWidget()
73-
]
76+
LastMultiplierHandle->CreatePropertyValueWidget()
7477
]
75-
]
76-
+ SHorizontalBox::Slot()
77-
.Padding(4, 0)
78+
];
79+
}
80+
81+
if (!bHideBaseMultiplier)
82+
{
83+
ModListWidget->AddSlot()
84+
.HAlign(HAlign_Fill)
85+
.MaxWidth(100.f)
86+
.Padding(2, 0)
7887
[
7988
SNew(SVerticalBox)
8089
+ SVerticalBox::Slot()
8190
[
8291
BaseMultiplierHandle->CreatePropertyNameWidget()
8392
]
8493
+ SVerticalBox::Slot()
85-
.HAlign(HAlign_Left)
94+
.HAlign(HAlign_Fill)
8695
[
87-
SNew(SBox)
88-
.MinDesiredWidth(120.f)
89-
.MaxDesiredWidth(200.f)
90-
[
91-
BaseMultiplierHandle->CreatePropertyValueWidget()
92-
]
96+
BaseMultiplierHandle->CreatePropertyValueWidget()
9397
]
94-
]
98+
];
99+
}
100+
101+
StructBuilder.AddCustomRow(LOCTEXT("Search", "Values"))
102+
.ValueContent()
103+
.MinDesiredWidth(500.f)
104+
[
105+
ModListWidget
95106
];
96107
}
97108

0 commit comments

Comments
 (0)