unreal.WidgetLibrary
¶
- class unreal.WidgetLibrary(outer=None, name='None')¶
Bases:
unreal.BlueprintFunctionLibrary
Widget Blueprint Library
C++ Source:
Module: UMG
File: WidgetBlueprintLibrary.h
- classmethod capture_joystick(reply, capturing_widget, all_joysticks=False) -> (EventReply, reply=EventReply)¶
Capture Joystick deprecated: Use SetUserFocus() instead
- Parameters
reply (EventReply) –
capturing_widget (Widget) –
all_joysticks (bool) –
- Returns
reply (EventReply):
- Return type
- classmethod capture_mouse(reply, capturing_widget) -> (EventReply, reply=EventReply)¶
Capture Mouse
- Parameters
reply (EventReply) –
capturing_widget (Widget) –
- Returns
reply (EventReply):
- Return type
- classmethod clear_user_focus(reply, all_users=False) -> (EventReply, reply=EventReply)¶
Clear User Focus
- Parameters
reply (EventReply) –
all_users (bool) –
- Returns
reply (EventReply):
- Return type
- classmethod detect_drag(reply, widget_detecting_drag, drag_key) -> (EventReply, reply=EventReply)¶
Ask Slate to detect if a user starts dragging in this widget later. Slate internally tracks the movement and if it surpasses the drag threshold, Slate will send an OnDragDetected event to the widget.
- Parameters
reply (EventReply) –
widget_detecting_drag (Widget) – Detect dragging in this widget
drag_key (Key) – This button should be pressed to detect the drag
- Returns
reply (EventReply):
- Return type
- classmethod detect_drag_if_pressed(pointer_event, widget_detecting_drag, drag_key) → EventReply¶
Given the pointer event, emit the DetectDrag reply if the provided key was pressed. If the DragKey is a touch key, that will also automatically work.
- Parameters
pointer_event (PointerEvent) – The pointer device event coming in.
widget_detecting_drag (Widget) – Detect dragging in this widget.
drag_key (Key) – This button should be pressed to detect the drag, won’t emit the DetectDrag FEventReply unless this is pressed.
- Returns
- Return type
Closes any popup menu
- classmethod draw_box(context, position, size, brush, tint=[0.0, 0.0, 0.0, 0.0]) → PaintContext¶
Draws a box
- Parameters
context (PaintContext) –
position (Vector2D) –
size (Vector2D) –
brush (SlateBrushAsset) –
tint (LinearColor) –
- Returns
context (PaintContext):
- Return type
- classmethod draw_line(context, position_a, position_b, tint=[0.0, 0.0, 0.0, 0.0], anti_alias=True, thickness=1.0) → PaintContext¶
Draws a line.
- Parameters
context (PaintContext) –
position_a (Vector2D) – Starting position of the line in local space.
position_b (Vector2D) – Ending position of the line in local space.
tint (LinearColor) – Color to render the line.
anti_alias (bool) – Whether the line should be antialiased.
thickness (float) – How many pixels thick this line should be.
- Returns
context (PaintContext):
- Return type
- classmethod draw_lines(context, points, tint=[0.0, 0.0, 0.0, 0.0], anti_alias=True, thickness=1.0) → PaintContext¶
Draws several line segments.
- Parameters
context (PaintContext) –
points (Array(Vector2D)) – Line pairs, each line needs to be 2 separate points in the array.
tint (LinearColor) – Color to render the line.
anti_alias (bool) – Whether the line should be antialiased.
thickness (float) – How many pixels thick this line should be.
- Returns
context (PaintContext):
- Return type
- classmethod draw_text(context, string, position, tint=[0.0, 0.0, 0.0, 0.0]) → PaintContext¶
Draws text. deprecated: Use Draw Text instead
- Parameters
context (PaintContext) –
string (str) – The string to draw.
position (Vector2D) – The starting position where the text is drawn in local space.
tint (LinearColor) – Color to render the line.
- Returns
context (PaintContext):
- Return type
- classmethod draw_text_formatted(context, text, position, font, font_size=16, font_type_face='Regular', tint=[0.0, 0.0, 0.0, 0.0]) → PaintContext¶
Draws text.
- Parameters
context (PaintContext) –
text (Text) – The string to draw.
position (Vector2D) – The starting position where the text is drawn in local space.
font (Font) –
font_size (int32) –
font_type_face (Name) –
tint (LinearColor) – Color to render the line.
- Returns
context (PaintContext):
- Return type
- classmethod end_drag_drop(reply) -> (EventReply, reply=EventReply)¶
An event should return FReply::Handled().EndDragDrop() to request that the current drag/drop operation be terminated.
- Parameters
reply (EventReply) –
- Returns
reply (EventReply):
- Return type
- classmethod get_all_widgets_of_class(world_context_object, widget_class, top_level_only=True)¶
Find all widgets of a certain class.
- Parameters
- Returns
found_widgets (Array(UserWidget)): The widgets that were found matching the filter.
- Return type
- classmethod get_all_widgets_with_interface(world_context_object, interface, top_level_only)¶
Find all widgets in the world with the specified interface. This is a slow operation, use with caution e.g. do not use every frame.
- Parameters
- Returns
found_widgets (Array(UserWidget)): Output array of widgets that implement the specified interface.
- Return type
- classmethod get_brush_resource(brush) → Object¶
Gets the resource object on a brush. This could be a UTexture2D or a UMaterialInterface.
- Parameters
brush (SlateBrush) –
- Returns
- Return type
- classmethod get_brush_resource_as_material(brush) → MaterialInterface¶
Gets the brush resource as a material.
- Parameters
brush (SlateBrush) –
- Returns
- Return type
- classmethod get_brush_resource_as_texture2d(brush) → Texture2D¶
Gets the brush resource as a texture 2D.
- Parameters
brush (SlateBrush) –
- Returns
- Return type
- classmethod get_drag_dropping_content() → DragDropOperation¶
Returns the drag and drop operation that is currently occurring if any, otherwise nothing.
- Returns
- Return type
- classmethod get_dynamic_material(brush) -> (MaterialInstanceDynamic, brush=SlateBrush)¶
Gets the material that allows changes to parameters at runtime. The brush must already have a material assigned to it, if it does it will automatically be converted to a MID.
- Parameters
brush (SlateBrush) –
- Returns
A material that supports dynamic input from the game.
brush (SlateBrush):
- Return type
- classmethod get_input_event_from_character_event(event) → InputEvent¶
Get Input Event from Character Event
- Parameters
event (CharacterEvent) –
- Returns
- Return type
- classmethod get_input_event_from_key_event(event) → InputEvent¶
Get Input Event from Key Event
- Parameters
event (KeyEvent) –
- Returns
- Return type
Get Input Event from Navigation Event
- Parameters
event (NavigationEvent) –
- Returns
- Return type
- classmethod get_input_event_from_pointer_event(event) → InputEvent¶
Get Input Event from Pointer Event
- Parameters
event (PointerEvent) –
- Returns
- Return type
- classmethod get_key_event_from_analog_input_event(event) → KeyEvent¶
Get Key Event from Analog Input Event
- Parameters
event (AnalogInputEvent) –
- Returns
- Return type
- classmethod get_safe_zone_padding(world_context_object) -> (safe_padding=Vector4, safe_padding_scale=Vector2D, spill_over_padding=Vector4)¶
Gets the amount of padding that needs to be added when accounting for the safe zone on TVs.
- Parameters
world_context_object (Object) –
- Returns
safe_padding (Vector4):
safe_padding_scale (Vector2D):
spill_over_padding (Vector4):
- Return type
tuple
- classmethod handled() → EventReply¶
The event reply to use when you choose to handle an event. This will prevent the event from continuing to bubble up / down the widget hierarchy.
- Returns
- Return type
- classmethod is_drag_dropping() → bool¶
Returns true if a drag/drop event is occurring that a widget can handle.
- Returns
- Return type
- classmethod lock_mouse(reply, capturing_widget) -> (EventReply, reply=EventReply)¶
Lock Mouse
- Parameters
reply (EventReply) –
capturing_widget (Widget) –
- Returns
reply (EventReply):
- Return type
- classmethod make_brush_from_asset(brush_asset) → SlateBrush¶
Creates a Slate Brush from a Slate Brush Asset
- Parameters
brush_asset (SlateBrushAsset) –
- Returns
A new slate brush using the asset’s brush.
- Return type
- classmethod make_brush_from_material(material, width=32, height=32) → SlateBrush¶
Creates a Slate Brush from a Material. Materials don’t have an implicit size, so providing a widget and height is required to hint slate with how large the image wants to be by default.
- Parameters
material (MaterialInterface) –
width (int32) –
height (int32) –
- Returns
A new slate brush using the material.
- Return type
- classmethod make_brush_from_texture(texture, width=0, height=0) → SlateBrush¶
Creates a Slate Brush from a Texture2D
- Parameters
texture (Texture2D) –
width (int32) – When less than or equal to zero, the Width of the brush will default to the Width of the Texture
height (int32) – When less than or equal to zero, the Height of the brush will default to the Height of the Texture
- Returns
A new slate brush using the texture.
- Return type
- classmethod no_resource_brush() → SlateBrush¶
Creates a Slate Brush that wont draw anything, the “Null Brush”.
- Returns
A new slate brush that wont draw anything.
- Return type
- classmethod release_joystick_capture(reply, all_joysticks=False) -> (EventReply, reply=EventReply)¶
Release Joystick Capture deprecated: Use ClearUserFocus() instead
- Parameters
reply (EventReply) –
all_joysticks (bool) –
- Returns
reply (EventReply):
- Return type
- classmethod release_mouse_capture(reply) -> (EventReply, reply=EventReply)¶
Release Mouse Capture
- Parameters
reply (EventReply) –
- Returns
reply (EventReply):
- Return type
- classmethod restore_previous_window_title_bar_state() → None¶
Restore Previous Window Title Bar State
- classmethod set_brush_resource_to_material(brush, material) → SlateBrush¶
Sets the resource on a brush to be a Material.
- Parameters
brush (SlateBrush) –
material (MaterialInterface) –
- Returns
brush (SlateBrush):
- Return type
- classmethod set_brush_resource_to_texture(brush, texture) → SlateBrush¶
Sets the resource on a brush to be a UTexture2D.
- Parameters
brush (SlateBrush) –
texture (Texture2D) –
- Returns
brush (SlateBrush):
- Return type
- classmethod set_color_vision_deficiency_type(type, severity, correct_deficiency, show_correction_with_deficiency) → None¶
Apply color deficiency correction settings to the game window
- Parameters
type (ColorVisionDeficiency) – The type of color deficiency correction to apply.
severity (float) – Intensity of the color deficiency correction effect, from 0 to 1.
correct_deficiency (bool) – Shifts the color spectrum to the visible range based on the current deficiency type.
show_correction_with_deficiency (bool) – If you’re correcting the color deficiency, you can use this to visualize what the correction looks like with the deficiency.
- classmethod set_hardware_cursor(world_context_object, cursor_shape, cursor_name, hot_spot) → bool¶
Loads or sets a hardware cursor from the content directory in the game.
- Parameters
world_context_object (Object) –
cursor_shape (MouseCursor) –
cursor_name (Name) –
hot_spot (Vector2D) –
- Returns
- Return type
- classmethod set_input_mode_game_and_ui(target, widget_to_focus=None, lock_mouse_to_viewport=False, hide_cursor_during_capture=True) → None¶
Set Input Mode Game and UI deprecated: Use the new version of Set Input Mode Game And UI instead
- Parameters
target (PlayerController) –
widget_to_focus (Widget) –
lock_mouse_to_viewport (bool) –
hide_cursor_during_capture (bool) –
- classmethod set_input_mode_game_and_ui_ex(player_controller, widget_to_focus=None, mouse_lock_mode=MouseLockMode.DO_NOT_LOCK, hide_cursor_during_capture=True) → None¶
Setup an input mode that allows only the UI to respond to user input, and if the UI doesn’t handle it player input / player controller gets a chance.
- Parameters
player_controller (PlayerController) –
widget_to_focus (Widget) –
mouse_lock_mode (MouseLockMode) –
hide_cursor_during_capture (bool) –
- classmethod set_input_mode_game_only(player_controller) → None¶
Setup an input mode that allows only player input / player controller to respond to user input.
- Parameters
player_controller (PlayerController) –
- classmethod set_input_mode_ui_only(target, widget_to_focus=None, lock_mouse_to_viewport=False) → None¶
Set Input Mode UIOnly deprecated: Use the new version of Set Input Mode UI Only instead
- Parameters
target (PlayerController) –
widget_to_focus (Widget) –
lock_mouse_to_viewport (bool) –
- classmethod set_input_mode_ui_only_ex(player_controller, widget_to_focus=None, mouse_lock_mode=MouseLockMode.DO_NOT_LOCK) → None¶
Setup an input mode that allows only the UI to respond to user input.
- Parameters
player_controller (PlayerController) –
widget_to_focus (Widget) –
mouse_lock_mode (MouseLockMode) –
- classmethod set_mouse_position(reply, new_mouse_position) -> (EventReply, reply=EventReply)¶
Set Mouse Position
- Parameters
reply (EventReply) –
new_mouse_position (Vector2D) –
- Returns
reply (EventReply):
- Return type
- classmethod set_user_focus(reply, focus_widget, all_users=False) -> (EventReply, reply=EventReply)¶
Set User Focus
- Parameters
reply (EventReply) –
focus_widget (Widget) –
all_users (bool) –
- Returns
reply (EventReply):
- Return type
- classmethod set_window_title_bar_close_button_active(active) → None¶
Set Window Title Bar Close Button Active
- Parameters
active (bool) –
- classmethod set_window_title_bar_on_close_clicked_delegate(delegate) → None¶
Set Window Title Bar on Close Clicked Delegate
- Parameters
delegate (OnGameWindowCloseButtonClickedDelegate) –
- classmethod set_window_title_bar_state(title_bar_content, mode, title_bar_drag_enabled, window_buttons_visible, title_bar_visible) → None¶
Set Window Title Bar State
- Parameters
title_bar_content (Widget) –
mode (WindowTitleBarMode) –
title_bar_drag_enabled (bool) –
window_buttons_visible (bool) –
title_bar_visible (bool) –
- classmethod unhandled() → EventReply¶
The event reply to use when you choose not to handle an event.
- Returns
- Return type
- classmethod unlock_mouse(reply) -> (EventReply, reply=EventReply)¶
Unlock Mouse
- Parameters
reply (EventReply) –
- Returns
reply (EventReply):
- Return type