unreal.WidgetLayoutLibrary

class unreal.WidgetLayoutLibrary(outer: Object | None = None, name: Name | str = 'None')

Bases: BlueprintFunctionLibrary

Widget Layout Library

C++ Source:

  • Module: UMG

  • File: WidgetLayoutLibrary.h

classmethod get_mouse_position_on_platform() Vector2D

Gets the platform’s mouse cursor position. This is the ‘absolute’ desktop location of the mouse.

Return type:

Vector2D

classmethod get_mouse_position_on_viewport(world_context_object) Vector2D

Gets the platform’s mouse cursor position in the local space of the viewport widget.

Parameters:

world_context_object (Object) –

Return type:

Vector2D

classmethod get_mouse_position_scaled_by_dpi(player) (location_x=float, location_y=float) or None

Gets the mouse position of the player controller, scaled by the DPI. If you’re trying to go from raw mouse screenspace coordinates to fullscreen widget space, you’ll need to transform the mouse into DPI Scaled space. This function performs that scaling.

MousePositionScaledByDPI = MousePosition * (1 / ViewportScale).

//UE_DEPRECATED(4.17, “Use GetMousePositionOnViewport() instead. Optionally and for more options, you can use GetViewportWidgetGeometry and GetPlayerScreenWidgetGeometry are newly introduced to give you the geometry of the viewport and the player screen for widgets to help convert between spaces.”)

Parameters:

player (PlayerController) –

Returns:

location_x (float):

location_y (float):

Return type:

tuple or None

classmethod get_player_screen_widget_geometry(player_controller) Geometry

Gets the geometry of the widget holding all widgets added to the “Player Screen”. You can use this geometry to convert between absolute and local space of widgets held on this widget.

Parameters:

player_controller (PlayerController) –

Return type:

Geometry

classmethod get_viewport_scale(world_context_object) float

Gets the current DPI Scale being applied to the viewport and all the Widgets.

Parameters:

world_context_object (Object) –

Return type:

float

classmethod get_viewport_size(world_context_object) Vector2D

Gets the size of the game viewport.

Parameters:

world_context_object (Object) –

Return type:

Vector2D

classmethod get_viewport_widget_geometry(world_context_object) Geometry

Gets the geometry of the widget holding all widgets added to the “Viewport”. You can use this geometry to convert between absolute and local space of widgets held on this widget.

Parameters:

world_context_object (Object) –

Return type:

Geometry

classmethod project_world_location_to_widget_position(player_controller, world_location, player_viewport_relative) Vector2D or None

Gets the projected world to screen position for a player, then converts it into a widget position, which takes into account any quality scaling.

Parameters:
  • player_controller (PlayerController) – The player controller to project the position in the world to their screen.

  • world_location (Vector) – The world location to project from.

  • player_viewport_relative (bool) – Should this be relative to the player viewport subregion (useful when using player attached widgets in split screen or when aspect-ratio constrained)

Returns:

true if the position projects onto the screen.

screen_position (Vector2D): The position in the viewport with quality scale removed and DPI scale remove.

Return type:

Vector2D or None

classmethod remove_all_widgets(world_context_object) None

Removes all widgets from the viewport.

Parameters:

world_context_object (Object) –

classmethod slot_as_border_slot(widget) BorderSlot

Gets the slot object on the child widget as a Border Slot, allowing you to manipulate layout information.

Parameters:

widget (Widget) – The child widget of a border panel.

Return type:

BorderSlot

classmethod slot_as_canvas_slot(widget) CanvasPanelSlot

Gets the slot object on the child widget as a Canvas Slot, allowing you to manipulate layout information.

Parameters:

widget (Widget) – The child widget of a canvas panel.

Return type:

CanvasPanelSlot

classmethod slot_as_grid_slot(widget) GridSlot

Gets the slot object on the child widget as a Grid Slot, allowing you to manipulate layout information.

Parameters:

widget (Widget) – The child widget of a grid panel.

Return type:

GridSlot

classmethod slot_as_horizontal_box_slot(widget) HorizontalBoxSlot

Gets the slot object on the child widget as a Horizontal Box Slot, allowing you to manipulate its information.

Parameters:

widget (Widget) – The child widget of a Horizontal Box.

Return type:

HorizontalBoxSlot

classmethod slot_as_overlay_slot(widget) OverlaySlot

Gets the slot object on the child widget as a Overlay Slot, allowing you to manipulate layout information.

Parameters:

widget (Widget) – The child widget of a overlay panel.

Return type:

OverlaySlot

classmethod slot_as_safe_box_slot(widget) SafeZoneSlot

Gets the slot object on the child widget as a Safe Box Slot, allowing you to manipulate its information.

Parameters:

widget (Widget) – The child widget of a Safe Box.

Return type:

SafeZoneSlot

classmethod slot_as_scale_box_slot(widget) ScaleBoxSlot

Gets the slot object on the child widget as a Scale Box Slot, allowing you to manipulate its information.

Parameters:

widget (Widget) – The child widget of a Scale Box.

Return type:

ScaleBoxSlot

classmethod slot_as_scroll_box_slot(widget) ScrollBoxSlot

Gets the slot object on the child widget as a Scroll Box Slot, allowing you to manipulate its information.

Parameters:

widget (Widget) – The child widget of a Scroll Box.

Return type:

ScrollBoxSlot

classmethod slot_as_size_box_slot(widget) SizeBoxSlot

Gets the slot object on the child widget as a Size Box Slot, allowing you to manipulate its information.

Parameters:

widget (Widget) – The child widget of a Size Box.

Return type:

SizeBoxSlot

classmethod slot_as_uniform_grid_slot(widget) UniformGridSlot

Gets the slot object on the child widget as a Uniform Grid Slot, allowing you to manipulate layout information.

Parameters:

widget (Widget) – The child widget of a uniform grid panel.

Return type:

UniformGridSlot

classmethod slot_as_vertical_box_slot(widget) VerticalBoxSlot

Gets the slot object on the child widget as a Vertical Box Slot, allowing you to manipulate its information.

Parameters:

widget (Widget) – The child widget of a Vertical Box.

Return type:

VerticalBoxSlot

classmethod slot_as_widget_switcher_slot(widget) WidgetSwitcherSlot

Gets the slot object on the child widget as a Widget Switcher Slot, allowing you to manipulate its information.

Parameters:

widget (Widget) – The child widget of a Widget Switcher Slot.

Return type:

WidgetSwitcherSlot

classmethod slot_as_wrap_box_slot(widget) WrapBoxSlot

Gets the slot object on the child widget as a Wrap Box Slot, allowing you to manipulate its information.

Parameters:

widget (Widget) – The child widget of a Wrap Box.

Return type:

WrapBoxSlot