DreamGUI
类参考

UDreamUIWidgetGeometryLibrary

Coordinate conversions between a widget's own space, the viewport and the screen -- this

本页由 DreamGUIReferenceDocs commandlet 从反射生成,正文是头文件注释的原文(英文),所以不翻译——这样它永远和代码一致。概念讲解见核心概念。

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

FunctionKindDescription
bool AbsoluteToLocal(FDreamUIWidgetGeometry InGeometry, FVector2D InAbsoluteCoordinate, FVector2D& OutLocalCoordinate)pureA 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)pureViewport pixels, as both pixels and DPI-scaled viewport coordinates. UMG's AbsoluteToViewport.
bool GetAbsoluteSize(FDreamUIWidgetGeometry InGeometry, FVector2D& OutAbsoluteSize)pureThe widget's size in viewport pixels. False when the rect cannot be placed in the viewport.
FVector2D GetLocalSize(FDreamUIWidgetGeometry InGeometry)pureThe widget's size in its own units. Zero for a geometry that names no widget.
FVector2D GetLocalTopLeft(FDreamUIWidgetGeometry InGeometry)pureThe corner local coordinates are measured from, in the widget's own space.
FDreamUIWidgetGeometry GetWidgetGeometry(UDreamWidget* InWidget)pureRead a widget's geometry -- UMG's GetCachedGeometry, GetTickSpaceGeometry and GetPaintSpaceGeometry all at once.
bool IsUnderLocation(FDreamUIWidgetGeometry InGeometry, FVector2D InAbsoluteCoordinate)pureIs a viewport pixel position inside this widget's rect? UMG's IsUnderLocation.
bool LocalToAbsolute(FDreamUIWidgetGeometry InGeometry, FVector2D InLocalCoordinate, FVector2D& OutAbsoluteCoordinate)pureA point in the widget's own space, in viewport pixels.
bool LocalToViewport(UObject* WorldContextObject, FDreamUIWidgetGeometry InGeometry, FVector2D InLocalCoordinate, FVector2D& OutPixelPosition, FVector2D& OutViewportPosition)pureA 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)pureA screen position as DPI-scaled viewport coordinates. UMG's ScreenToViewport.
bool ScreenToWidgetAbsolute(FVector2D InScreenPosition, FVector2D& OutAbsoluteCoordinate)pureThe 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)pureA 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)pureTransform Scalar Absolute to Local
bool TransformScalarLocalToAbsolute(FDreamUIWidgetGeometry InGeometry, float InLocalScalar, float& OutAbsoluteScalar)pureA LENGTH converted between the two spaces, with no origin involved -- UMG's Scalar_LocalToAbsolute and friends.
bool TransformVectorAbsoluteToLocal(FDreamUIWidgetGeometry InGeometry, FVector2D InAbsoluteVector, FVector2D& OutLocalVector)pureTransform Vector Absolute to Local
bool TransformVectorLocalToAbsolute(FDreamUIWidgetGeometry InGeometry, FVector2D InLocalVector, FVector2D& OutAbsoluteVector)pureA 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.

UMGMemberStatusHereNote
USlateBlueprintLibraryIsUnderLocationadoptIsUnderLocationAgainst 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.
USlateBlueprintLibraryAbsoluteToLocaladoptAbsoluteToLocalAssumes 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.
USlateBlueprintLibraryLocalToAbsoluteadoptLocalToAbsoluteLocal 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.
USlateBlueprintLibraryGetLocalTopLeftadoptGetLocalTopLeftAlways 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.
USlateBlueprintLibraryGetLocalSizeadoptGetLocalSize
USlateBlueprintLibraryGetAbsoluteSizeadoptGetAbsoluteSizeMeasured from the rect's two projected corners, so a canvas scaler, a render scale and an ancestor's scale are all already in it.
USlateBlueprintLibraryScalar_AbsoluteToLocalmapTransformScalarAbsoluteToLocalNamed for what it transforms rather than with a type prefix. The wider axis decides for a non-uniformly scaled widget, as in UMG.
USlateBlueprintLibraryScalar_LocalToAbsolutemapTransformScalarLocalToAbsolute
USlateBlueprintLibraryVector_AbsoluteToLocalmapTransformVectorAbsoluteToLocalPer axis, so a non-uniform scale is honoured here where the scalar version has to pick one.
USlateBlueprintLibraryVector_LocalToAbsolutemapTransformVectorLocalToAbsolute
USlateBlueprintLibraryEqualEqual_SlateBrushmapUDreamUIWidgetLibrary::EqualEqual_DreamUIImageBrushThis 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.
USlateBlueprintLibraryLocalToViewportadoptLocalToViewportHands back both the pixel position and the DPI-scaled one, as UMG does.
USlateBlueprintLibraryAbsoluteToViewportadoptAbsoluteToViewport
USlateBlueprintLibraryScreenToWidgetLocaladoptScreenToWidgetLocalNo 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.
USlateBlueprintLibraryScreenToWidgetAbsoluteadoptScreenToWidgetAbsoluteIdentity, for the reason on the row above. It exists so a ported graph keeps its shape and so the equivalence is stated somewhere.
USlateBlueprintLibraryScreenToViewportadoptScreenToViewport

本页目录