Unreal Engine plugin for newt UI layouts.
Newt layouts are meant to mimic Unreal's Slate macro-based DSL very well, so should feel quite familiar:
VerticalBox
+ HorizontalAlignment=HAlign_Center (TextBlock Text="Hello World!")
+(Button OnClicked=>MyButtonClicked)
Layouts must have a root widget. Panel widgets can have slots via +. Both widgets and slots can have property key-value pairs, which are always after their initial identifier (for slots that identifier is +).
Property values can be one of either:
- Identifier (UEnum, FName)
PropName=MyIdent
- Boolean (true/false)
PropName=true,PropName=false
- Integer (signed 64-bit, coerces to smaller sizes and floats automatically, and any enum-supporting numeric property)
PropName=2,PropName=-764
- Float (64-bit, coerces to 32-bit floats automatically)
PropName=4.6,PropName=-.54
- String (FString, FText, FName)
PropName="Hello world"
- Array (TArray, TSet)
PropName=[2, 6, 4],PropName=["first", "second", "etc"]
- Map (TMap)
PropName=[Key: Value, Key2: Value2]
- Struct (any reflected USTRUCT)
PropName=(Field1=5, Field2="world")
- Binding (Delegate, MulticastDelegate, Event Dispatchers, etc.)
PropName=>FuncName
Note for strings, there is no way to specify localisation at the moment.
All of an array's elements must be of the same type. Deserialisation will halt if that is not true.
UUserWidgets are supported with automatically found properties (but don't allow slots as they are not panels).
Delegates can be bound to function names. However, for this to work, a context object where the function is defined must be provided when deserialising. In C++, the function must be marked as a UFUNCTION().
Widget and property mappings can be specified when deserialising. They map a widget name to its UClass, and its and its slot's layout property names to their reflected internal names. This is useful for long properties like HorizontalAlignment becoming HAlign.
Widget class mapping is currently required, as the correct widget class cannot be found via a name like VerticalBox alone. As such, it's often useful to shorten those names to something like VBox anyway.
Note that enumerator names are via their C++ names, not their user-facing friendly names. This means
HAlign_Centermust be used instead of justCenter. There is no way to remap these yet.