unreal.Widget
¶
- class unreal.Widget(outer: Optional[Object] = None, name: Union[Name, str] = 'None')¶
Bases:
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] Accessible Behavior: 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] Accessible Summary Behavior: 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] Accessible Summary Text: When AccessibleSummaryBehavior is set to Custom, this is the text that will be used to describe the widget.accessible_text
(Text): [Read-Write] Accessible Text: 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] Can Children be Accessible: Whether or not children of this widget can appear as distinct accessible widgets.clipping
(WidgetClipping): [Read-Write] Clippingcursor
(MouseCursor): [Read-Write] Cursorflow_direction_preference
(FlowDirectionPreference): [Read-Write] Flow Direction Preferenceis_enabled
(bool): [Read-Write] Is Enabledis_volatile
(bool): [Read-Write] Is Volatile: 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] Navigation: 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 Accessible Defaults: Override all of the default accessibility behavior and text for this widget.override_cursor
(bool): [Read-Write] Override Cursorrender_opacity
(float): [Read-Write] Render Opacityrender_transform
(WidgetTransform): [Read-Write] Render Transformrender_transform_pivot
(Vector2D): [Read-Write] Render Transform Pivotslot
(PanelSlot): [Read-Write] Slot: The parent slot of the UWidget. Allows us to easily inline edit the layout controlling this widget.tool_tip_text
(Text): [Read-Write] Tool Tip Texttool_tip_widget
(Widget): [Read-Only] Tool Tip Widgetvisibility
(SlateVisibility): [Read-Write] Visibility
- add_field_value_changed_delegate(field_id, delegate) None ¶
K2 Add Field Value Changed Delegate
- Parameters:
field_id (FieldNotificationId) –
delegate (FieldValueChangedDynamicDelegate) –
- broadcast_field_value_changed(field_id) None ¶
K2 Broadcast Field Value Changed
- Parameters:
field_id (FieldNotificationId) –
- property clip_to_bounds: WidgetClipping¶
‘clip_to_bounds’ was renamed to ‘clipping’.
- Type:
deprecated
- property clipping: WidgetClipping¶
[Read-Write] Clipping
- Type:
- property cursor: MouseCursor¶
[Read-Write] Cursor
- 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.
- Return type:
- get_clipping() WidgetClipping ¶
Gets the clipping state of this widget.
- 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_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
- Return type:
- get_visibility() SlateVisibility ¶
Gets the current visibility of the widget.
- Return type:
- has_focused_descendants() bool ¶
Returns true if any descendant widget is focused by any user.
- 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) –
- 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) –
- 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.
- is_hovered() bool ¶
Returns true if the widget is currently being hovered by a pointer device
- Return type:
- is_in_viewport() bool ¶
- Returns:
true if the widget was added to the viewport using AddToViewport or AddToPlayerScreen.
- Return type:
- is_rendered() bool ¶
Returns true if the widget is Visible, HitTestInvisible or SelfHitTestInvisible and the Render Opacity is greater than 0.
- Return type:
- is_visible() bool ¶
Returns true if the widget is Visible, HitTestInvisible or SelfHitTestInvisible.
- Return type:
- property is_volatile: bool¶
[Read-Only] Is Volatile: 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] Navigation: 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_field_value_changed_delegate(field_id, delegate) None ¶
K2 Remove Field Value Changed Delegate
- Parameters:
field_id (FieldNotificationId) –
delegate (FieldValueChangedDynamicDelegate) –
- 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: WidgetTransform¶
[Read-Write] Render Transform
- Type:
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 deprecated: Function ‘SetNavigationRule’ is deprecated.
- 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_render_angle(angle: float) None ¶
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: PanelSlot¶
[Read-Only] Slot: The parent slot of the UWidget. Allows us to easily inline edit the layout controlling this widget.
- Type:
- property visibility: SlateVisibility¶
[Read-Write] Visibility
- Type:
- property visiblity: SlateVisibility¶
‘visiblity’ was renamed to ‘visibility’.
- Type:
deprecated