Enfusion Script API
Loading...
Searching...
No Matches
InputBinding Interface Reference

Manages input key bindings, presets, contexts, and device calibration. More...

Public Member Functions

proto external void Save ()
 Saves all current bindings and settings to persistent storage.
 
proto external void ResetDefault (string actionName, EInputDeviceType deviceType=EInputDeviceType.INVALID, string preset=string.Empty)
 Resets the binding for the specified action to its default value.
 
proto external bool IsDefault (string actionName, EInputDeviceType deviceType=EInputDeviceType.KEYBOARD, string preset=string.Empty)
 Checks if the binding for an action is currently set to its default value.
 
proto external bool CreateUserBinding (string actionName, EInputDeviceType deviceType=EInputDeviceType.KEYBOARD, string preset=string.Empty)
 Creates a new user-defined binding for the given action.
 
proto external int GetBindingsCount (string actionName, EInputDeviceType deviceType=EInputDeviceType.KEYBOARD, string preset=string.Empty)
 Gets the number of bindings for the given action and device type.
 
proto external void RemoveBinding (string actionName, EInputDeviceType deviceType, string preset, int keyBindIndex)
 Removes a specific binding by its index for the given action, device, and preset.
 
proto external void AddBinding (string actionName, string preset, string keyBinding, string filterName=string.Empty)
 Adds a new binding for the specified action and preset.
 
proto external void InsertCombo (string actionName, string preset, string keyBinding, string filterName, int keyBindIndex, int comboIndex=-1)
 Inserts a key combination into the binding list.
 
proto external bool SetFilter (string actionName, EInputDeviceType deviceType, string preset, int keyBindIndex, string filterName)
 Sets the filter for a user binding.
 
proto external string GetFilter (string actionName, EInputDeviceType deviceType, string preset, int keyBindIndex)
 Gets the filter name for the specified binding.
 
proto external void StartCapture (string actionName, EInputDeviceType deviceType=EInputDeviceType.KEYBOARD, string preset=string.Empty, bool bAppend=false, EInputBindingAxleCapture eAxleCapture=EInputBindingAxleCapture.HALF_AXLE)
 Starts capturing user input for binding purposes.
 
proto external void CancelCapture ()
 Cancels the current binding capture process.
 
proto external void SaveCapture (array< string > additionalKeyBindings=null)
 Immediately finish running input capture and save results.
 
proto external EInputBindingCaptureState GetCaptureState ()
 Returns the current state of an active binding capture operation.
 
proto external void GetCustomConfigs (out notnull array< ResourceName > customConfigs)
 Retrieves the custom binding configurations.
 
proto external void SetCustomConfigs (notnull array< ResourceName > customConfigs)
 Sets custom configuration for key bindings.
 
proto external BaseContainer FindContext (string contextName)
 Finds and returns the container for the specified context.
 
proto external BaseContainer FindAction (string actionName)
 Finds and returns the container for the specified action.
 
proto external void StartCalibration (EInputDeviceType deviceType)
 Starts calibration process for the specified input device type.
 
proto external void StopCalibration ()
 Stops any running calibration process.
 
proto external EInputBindingCalibrationStatus GetCalibrationStatus ()
 Gets the current status of the calibration process.
 
proto external bool GetCalibrationData (EInputBindingCalibrationData dataType, out vector min, out vector max)
 Gets the min and max calibration values for the given data type.
 
proto external bool GetConflicts (string actionName, out notnull array< int > keyBindIndices, out notnull array< string > conflictedActions, out notnull array< string > conflictedActionPresets, EInputDeviceType deviceType=EInputDeviceType.KEYBOARD, string preset=string.Empty)
 Checks for key binding conflicts for a given action.
 
proto external bool GetBindings (string actionName, out notnull array< string > bindings, EInputDeviceType deviceType=EInputDeviceType.KEYBOARD, string sPreset=string.Empty, bool uiInputNames=true)
 Retrieves input bindings for a specified action and device type.
 
proto external void GetContexts (out array< string > contextNames)
 Retrieves all available input contexts.
 
proto external void GetPresets (string actionName, out array< string > presetNames)
 Gets all preset names for a given action.
 
proto external KeyCode GetKeyCode (string inputName)
 Resolves an input name to its corresponding key code.
 

Detailed Description

Manages input key bindings, presets, contexts, and device calibration.

Provides functions for creating, resetting, querying, modifying, and calibrating input bindings for various device types and action presets.

InputBinding binding = GetGame().GetInputManager().CreateUserBinding();
array<string> bindings = {};
binding.GetBindings("CamForward", bindings);
Print(bindings);
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
proto external bool GetBindings(string actionName, out notnull array< string > bindings, EInputDeviceType deviceType=EInputDeviceType.KEYBOARD, string sPreset=string.Empty, bool uiInputNames=true)
Retrieves input bindings for a specified action and device type.

Member Function Documentation

◆ AddBinding()

proto external void InputBinding.AddBinding ( string actionName,
string preset,
string keyBinding,
string filterName = string.Empty )

