UDreamUIWidgetGeometryLibrary
Coordinate conversions between a widget's own space, the viewport and the screen -- this
Inherits from UBlueprintFunctionLibrary.
Declared in Public/DreamUIWidgetGeometryLibrary.h.
Coordinate conversions between a widget's own space, the viewport and the screen -- this framework's USlateBlueprintLibrary.
Everything returns bool and writes its answer through an out-parameter, where UMG's equivalents return the value directly. That is deliberate and it is about world-space UI: a panel welded to a machine in the level has no viewport position until a camera is pointed at it, and the honest answers are "here it is" and "nowhere", not a number computed in the wrong space. A caller that ignores the bool gets a zero, not a lie that looks like a position.
Functions
| Function | Kind | Description |
|---|---|---|
bool AbsoluteToLocal(FDreamUIWidgetGeometry InGeometry, FVector2D InAbsoluteCoordinate, FVector2D& OutLocalCoordinate) | pure | A viewport pixel position, in the widget's own space. Assumes the point lies in the widget's plane. |
bool AbsoluteToViewport(UObject* WorldContextObject, FVector2D InAbsoluteCoordinate, FVector2D& OutPixelPosition, FVector2D& OutViewportPosition) | pure | Viewport pixels, as both pixels and DPI-scaled viewport coordinates. UMG's AbsoluteToViewport. |
bool GetAbsoluteSize(FDreamUIWidgetGeometry InGeometry, FVector2D& OutAbsoluteSize) | pure | The widget's size in viewport pixels. False when the rect cannot be placed in the viewport. |
FVector2D GetLocalSize(FDreamUIWidgetGeometry InGeometry) | pure | The widget's size in its own units. Zero for a geometry that names no widget. |
FVector2D GetLocalTopLeft(FDreamUIWidgetGeometry InGeometry) | pure | The corner local coordinates are measured from, in the widget's own space. |
FDreamUIWidgetGeometry GetWidgetGeometry(UDreamWidget* InWidget) | pure | Read a widget's geometry -- UMG's GetCachedGeometry, GetTickSpaceGeometry and GetPaintSpaceGeometry all at once. |
bool IsUnderLocation(FDreamUIWidgetGeometry InGeometry, FVector2D InAbsoluteCoordinate) | pure | Is a viewport pixel position inside this widget's rect? UMG's IsUnderLocation. |
bool LocalToAbsolute(FDreamUIWidgetGeometry InGeometry, FVector2D InLocalCoordinate, FVector2D& OutAbsoluteCoordinate) | pure | A point in the widget's own space, in viewport pixels. |
bool LocalToViewport(UObject* WorldContextObject, FDreamUIWidgetGeometry InGeometry, FVector2D InLocalCoordinate, FVector2D& OutPixelPosition, FVector2D& OutViewportPosition) | pure | A point in the widget's own space, as both viewport pixels and DPI-scaled viewport coordinates -- UMG's LocalToViewport, which hands back both for the same reason. |
bool ScreenToViewport(UObject* WorldContextObject, FVector2D InScreenPosition, FVector2D& OutViewportPosition) | pure | A screen position as DPI-scaled viewport coordinates. UMG's ScreenToViewport. |
bool ScreenToWidgetAbsolute(FVector2D InScreenPosition, FVector2D& OutAbsoluteCoordinate) | pure | The same screen position in viewport pixels. Here the two are the same space, so this is identity. |
bool ScreenToWidgetLocal(FDreamUIWidgetGeometry InGeometry, FVector2D InScreenPosition, FVector2D& OutLocalCoordinate) | pure | A screen position -- what a mouse position or a world-to-screen projection gives you -- in the widget's own space. UMG's ScreenToWidgetLocal. |
bool TransformScalarAbsoluteToLocal(FDreamUIWidgetGeometry InGeometry, float InAbsoluteScalar, float& OutLocalScalar) | pure | Transform Scalar Absolute to Local |
bool TransformScalarLocalToAbsolute(FDreamUIWidgetGeometry InGeometry, float InLocalScalar, float& OutAbsoluteScalar) | pure | A LENGTH converted between the two spaces, with no origin involved -- UMG's Scalar_LocalToAbsolute and friends. |
bool TransformVectorAbsoluteToLocal(FDreamUIWidgetGeometry InGeometry, FVector2D InAbsoluteVector, FVector2D& OutLocalVector) | pure | Transform Vector Absolute to Local |
bool TransformVectorLocalToAbsolute(FDreamUIWidgetGeometry InGeometry, FVector2D InLocalVector, FVector2D& OutAbsoluteVector) | pure | A DIRECTION and length, per axis. UMG's Vector_LocalToAbsolute. |
Compared with UMG
Every Blueprint-facing member of the UMG class, and where it went. adopt: same name, same meaning. map: here under another name or on another type. reject: deliberately absent, with the reason.
| UMG | Member | Status | Here | Note |
|---|---|---|---|---|
USlateBlueprintLibrary | IsUnderLocation | adopt | IsUnderLocation | Against the widget's measured pixel rect. False for a geometry with no viewport position at all -- a render-target canvas, a world-space one with no camera. |
USlateBlueprintLibrary | AbsoluteToLocal | adopt | AbsoluteToLocal | Assumes the point lies in the widget's own plane, which is true of every 2D interface. Returns false for a canvas whose scaler cannot be inverted -- world space above all, where the raycaster is the right tool. |
USlateBlueprintLibrary | LocalToAbsolute | adopt | LocalToAbsolute | Local has its origin at the widget's BOTTOM-left, not Slate's top-left: every other normalized coordinate in this framework already puts zero at the bottom left. |
USlateBlueprintLibrary | GetLocalTopLeft | adopt | GetLocalTopLeft | Always zero, because local coordinates are defined from that corner -- the same answer UMG gives for an ordinary widget. Kept so a graph written against UMG reads the same. |
USlateBlueprintLibrary | GetLocalSize | adopt | GetLocalSize | |
USlateBlueprintLibrary | GetAbsoluteSize | adopt | GetAbsoluteSize | Measured from the rect's two projected corners, so a canvas scaler, a render scale and an ancestor's scale are all already in it. |
USlateBlueprintLibrary | Scalar_AbsoluteToLocal | map | TransformScalarAbsoluteToLocal | Named for what it transforms rather than with a type prefix. The wider axis decides for a non-uniformly scaled widget, as in UMG. |
USlateBlueprintLibrary | Scalar_LocalToAbsolute | map | TransformScalarLocalToAbsolute | |
USlateBlueprintLibrary | Vector_AbsoluteToLocal | map | TransformVectorAbsoluteToLocal | Per axis, so a non-uniform scale is honoured here where the scalar version has to pick one. |
USlateBlueprintLibrary | Vector_LocalToAbsolute | map | TransformVectorLocalToAbsolute | |
USlateBlueprintLibrary | EqualEqual_SlateBrush | map | UDreamUIWidgetLibrary::EqualEqual_DreamUIImageBrush | This framework's brush is FDreamUIImageBrush, so the node is named for it. Exact on the floats rather than tolerant: the question a caller asks with == is 'did anybody change this brush', and a near-comparison would answer no to a one-pixel nudge. The node lives on the widget library because the other brush verbs do. |
USlateBlueprintLibrary | LocalToViewport | adopt | LocalToViewport | Hands back both the pixel position and the DPI-scaled one, as UMG does. |
USlateBlueprintLibrary | AbsoluteToViewport | adopt | AbsoluteToViewport | |
USlateBlueprintLibrary | ScreenToWidgetLocal | adopt | ScreenToWidgetLocal | No bIncludeWindowPosition parameter: a screen position and a viewport pixel position are the same space here, because the framework draws inside the viewport and never against the desktop. |
USlateBlueprintLibrary | ScreenToWidgetAbsolute | adopt | ScreenToWidgetAbsolute | Identity, for the reason on the row above. It exists so a ported graph keeps its shape and so the equivalence is stated somewhere. |
USlateBlueprintLibrary | ScreenToViewport | adopt | ScreenToViewport |