unreal.InputDeviceLibrary

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

Bases: BlueprintFunctionLibrary

A static BP library that exposes Input Device data to blueprints see: IPlatformInputDeviceMapper note: Keep any function comments up to date with those in GenericPlatformInputDeviceMapper.h!

C++ Source:

  • Module: Engine

  • File: InputDeviceLibrary.h

classmethod equal_equal_input_device_id(a, b) bool

Returns true if InputDeviceId A is equal to InputDeviceId B (A == B)

Parameters:
Return type:

bool

classmethod equal_equal_platform_user_id(a, b) bool

Returns true if PlatformUserId A is equal to PlatformUserId B (A == B)

Parameters:
Return type:

bool

classmethod get_all_active_users() -> (int32, out_users=Array[PlatformUserId])

Get all currently active platform ids, anyone who has a mapped input device

Returns:

The number of active platform users

out_users (Array[PlatformUserId]): Array that will be populated with the platform users.

Return type:

Array[PlatformUserId]

classmethod get_all_connected_input_devices() -> (int32, out_input_devices=Array[InputDeviceId])

Gather all currently connected input devices

Returns:

The number of connected input devices

out_input_devices (Array[InputDeviceId]): Array of input devices to populate

Return type:

Array[InputDeviceId]

classmethod get_all_input_devices() -> (int32, out_input_devices=Array[InputDeviceId])

Get all mapped input devices on this platform regardless of their connection state.

Returns:

The number of connected input devices

out_input_devices (Array[InputDeviceId]): Array of input devices to populate

Return type:

Array[InputDeviceId]

classmethod get_all_input_devices_for_user(user_id) -> (int32, out_input_devices=Array[InputDeviceId])

Populates the OutInputDevices array with any InputDeviceID’s that are mapped to the given platform user

Parameters:

user_id (PlatformUserId) – The Platform User to gather the input devices of.

Returns:

The number of mapped devices, INDEX_NONE if the user was not found.

out_input_devices (Array[InputDeviceId]): Array of input device ID’s that will be populated with the mapped devices.

Return type:

Array[InputDeviceId]

classmethod get_default_input_device() InputDeviceId

Returns the default device id used for things like keyboard/mouse input

Return type:

InputDeviceId

classmethod get_input_device_connection_state(device_id) InputDeviceConnectionState

Gets the connection state of the given input device.

Parameters:

device_id (InputDeviceId) – The device to get the connection state of

Returns:

The connection state of the given device. EInputDeviceConnectionState::Unknown if the device is not mapped

Return type:

InputDeviceConnectionState

classmethod get_player_controller_from_input_device(device_id) PlayerController

Get the player controller who owns the given input device id

Parameters:

device_id (InputDeviceId) –

Return type:

PlayerController

classmethod get_player_controller_from_platform_user(user_id) PlayerController

Get the player controller who has the given Platform User ID.

Parameters:

user_id (PlatformUserId) –

Return type:

PlayerController

classmethod get_primary_input_device_for_user(user_id) InputDeviceId

Returns the primary input device used by a specific player, or INPUTDEVICEID_NONE if invalid

Parameters:

user_id (PlatformUserId) –

Return type:

InputDeviceId

classmethod get_primary_platform_user() PlatformUserId

Returns the ‘Primary’ Platform user for this platform. This typically has an internal ID of ‘0’ and is used as the default platform user to map devices such as the keyboard and mouse that don’t get assigned unique ID’s from their owning platform code.

Return type:

PlatformUserId

classmethod get_user_for_input_device(device_id) PlatformUserId

Returns the platform user attached to this input device, or PLATFORMUSERID_NONE if invalid

Parameters:

device_id (InputDeviceId) –

Return type:

PlatformUserId

classmethod get_user_for_unpaired_input_devices() PlatformUserId

Returns the platform user id that is being used for unmapped input devices. Will be PLATFORMUSERID_NONE if platform does not support this (this is the default behavior)

Return type:

PlatformUserId

classmethod is_device_property_handle_valid(handle) bool

Returns true if the given handle is valid

Parameters:

handle (InputDevicePropertyHandle) –

Return type:

bool

classmethod is_input_device_mapped_to_unpaired_user(input_device) bool

Returns true if the given input device is mapped to the unpaired platform user id.

Parameters:

input_device (InputDeviceId) –

Return type:

bool

classmethod is_unpaired_user_id(platform_id) bool

Returns true if the given Platform User Id is the user for unpaired input devices on this platform.

Parameters:

platform_id (PlatformUserId) –

Return type:

bool

classmethod is_valid_input_device(device_id) bool

Check if the given input device is valid

Parameters:

device_id (InputDeviceId) –

Returns:

True if the given input device is valid (it has been assigned an ID by the PlatformInputDeviceMapper)

Return type:

bool

classmethod is_valid_platform_id(user_id) bool

Check if the given platform ID is valid

Parameters:

user_id (PlatformUserId) –

Returns:

True if the platform ID is valid (it has been assigned by the PlatformInputDeviceMapper)

Return type:

bool

classmethod not_equal_input_device_id(a, b) bool

Returns true if InputDeviceId A is not equal to InputDeviceId B (A != B)

Parameters:
Return type:

bool

classmethod not_equal_platform_user_id(a, b) bool

Returns true if PlatformUserId A is not equal to PlatformUserId B (A != B)

Parameters:
Return type:

bool