Adds a new binding for the specified action and preset.

Parameters
actionNameName of the action.
presetName of the preset.
keyBindingKeybinding string to add.
filterName(Optional) Filter name to use. Defaults to empty string.

◆ CancelCapture()

proto external void InputBinding.CancelCapture ( )

Cancels the current binding capture process.

See also
StartCapture

◆ CreateUserBinding()

proto external bool InputBinding.CreateUserBinding ( string actionName,
EInputDeviceType deviceType = EInputDeviceType.KEYBOARD,
string preset = string.Empty )

Creates a new user-defined binding for the given action.

Parameters
actionNameName of the action.
deviceType(Optional) Device type. Defaults to KEYBOARD.
preset(Optional) Preset name. Defaults to empty string.
Returns
True if binding was created successfully, false otherwise.

◆ FindAction()

proto external BaseContainer InputBinding.FindAction ( string actionName)

Finds and returns the container for the specified action.

Parameters
actionNameName of the action to search for.
Returns
BaseContainer for the action, or null if not found.

◆ FindContext()

proto external BaseContainer InputBinding.FindContext ( string contextName)

Finds and returns the container for the specified context.

Parameters
contextNameName of the context to search for.
Returns
BaseContainer for the context, or null if not found.

◆ GetBindings()

proto external bool InputBinding.GetBindings ( string actionName,
out notnull array< string > bindings,
EInputDeviceType deviceType = EInputDeviceType.KEYBOARD,
string sPreset = string.Empty,
bool uiInputNames = true )

Retrieves input bindings for a specified action and device type.

Finds and collects input bindings matching the given action name, device type, and optional preset.

Parameters
actionNameName of the input action.
bindingsArray to store found binding strings.
deviceTypeEnum specifying the source device type.
sPresetName of the binding preset to use.
uiInputNames(Optional) Whether to use user-friendly names. Defaults to true.
Returns
True if bindings were found, false otherwise.
InputBinding binding = GetGame().GetInputManager().CreateUserBinding();
array<string> bindings = {};
binding.GetBindings("CamForward", bindings, EInputDeviceType.KEYBOARD, string.Empty, false);
foreach(string id: bindings)
{
Print("KeyCode: " + binding.GetKeyCode(id));
}
binding.GetBindings("CamForward", bindings, EInputDeviceType.KEYBOARD, string.Empty, true);
foreach(string name: bindings)
{
Print("UI friendly key name: " + name);
}
proto external KeyCode GetKeyCode(string inputName)
Resolves an input name to its corresponding key code.

◆ GetBindingsCount()

proto external int InputBinding.GetBindingsCount ( string actionName,
EInputDeviceType deviceType = EInputDeviceType.KEYBOARD,
string preset = string.Empty )

Gets the number of bindings for the given action and device type.

Parameters
actionNameName of the action.
deviceType(Optional) Device type. Defaults to KEYBOARD.
preset(Optional) Preset name. Defaults to empty string.
Returns
Number of bindings.

◆ GetCalibrationData()

proto external bool InputBinding.GetCalibrationData ( EInputBindingCalibrationData dataType,
out vector min,
out vector max )

Gets the min and max calibration values for the given data type.

Parameters
dataTypeCalibration data type.
[out]minOutput vector for minimum calibration.
[out]maxOutput vector for maximum calibration.
Returns
True if data is valid, false otherwise.

◆ GetCalibrationStatus()

proto external EInputBindingCalibrationStatus InputBinding.GetCalibrationStatus ( )

Gets the current status of the calibration process.

Returns
Calibration status.

◆ GetCaptureState()

proto external EInputBindingCaptureState InputBinding.GetCaptureState ( )

Returns the current state of an active binding capture operation.

See also
StartCapture
Returns
Current capture state.

◆ GetConflicts()

proto external bool InputBinding.GetConflicts ( string actionName,
out notnull array< int > keyBindIndices,
out notnull array< string > conflictedActions,
out notnull array< string > conflictedActionPresets,
EInputDeviceType deviceType = EInputDeviceType.KEYBOARD,
string preset = string.Empty )

Checks for key binding conflicts for a given action.

Identifies if the specified action's key bindings conflict with other actions on the given input device type and preset.

Parameters
actionNameName of the action to check.
[out]keyBindIndicesOutput array of indices of the conflicting key bindings.
[out]conflictedActionsOutput array of conflicted action names.
[out]conflictedActionPresetsOutput array of conflicted action presets.
deviceType(Optional) Input device type to check. Defaults to KEYBOARD.
preset(Optional) Name of the preset to check. Defaults to empty string.
Returns
True if conflicts found, false otherwise.

◆ GetContexts()

proto external void InputBinding.GetContexts ( out array< string > contextNames)

Retrieves all available input contexts.

Populates an array with the names of all defined input contexts.

Parameters
[out]contextNamesOutput array to be populated with context names.

◆ GetCustomConfigs()

proto external void InputBinding.GetCustomConfigs ( out notnull array< ResourceName > customConfigs)

Retrieves the custom binding configurations.

