Navigation
API > API/Runtime > API/Runtime/InteractiveToolsFramework
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UInputBehavior
- UAnyButtonInputBehavior
- UBrushAdjusterInputBehavior
- UClickDragInputBehavior
- ULocalClickDragInputBehavior
- UMouseWheelInputBehavior
- UMultiClickSequenceInputBehavior
- UScalableConeGizmoInputBehavior
- UScalableSphereGizmoInputBehavior
- USingleClickInputBehavior
- ULocalSingleClickInputBehavior
- USingleClickOrDragInputBehavior
- UKeyAsModifierInputBehavior
- UMouseHoverBehavior
- ULocalMouseHoverBehavior
- USingleKeyCaptureBehavior
References
| Module | InteractiveToolsFramework |
| Header | /Engine/Source/Runtime/InteractiveToolsFramework/Public/InputBehavior.h |
| Include | #include "InputBehavior.h" |
Syntax
class UInputBehavior : public UObject
Remarks
An InputBehavior implements a state machine for a user interaction. The InputRouter maintains a set of active Behaviors, and when new input events occur, it calls WantsCapture() to check if the Behavior would like to begin capturing the applicable input event stream (eg for a mouse, one or both VR controllers, etc). If the Behavior acquires capture, UpdateCapture() is called until the Behavior indicates that it wants to release the device, or until the InputRouter force-terminates the capture via ForceEndCapture().
For example, something like ButtonSetClickBehavior might work as follows:
- in WantsCapture(), if left mouse is pressed and a button is under cursor, return Begin, otherwise Ignore
- in BeginCapture(), save identifier for button that is under cursor
- in UpdateCapture()
- if left mouse is down, return Continue
- if left mouse is released:
- if saved button is still under cursor, call button.Clicked()
- return End
Written sufficiently generically, the above Behavior doesn't need to know about buttons, it just needs to know how to hit-test the clickable object(s). Similarly separate Behaviors can be written for mouse, VR, touch, gamepad, etc.
Implementing interactions in this way allows the input handling to be separated from functionality.
Variables
| Type | Name | Description | |
|---|---|---|---|
| FInputCapturePriority | DefaultPriority | Priority returned by GetPriority() |
Constructors
| Type | Name | Description | |
|---|---|---|---|
Functions
| Type | Name | Description | |
|---|---|---|---|
| FInputCaptureUpdate | BeginCapture
(
const FInputDeviceState& InputState, |
Called after WantsCapture() returns a capture request that was accepted | |
| FInputCaptureUpdate | BeginHoverCapture
(
const FInputDeviceState& InputState, |
Called after WantsHoverCapture() returns a capture request that was accepted | |
| void | If a different hover capture begins, focus is lost, a tool starts, etc, any active hover visualization needs to terminate | ||
| void | ForceEndCapture
(
const FInputCaptureData& CaptureData |
If this is called, the Behavior has forcibly lost capture (eg due to app losing focus for example) and needs to clean up accordingly | |
| FInputCapturePriority | GetPriority () |
The priority is used to resolve situations where multiple behaviors want the same capture | |
| EInputDevices | Which device types does this Behavior support | ||
| void | SetDefaultPriority
(
const FInputCapturePriority& Priority |
Configure the default priority of an instance of this behavior | |
| FInputCaptureUpdate | UpdateCapture
(
const FInputDeviceState& InputState, |
Called for each new input event during a capture sequence. | |
| FInputCaptureUpdate | UpdateHoverCapture
(
const FInputDeviceState& InputState |
Called on each new hover input event, ie if no other behavior is actively capturing input | |
| FInputCaptureRequest | WantsCapture
(
const FInputDeviceState& InputState |
Given the input state, does this Behavior want to begin capturing some input devices? | |
| FInputCaptureRequest | WantsHoverCapture
(
const FInputDeviceState& InputState |
Given the input state, does this Behavior want to begin capturing some input devices for hover | |
| bool | Hover support (optional)return true if this Behavior supports hover (ie passive input events) |