Skip to content

Commit

Permalink
Update addons
Browse files Browse the repository at this point in the history
  • Loading branch information
rsubtil committed Mar 16, 2023
1 parent f29cda5 commit 67d2c20
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
23 changes: 23 additions & 0 deletions addons/controller_icons/ControllerIcons.gd
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,29 @@ func _enter_tree():
_parse_input_actions()

func _parse_input_actions():
# Default actions will be the builtin editor actions when
# the script is at editor ("tool") level. To pickup more
# actions available, these have to be queried manually
var keys := [
"input/ui_accept",
"input/ui_cancel",
"input/ui_down",
"input/ui_end",
"input/ui_focus_next",
"input/ui_focus_prev",
"input/ui_home",
"input/ui_left",
"input/ui_page_down",
"input/ui_page_up",
"input/ui_right",
"input/ui_select",
"input/ui_up"
]
for key in keys:
var data : Dictionary = ProjectSettings.get_setting(key)
if not data.empty() and data.has("events") and data["events"] is Array:
_add_custom_input_action((key as String).trim_prefix("input/"), data)

# A script running at editor ("tool") level only has
# the default mappings. The way to get around this is
# manually parsing the project file and adding the
Expand Down
7 changes: 6 additions & 1 deletion addons/controller_icons/Mapper.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ func _convert_joypad_path(path: String, fallback) -> String:
return ""

func _get_joypad_type(fallback):
# If on editor, default to fallback always, to avoid editing scene
# files on controller reload
if Engine.is_editor_hint():
return fallback

var controller_name = Input.get_joy_name(0)
if "Luna Controller" in controller_name:
return ControllerSettings.Devices.LUNA
Expand Down Expand Up @@ -297,4 +302,4 @@ func _convert_joypad_to_steamdeck(path: String):
"share":
return path.replace("/share", "/dots")
_:
return path
return path
2 changes: 1 addition & 1 deletion addons/controller_icons/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="Controller Icons"
description="Provides icons for all major controllers and keyboard, with automatic icon remapping."
author="rsubtil"
version="1.1.3"
version="1.1.4"
script="plugin.gd"

0 comments on commit 67d2c20

Please sign in to comment.