Parameters
[out]customConfigsOutput array for custom configs.

◆ GetFilter()

proto external string InputBinding.GetFilter ( string actionName,
EInputDeviceType deviceType,
string preset,
int keyBindIndex )

Gets the filter name for the specified binding.

Parameters
actionNameName of the action.
deviceTypeDevice type.
presetPreset name.
keyBindIndexIndex of the binding.
Returns
Filter name as string.

◆ GetKeyCode()

proto external KeyCode InputBinding.GetKeyCode ( string inputName)

Resolves an input name to its corresponding key code.

Returns the KeyCode corresponding to the specified input name.

Parameters
inputNameName of the input/key.
Returns
KeyCode for the given input name.

◆ GetPresets()

proto external void InputBinding.GetPresets ( string actionName,
out array< string > presetNames )

Gets all preset names for a given action.

Fills an array with the names of all presets in given action.

Parameters
actionNameName of the input action.
[out]presetNamesOutput array to hold the preset names.

◆ InsertCombo()

proto external void InputBinding.InsertCombo ( string actionName,
string preset,
string keyBinding,
string filterName,
int keyBindIndex,
int comboIndex = -1 )

Inserts a key combination into the binding list.

Parameters
actionNameName of the action.
presetPreset name.
keyBindingKeybinding string to insert.
filterNameName of the filter.
keyBindIndexIndex of the binding to modify.
comboIndex(Optional) Index to insert the combo. Defaults to -1 (append).

◆ IsDefault()

proto external bool InputBinding.IsDefault ( string actionName,
EInputDeviceType deviceType = EInputDeviceType.KEYBOARD,
string preset = string.Empty )

Checks if the binding for an action is currently set to its default value.

Parameters
actionNameAction name to check.
deviceType(Optional) Input device type. Defaults to KEYBOARD.
preset(Optional) Preset name. Defaults to empty string.
Returns
True if binding is default, false otherwise.

◆ RemoveBinding()

proto external void InputBinding.RemoveBinding ( string actionName,
EInputDeviceType deviceType,
string preset,
int keyBindIndex )

Removes a specific binding by its index for the given action, device, and preset.

Parameters
actionNameTarget action name.
deviceTypeTarget device type.
presetTarget preset.
keyBindIndexIndex of the binding to be removed.

◆ ResetDefault()

proto external void InputBinding.ResetDefault ( string actionName,
EInputDeviceType deviceType = EInputDeviceType.INVALID,
string preset = string.Empty )

Resets the binding for the specified action to its default value.

Parameters
actionNameAction name to reset.
deviceType(Optional) Input device type. Defaults to INVALID.
preset(Optional) Preset name. Defaults to empty string.

◆ Save()

proto external void InputBinding.Save ( )

Saves all current bindings and settings to persistent storage.

◆ SaveCapture()

proto external void InputBinding.SaveCapture ( array< string > additionalKeyBindings = null)

Immediately finish running input capture and save results.

Additional key bindings can be added using additionalKeyBindings array.

See also
StartCapture
Parameters
additionalKeyBindings(Optional) Array of additional key bindings to save.

◆ SetCustomConfigs()

proto external void InputBinding.SetCustomConfigs ( notnull array< ResourceName > customConfigs)

Sets custom configuration for key bindings.

Parameters
customConfigsInput array of custom configs.

◆ SetFilter()

proto external bool InputBinding.SetFilter ( string actionName,
EInputDeviceType deviceType,
string preset,
int keyBindIndex,
string filterName )

Sets the filter for a user binding.

Parameters
actionNameName of the action.
deviceTypeDevice type.
presetPreset name.
keyBindIndexIndex of the binding.
filterNameName of the filter to assign.
Returns
True if successful, false otherwise.

◆ StartCalibration()

proto external void InputBinding.StartCalibration ( EInputDeviceType deviceType)

Starts calibration process for the specified input device type.

See also
StopCalibration
GetCalibrationStatus
GetCalibrationData
Parameters
deviceTypeDevice type to calibrate.

◆ StartCapture()

proto external void InputBinding.StartCapture ( string actionName,
EInputDeviceType deviceType = EInputDeviceType.KEYBOARD,
string preset = string.Empty,
bool bAppend = false,
EInputBindingAxleCapture eAxleCapture = EInputBindingAxleCapture.HALF_AXLE )

Starts capturing user input for binding purposes.

After calling this method, InputBinding is listening for activated inputs. After input are pressed, capturing ends and state is returned back to EInputBindingCaptureState.IDLE

See also
GetCaptureState and caputer inputs are added as user key binding.
CancelCapture
SaveCapture
Parameters
actionNameName of the action.
deviceType(Optional) Device type. Defaults to KEYBOARD.
preset(Optional) Preset name. Defaults to empty string.
bAppend(Optional) If true, appends new binding. Defaults to false.
eAxleCapture(Optional) Method for capturing axes. Defaults to HALF_AXLE.

◆ StopCalibration()

proto external void InputBinding.StopCalibration ( )

Stops any running calibration process.


The documentation for this interface was generated from the following file: