33 lines
843 B
GDScript
33 lines
843 B
GDScript
@tool
|
|
extends Control
|
|
|
|
const INPUT_GROUP_SCENE = preload("res://gui/menu/controls/input_group.tscn")
|
|
|
|
@export_tool_button("Update", "Callable") var update_action = create_input_list
|
|
|
|
func _ready():
|
|
create_input_list()
|
|
if not Engine.is_editor_hint():
|
|
%ControlsWindow.close_window()
|
|
show()
|
|
|
|
func open_controls():
|
|
%ControlsWindow.open_window()
|
|
|
|
func close_controls():
|
|
%ControlsWindow.close_window()
|
|
|
|
func create_input_list():
|
|
InputMap.load_from_project_settings()
|
|
for child in %ControlsContainer.get_children():
|
|
child.queue_free()
|
|
|
|
for action in InputMap.get_actions():
|
|
if action.substr(0, 3) != "ui_":
|
|
var input_group = instantiate_input_group()
|
|
input_group.action_name = action
|
|
%ControlsContainer.add_child(input_group)
|
|
|
|
|
|
func instantiate_input_group() -> InputGroup:
|
|
return INPUT_GROUP_SCENE.instantiate() as InputGroup |