unreal.CommonActivatableWidget

class unreal.CommonActivatableWidget(outer=None, name='None')

Bases: unreal.CommonUserWidget

The base for widgets that are capable of being “activated” and “deactivated” during their lifetime without being otherwise modified or destroyed.

This is generally desired for one or more of the following purposes:
  • This widget can turn on/off without being removed from the hierarchy (or otherwise reconstructing the underlying SWidgets), so Construct/Destruct are insufficient

  • You’d like to be able to “go back” from this widget, whether that means back a breadcrumb, closing a modal, or something else. This is built-in here.

  • This widget’s place in the hierarchy is such that it defines a meaningful node-point in the tree of activatable widgets through which input is routed to all widgets.

By default, an activatable widget:
  • Is not automatically activated upon construction

  • Does not register to receive back actions (or any other actions, for that matter)

  • If classified as a back handler, is automatically deactivated (but not destroyed) when it receives a back action

Note that removing an activatable widget from the UI (i.e. triggering Destruct()) will always deactivate it, even if the UWidget is not destroyed. Re-constructing the underlying SWidget will only result in re-activation if auto-activate is enabled.

TODO: ADD MORE INFO ON INPUTS

C++ Source:

  • Plugin: CommonUI

  • Module: CommonUI

  • File: CommonActivatableWidget.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.

  • activated_visibility (SlateVisibility): [Read-Write] Activated Visibility

  • auto_activate (bool): [Read-Write] Auto Activate: True to automatically activate upon construction

  • auto_restore_focus (bool): [Read-Write] Auto Restore Focus: True to prefer automatically restoring focus to the widget that was focused when this widget last became the non-leafmost-active-widget. If true and a valid restoration candidate exists, we’ll use that. If it doesn’t, we rely on GetDesiredFocusTarget() If false, we simply always rely on GetDesiredFocusTarget()

  • bp_on_widget_activated (OnWidgetActivationChanged): [Read-Write] BP on Widget Activated: Fires when the widget is activated.

  • bp_on_widget_deactivated (OnWidgetActivationChanged): [Read-Write] BP on Widget Deactivated: Fires when the widget is deactivated.

  • 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] Clipping: 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.

  • color_and_opacity (LinearColor): [Read-Write] Color and Opacity: The color and opacity of this widget. Tints all child widgets.

  • consume_pointer_input (bool): [Read-Write] Consume Pointer Input: Set this to true if you don’t want any pointer (mouse and touch) input to bubble past this widget

  • cursor (MouseCursor): [Read-Write] Cursor: The cursor to show when the mouse is over the widget

  • deactivated_visibility (SlateVisibility): [Read-Write] Deactivated Visibility

  • display_in_action_bar (bool): [Read-Write] Display in Action Bar: True to generally display this widget’s actions in the action bar, assuming it has actions.

  • flow_direction_preference (FlowDirectionPreference): [Read-Write] Flow Direction Preference: Allows you to set a new flow direction

  • foreground_color (SlateColor): [Read-Write] Foreground Color: The foreground color of the widget, this is inherited by sub widgets. Any color property that is marked as inherit will use this color.

  • is_active (bool): [Read-Write] Is Active

  • is_back_action_displayed_in_action_bar (bool): [Read-Write] Is Back Action Displayed in Action Bar: True to receive “Back” actions automatically. Custom back handler behavior can be provided, default is to deactivate.

  • is_back_handler (bool): [Read-Write] Is Back Handler: True to receive “Back” actions automatically. Custom back handler behavior can be provided, default is to deactivate.

  • is_enabled (bool): [Read-Write] Is Enabled: Sets whether this widget can be modified interactively by the user

  • is_focusable (bool): [Read-Write] Is Focusable: Setting this flag to true, allows this widget to accept focus when clicked, or when navigated to.

  • is_modal (bool): [Read-Write] Is Modal: True to have this widget be treated as a root node for input routing, regardless of its actual parentage. Should seldom be needed, but useful in cases where a child widget should prevent all action processing by parents, even though they remain active (ex: modal popup menu).

  • is_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.

  • on_visibility_changed (OnVisibilityChangedEvent): [Read-Write] On Visibility Changed: Called when the visibility has changed

  • 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 Cursor

  • padding (Margin): [Read-Write] Padding: The padding area around the content.

  • preview_background (Texture2D): [Read-Write] Preview Background: A preview background that you can use when designing the UI to get a sense of scale on the screen. Use a texture with a screenshot of your game in it, for example if you were designing a HUD.

  • priority (int32): [Read-Write] Priority

  • render_opacity (float): [Read-Write] Render Opacity: The opacity of the widget

  • render_transform (WidgetTransform): [Read-Write] Render Transform: The render transform of the widget allows for arbitrary 2D transforms to be applied to the widget.

  • render_transform_pivot (Vector2D): [Read-Write] Render Transform Pivot: 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.

  • set_visibility_on_activated (bool): [Read-Write] Set Visibility on Activated

  • set_visibility_on_deactivated (bool): [Read-Write] Set Visibility on Deactivated

  • slot (PanelSlot): [Read-Write] Slot: The parent slot of the UWidget. Allows us to easily inline edit the layout controlling this widget.

  • stop_action (bool): [Read-Write] Stop Action

  • supports_activation_focus (bool): [Read-Write] Supports Activation Focus: True if this widget is a candidate to receive/route focus or specify a desired UIInputConfig when active. Primary reason for disabling is for utility sub-widgets within a larger screen that possess actions, but are never intended to be involved in navigation or dictate changes to the active UI input config.

  • tick_frequency (WidgetTickFrequency): [Read-Write] Tick Frequency: This widget is allowed to tick. If this is unchecked tick will never be called, animations will not play correctly, and latent actions will not execute. Uncheck this for performance reasons only

  • tool_tip_text (Text): [Read-Write] Tool Tip Text: Tooltip text to show when the user hovers over the widget with the mouse

  • tool_tip_widget (Widget): [Read-Only] Tool Tip Widget: Tooltip widget to show when the user hovers over the widget with the mouse

  • visibility (SlateVisibility): [Read-Write] Visibility: The visibility of the widget

