unreal.Widget
¶
- class unreal.Widget(outer=None, name='None')¶
Bases:
unreal.Visual
This is the base class for all wrapped Slate controls that are exposed to UObjects.
C++ Source:
Module: UMG
File: Widget.h
Editor Properties: (see get_editor_property/set_editor_property)
accessible_behavior
(SlateAccessibleBehavior): [Read-Write] Whether or not the widget is accessible, and how to describe it. If set to custom, additional customization options will appear.accessible_summary_behavior
(SlateAccessibleBehavior): [Read-Write] How to describe this widget when it’s being presented through a summary of a parent widget. If set to custom, additional customization options will appear.accessible_summary_text
(Text): [Read-Write] When AccessibleSummaryBehavior is set to Custom, this is the text that will be used to describe the widget.accessible_text
(Text): [Read-Write] When AccessibleBehavior is set to Custom, this is the text that will be used to describe the widget.can_children_be_accessible
(bool): [Read-Write] Whether or not children of this widget can appear as distinct accessible widgets.clipping
(WidgetClipping): [Read-Write] Controls how the clipping behavior of this widget. Normally content that overflows the bounds of the widget continues rendering. Enabling clipping prevents that overflowing content from being seen.NOTE: Elements in different clipping spaces can not be batched together, and so there is a performance cost to clipping. Do not enable clipping unless a panel actually needs to prevent content from showing up outside its bounds.
cursor
(MouseCursor): [Read-Write] The cursor to show when the mouse is over the widgetflow_direction_preference
(FlowDirectionPreference): [Read-Write] Allows you to set a new flow directionis_enabled
(bool): [Read-Write] Sets whether this widget can be modified interactively by the useris_volatile
(bool): [Read-Write] If true prevents the widget or its child’s geometry or layout information from being cached. If this widget changes every frame, but you want it to still be in an invalidation panel you should make it as volatile instead of invalidating it every frame, which would prevent the invalidation panel from actually ever caching anything.navigation
(WidgetNavigation): [Read-Write] The navigation object for this widget is optionally created if the user has configured custom navigation rules for this widget in the widget designer. Those rules determine how navigation transitions can occur between widgets.override_accessible_defaults
(bool): [Read-Write] Override all of the default accessibility behavior and text for this widget.override_cursor
(bool): [Read-Write] Override Cursorrender_opacity
(float): [Read-Write] The opacity of the widgetrender_transform
(WidgetTransform): [Read-Write] The render transform of the widget allows for arbitrary 2D transforms to be applied to the widget.render_transform_pivot
(Vector2D): [Read-Write] The render transform pivot controls the location about which transforms are applied. This value is a normalized coordinate about which things like rotations will occur.slot
(PanelSlot): [Read-Write] The parent slot of the UWidget. Allows us to easily inline edit the layout controlling this widget.tool_tip_text
(Text): [Read-Write] Tooltip text to show when the user hovers over the widget with the mousetool_tip_widget
(Widget): [Read-Only] Tooltip widget to show when the user hovers over the widget with the mousevisibility
(SlateVisibility): [Read-Write] The visibility of the widget
- property cursor¶
[Read-Only] The cursor to show when the mouse is over the widget
- Type
- force_layout_prepass() → None¶
Forces a pre-pass. A pre-pass caches the desired size of the widget hierarchy owned by this widget. One pre-pass already happens for every widget before Tick occurs. You only need to perform another pre-pass if you are adding child widgets this frame and want them to immediately be visible this frame.
- get_accessible_summary_text() → Text¶
Gets the accessible summary text from the underlying Slate accessible widget.
- Returns
The accessible summary text of the underlying Slate accessible widget. Returns an empty text if accessibility is dsabled or the underlying accessible widget is invalid.
- Return type
- get_accessible_text() → Text¶
Gets the accessible text from the underlying Slate accessible widget
- Returns
The accessible text of the underlying Slate accessible widget. Returns an empty text if accessibility is dsabled or the underlying accessible widget is invalid.
- Return type
- get_cached_geometry() → Geometry¶
Gets the last geometry used to Tick the widget. This data may not exist yet if this call happens prior to the widget having been ticked/painted, or it may be out of date, or a frame behind.
We recommend not to use this data unless there’s no other way to solve your problem. Normally in Slate we try and handle these issues by making a dependent widget part of the hierarchy, as to avoid frame behind or what are referred to as hysteresis problems, both caused by depending on geometry from the previous frame being used to advise how to layout a dependent object the current frame.
- Returns
- Return type
- get_clipping() → WidgetClipping¶
Gets the clipping state of this widget.
- Returns
- Return type
- get_desired_size() → Vector2D¶
Gets the widgets desired size. NOTE: The underlying Slate widget must exist and be valid, also at least one pre-pass must
have occurred before this value will be of any use.
- Returns
The widget’s desired size
- Return type
- get_game_instance() → GameInstance¶
Gets the game instance associated with this UI.
- Returns
a pointer to the owning game instance
- Return type
- get_opacity()¶
deprecated: ‘get_opacity’ was renamed to ‘get_render_opacity’.
- get_owning_local_player() → LocalPlayer¶
Gets the local player associated with this UI.
- Returns
The owning local player.
- Return type
- get_owning_player() → PlayerController¶
Gets the player controller associated with this UI.
- Returns
The player controller that owns the UI.
- Return type
- get_parent() → PanelWidget¶
Gets the parent widget
- Returns
- Return type
- get_visibility() → SlateVisibility¶
Gets the current visibility of the widget.
- Returns
- Return type
- has_any_user_focus() → bool¶
Returns true if this widget is focused by any user.
- Returns
- Return type
- has_focused_descendants() → bool¶
Returns true if any descendant widget is focused by any user.
- Returns
- Return type
- has_keyboard_focus() → bool¶
Checks to see if this widget currently has the keyboard focus
- Returns
True if this widget has keyboard focus
- Return type
- has_mouse_capture() → bool¶
Checks to see if this widget is the current mouse captor
- Returns
True if this widget has captured the mouse
- Return type
- has_mouse_capture_by_user(user_index, pointer_index=- 1) → bool¶
Checks to see if this widget is the current mouse captor
- Parameters
user_index (int32) –
pointer_index (int32) –
- Returns
True if this widget has captured the mouse with given user and pointer
- Return type
- has_user_focus(player_controller) → bool¶
Returns true if this widget is focused by a specific user.
- Parameters
player_controller (PlayerController) –
- Returns
- Return type
- has_user_focused_descendants(player_controller) → bool¶
Returns true if any descendant widget is focused by a specific user.
- Parameters
player_controller (PlayerController) –
- Returns
- Return type
- invalidate_layout_and_volatility() → None¶
Invalidates the widget from the view of a layout caching widget that may own this widget. will force the owning widget to redraw and cache children on the next paint pass.
- property is_enabled¶
[Read-Only] Sets whether this widget can be modified interactively by the user
- Type
(bool)
- is_hovered() → bool¶
Returns true if the widget is currently being hovered by a pointer device
- Returns
- Return type
- is_visible() → bool¶
Returns true if the widget is Visible, HitTestInvisible or SelfHitTestInvisible.
- Returns
- Return type
- property is_volatile¶
[Read-Only] If true prevents the widget or its child’s geometry or layout information from being cached. If this widget changes every frame, but you want it to still be in an invalidation panel you should make it as volatile instead of invalidating it every frame, which would prevent the invalidation panel from actually ever caching anything.
- Type
(bool)
[Read-Only] The navigation object for this widget is optionally created if the user has configured custom navigation rules for this widget in the widget designer. Those rules determine how navigation transitions can occur between widgets.
- Type
- remove_from_parent() → None¶
Removes the widget from its parent widget. If this widget was added to the player’s screen or the viewport it will also be removed from those containers.
- property render_transform¶
[Read-Only] The render transform of the widget allows for arbitrary 2D transforms to be applied to the widget.
- Type
- property render_transform_pivot¶
[Read-Only] The render transform pivot controls the location about which transforms are applied. This value is a normalized coordinate about which things like rotations will occur.
- Type
(Vector2D)
Sets the widget navigation rules for all directions. This can only be called on widgets that are in a widget tree.
- Parameters
rule (UINavigationRule) – The rule to use when navigation is taking place
widget_to_focus (Name) – When using the Explicit rule, focus on this widget
- set_clipping(clipping) → None¶
Sets the clipping state of this widget.
- Parameters
clipping (WidgetClipping) –
- set_cursor(cursor) → None¶
Sets the cursor to show over the widget.
- Parameters
cursor (MouseCursor) –
- set_is_enabled(is_enabled) → None¶
Sets the current enabled status of the widget
- Parameters
is_enabled (bool) –
Set Navigation Rule
- Parameters
direction (UINavigation) –
rule (UINavigationRule) –
widget_to_focus (Name) –
Sets the widget navigation rules for a specific direction. This can only be called on widgets that are in a widget tree. This works only for non Explicit, non Custom and non CustomBoundary Rules.
- Parameters
direction (UINavigation) –
rule (UINavigationRule) – The rule to use when navigation is taking place
Sets the widget navigation rules for a specific direction. This can only be called on widgets that are in a widget tree. This works only for Custom Rule.
- Parameters
direction (UINavigation) –
custom_delegate (CustomWidgetNavigationDelegate) – Custom Delegate that will be called
Sets the widget navigation rules for a specific direction. This can only be called on widgets that are in a widget tree. This works only for CustomBoundary Rule.
- Parameters
direction (UINavigation) –
custom_delegate (CustomWidgetNavigationDelegate) – Custom Delegate that will be called
Sets the widget navigation rules for a specific direction. This can only be called on widgets that are in a widget tree. This works only for Explicit Rule.
- Parameters
direction (UINavigation) –
widget (Widget) – Focus on this widget instance
- set_opacity(opacity)¶
deprecated: ‘set_opacity’ was renamed to ‘set_render_opacity’.
- set_render_angle(angle)¶
deprecated: ‘set_render_angle’ was renamed to ‘set_render_transform_angle’.
- set_render_transform(transform) → None¶
Set Render Transform
- Parameters
transform (WidgetTransform) –
- set_render_translation(translation) → None¶
Set Render Translation
- Parameters
translation (Vector2D) –
- set_tool_tip(widget) → None¶
Sets a custom widget as the tooltip of the widget.
- Parameters
widget (Widget) –
- set_tool_tip_text(tool_tip_text) → None¶
Sets the tooltip text for the widget.
- Parameters
tool_tip_text (Text) –
- set_user_focus(player_controller) → None¶
Sets the focus to this widget for a specific user (if setting focus for the owning user, prefer SetFocus())
- Parameters
player_controller (PlayerController) –
- set_visibility(visibility) → None¶
Sets the visibility of the widget.
- Parameters
visibility (SlateVisibility) –
- property slot¶
[Read-Only] The parent slot of the UWidget. Allows us to easily inline edit the layout controlling this widget.
- Type