unreal.ScriptableClickDragTool

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

Bases: ScriptableInteractiveTool

UScriptableClickDragTool is an extension of UScriptableInteractiveTool that supports a “click-drag” interaction, ie capture the input device on press-down and collect any device movement events until release. Hover is also supported.

Note: Currently these interactions are only supported for mouse devices, or devices remapped to be a mouse by the UInputRouter. Also currently only the left-mouse-button is supported.

C++ Source:

  • Plugin: ScriptableToolsFramework

  • Module: ScriptableToolsFramework

  • File: ScriptableClickDragTool.h

Editor Properties: (see get_editor_property/set_editor_property)

  • custom_icon_path (str): [Read-Write] Relative Path to a custom Icon Image for this Tool. The Image file format must be png or svg.

    The Image file must reside in the same Content folder hierarchy as contains the Tool Class (ie Blueprint asset), i.e. either the Project Content folder or a Plugin Content folder.

    So for example if the Tool BP is in a plugin named MyCustomTools, the icon must be in

    MyProject/Plugins/MyCustomTools/Content/<SubFolders>/MyToolIcon.png,

    and the relative path to use here would be <SubFolders>/MyToolIcon.png

  • show_tool_in_editor (bool): [Read-Write] A generic flag to indicate whether this Tool should be shown in the UE Editor. This may be interpreted in different ways

  • tool_category (Text): [Read-Write] Category of this Tool, will be used in (eg) Tool Palette Section headers

  • tool_long_name (Text): [Read-Write] Long Name of this Tool, will be used in (eg) longer labels like the Accept/Cancel toolbar

  • tool_name (Text): [Read-Write] Name of this Tool, will be used in (eg) Toolbars

  • tool_shutdown_type (ScriptableToolShutdownType): [Read-Write] Specifies how the user exits this Tool, either Accept/Cancel-style or Complete-style

  • tool_tooltip (Text): [Read-Write] Tooltip used for this Tool in (eg) icons/etc

  • update_modifiers_during_drag (bool): [Read-Write] Allow Modifiers states to be updated during ClickDrag sequence. Defaults to enabled. Cannot be changed dynamically after Setup runs.

  • want_mouse_hover (bool): [Read-Write] Enable Hover support API functions OnHoverHitTest / OnHoverBegin / OnHoverUpdate / OnHoverEnd for Mouse devices. Defaults to disabled. Cannot be changed dynamically after Setup runs.

get_active_modifiers() ScriptableToolModifierStates
Returns:

a struct containing the current Modifier key states

Return type:

ScriptableToolModifierStates

in_active_click_drag() bool

In Active Click Drag

Return type:

bool

in_active_hover() bool

In Active Hover

Return type:

bool

is_alt_down() bool
Returns:

true if the Alt key is currently held down

Return type:

bool

is_ctrl_down() bool
Returns:

true if the Ctrl key is currently held down

Return type:

bool

is_shift_down() bool
Returns:

true if the Shift key is currently held down

Return type:

bool

on_drag_begin(start_position, modifiers) None

On Drag Begin

Parameters:
on_drag_end(end_position, modifiers) None

On Drag End

Parameters:
on_drag_sequence_cancelled() None

On Drag Sequence Cancelled

on_drag_update_position(new_position, modifiers) None

On Drag Update Position

Parameters:
on_hover_begin(hover_pos, modifiers) None

Begin a sequence of Hover input events

Parameters:
  • hover_pos (InputDeviceRay) – the current position of the cursor/device, including both a 3D ray from the eye, and (optionally) a 2D mouse position

  • modifiers (ScriptableToolModifierStates) – current modifier key/button state

on_hover_end(modifiers) None

Indicate that an active captured Hover sequence has ended. The device may no longer be in the viewport, so no position can be provided.

Parameters:

modifiers (ScriptableToolModifierStates) – current modifier key/button state

on_hover_hit_test(hover_pos, modifiers) InputRayHit

OnHoverHitTest is called to allow the Tool to indicate if it would like to start consuing “hover” input at HoverPos. The Tool can return yes/no and a “hit depth”, which will be used to determine if the Tool is given the active hover input stream. The default OnHoverHitTest implement always captures the hover.

Once the hover is accepted, the OnHoverBegin event will fire, and then a stream of OnHoverUpdate events. If at any point the hover is no longer relevant, OnHoverUpdate should return false. OnHoverEnd will be called at that point, or if the hover is cancelled for any reason (eg mouse goes out of window, button is pressed, etc)

Parameters:
  • hover_pos (InputDeviceRay) – the current position of the cursor/device, including both a 3D ray from the eye, and (optionally) a 2D mouse position

  • modifiers (ScriptableToolModifierStates) – current modifier key/button state

Returns:

a FInputRayHit indicating a hit (true/false) and the hit depth along the hit-ray (0 for “always consume”)

Return type:

InputRayHit

on_hover_update(hover_pos, modifiers) bool

Update an active Hover sequence. OnHoverUpdate is only ever called between OnHoverBegin and OnHoverEnd

Parameters:
  • hover_pos (InputDeviceRay) – the current position of the cursor/device, including both a 3D ray from the eye, and (optionally) a 2D mouse position

  • modifiers (ScriptableToolModifierStates) – current modifier key/button state

Returns:

true to continue hovering, false to stop receiving additional hover events

Return type:

bool

test_if_can_begin_click_drag(click_pos, modifiers) InputRayHit

Test if Can Begin Click Drag

Parameters:
Return type:

InputRayHit

property update_modifiers_during_drag: bool

[Read-Write] Allow Modifiers states to be updated during ClickDrag sequence. Defaults to enabled. Cannot be changed dynamically after Setup runs.

Type:

(bool)

property want_mouse_hover: bool

[Read-Write] Enable Hover support API functions OnHoverHitTest / OnHoverBegin / OnHoverUpdate / OnHoverEnd for Mouse devices. Defaults to disabled. Cannot be changed dynamically after Setup runs.

Type:

(bool)