I created UMG Splines to draw editable curves inside UMG, Unreal’s UI authoring system, using Slate’s existing drawing functions. The project offered cubic Bézier and Hermite-style curves in 2D interface space.
This is an older project, and I’d revisit its design and code standards now. Past me also deserves a bonk for all those autos.
I kept point positions, colour and thickness together in a common data structure, with separate Slate and UMG bases for specialised behaviour. A cubic Bézier uses two endpoints and two control points; the Hermite option uses endpoints and tangent vectors, which describe how the curve leaves and approaches its ends.
Drawing APIs, shared data and Slate initialisation
The engine drawing functions are FSlateDrawElement::MakeCubicBezierSpline for the cubic Bézier and FSlateDrawElement::MakeSpline for the Hermite form.
The project’s abstract SSpline base derives from the engine’s SLeafWidget. The custom USpline supplies the UMG-facing wrapper through UWidget. These custom spline classes are separate from Unreal’s world-spline components.
I grouped points, colour and thickness in the project’s FSplineData structure. Concrete derived Slate widgets receive that data through their Construct function as a required argument, with named Slate arguments available for additional settings.
This split is the interface I chose. Slate’s argument-building machinery prepares those settings; Construct initialises the widget separately from its C++ constructor. Named arguments are not universally restricted to optional data.
One bend point, two handles
I wanted a simpler way to shape a curve than adjusting both cubic handles independently. The specialised widget takes one bend point, applies an offset, then places each handle halfway between that adjusted point and one endpoint.
The midpoint rule is a shaping heuristic: a practical control for the appearance of the curve, with no guarantee of uniform curvature or spacing along it.
Let the container choose the bend
I expanded this with custom containers that divide the space around a centre into eight directional sectors. The container uses those sectors to drive bend settings for its splines.
The shown helper assumes a fixed centre of (250, 250). It is a layout-specific example; other container sizes, sector boundaries and degenerate cases need validation before reuse.
Sector angles and the direction-array index
The project’s custom USplineMathLibrary uses 45-degree sectors ordered east, southeast, south, southwest, west, northwest, north and northeast.
The helper returns a float even though the caller uses it as an array index. Its sector-selection rules were tied to this example; handling of the centre point and boundary angles remains unvalidated.
Working around designer handles
In the stock UE4 setup described here, I ran into restrictions when adding custom designer handles. My workaround passes handle widgets and their canvas through a custom node called from PreConstruct. I put the handle behaviour behind an interface so different spline types could reuse it.
The setter runs before the Branch. Is Design Time controls only that later branch, so this graph does not establish editor-only execution, runtime handle removal or exclusion from packaged builds.
Handle positions come from cached geometry: each widget’s top-left is converted into the canvas’s local coordinates. Cached layout geometry can be out of date, and the original loop does not check point-array bounds. Valid widget pointers alone do not settle either issue.
The handle-to-canvas coordinate conversion
The custom ISHandle interface reads geometry from Slate widgets through SWidget::GetCachedGeometry(). It uses FGeometry::GetAbsolutePositionAtCoordinates with (0, 0) for the handle’s top-left, then FGeometry::AbsoluteToLocal to express that position relative to the canvas.
This historical extract omits the surrounding loop and pointer checks. It assumes usable cached geometry and an existing destination entry:
Data.Points[index] = AllocatedCanvasGeo.AbsoluteToLocal(
AnchorGeo.GetAbsolutePositionAtCoordinates({ 0.f, 0.f }));
The conversion does not itself validate layout timing, display scaling or widget lifetime. The original loop also assumes the points array has an entry for every handle.
My designer-extension contribution is retained as a historical reference. Its outcome and relevance to current Unreal versions remain unverified; current documentation for FDesignerExtension does not establish the old build’s behaviour.