activate_widget() None

Activate Widget

bind_visibility_to_activation(activatable_widget) None

Bind our visibility to the activation of another widget, useful for making mouse collisions behave similiar to console navigation w.r.t activation Will immediately update visibility based on the bound widget activation & visibilites set by SetBindVisibilities.

Parameters

activatable_widget (CommonActivatableWidget) – The widget whose activation / deactivation will modify our visibility

bp_get_desired_focus_target() Widget

Implement to provide the desired widget to focus if/when this activatable becomes the primary active widget. Note: This is a fallback used only if the native class parentage does not provide a target.

Return type

Widget

bp_on_activated() None

BP on Activated

bp_on_deactivated() None

BP on Deactivated

bp_on_handle_back_action() bool

Override in BP implementations to provide custom behavior when receiving a back action Note: Only called if native code in the base class hasn’t handled it in NativeOnHandleBackAction

Return type

bool

property bp_on_widget_activated

[Read-Write] BP on Widget Activated: Fires when the widget is activated.

Type

(OnWidgetActivationChanged)

property bp_on_widget_deactivated

[Read-Write] BP on Widget Deactivated: Fires when the widget is deactivated.

Type

(OnWidgetActivationChanged)

deactivate_widget() None

Deactivate Widget

get_desired_focus_target() Widget

Returns the desired widget to focus when this Widget Activates.

Return type

Widget

is_activated() bool

Is Activated

Return type

bool

property is_active

[Read-Only] Is Active

Type

(bool)

set_bind_visibilities(on_activated_visibility, on_deactivated_visibility, all_active) None

Visibilities to use for when bound widgets in BindVisibilityToActivation are activated.

Parameters
  • on_activated_visibility (SlateVisibility) – Visibility for when bound widgets are active

  • on_deactivated_visibility (SlateVisibility) – Visibility for when bound widgets are not active, not used if this widget has activation / deactivation visibilities

  • all_active (bool) – True if we should switch to activated visibility only when all bound widgets are active