USlateBlueprintLibrary::Scalar_AbsoluteToLocal
#include "Blueprint/SlateBlueprintLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Converts a scalar value from absolute space to local space by dividing by the geometry's accumulated layout scale. Use this to convert absolute-space distances or sizes into local-space equivalents.
Caveats & Gotchas
- • Introduced in UE 5.6 as a correctly-named replacement for the deprecated TransformScalarLocalToAbsolute, which had its direction inverted (despite the name, it performed absolute-to-local). Always use this function in new 5.6+ code.
- • Only accounts for the uniform scale component of the layout transform, not any non-uniform scaling in a render transform. For widgets with non-uniform render transforms, scalar conversion alone is insufficient.
- • The Blueprint display name is 'Absolute to Local (Scalar)'. The companion function Scalar_LocalToAbsolute performs the inverse operation.
Signature
static UMG_API float Scalar_AbsoluteToLocal(const FGeometry& Geometry, float AbsoluteScalar) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Geometry | const FGeometry& | The geometry of the widget whose scale is used for conversion. | — |
| AbsoluteScalar | float | A scalar value in absolute space (e.g., an absolute-space size or distance). | — |
Return Type
float Example
Convert an absolute-space stroke width to local space before drawing C++
// Keep a stroke 2 pixels wide in absolute space regardless of DPI scale.
float LocalStrokeWidth = USlateBlueprintLibrary::Scalar_AbsoluteToLocal(
MyWidget->GetCachedGeometry(),
2.0f // 2 absolute pixels
); Version History
Introduced in: 5.6
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | Introduced to replace incorrectly-named TransformScalarLocalToAbsolute. |
Feedback
Was this helpful?