addon for remapping inputs
add fontsize override to clear button too
bendn 2022-11-25
parent 6a3a327 · commit aec297d
-rw-r--r--addons/remap/ActionLabel.gd1
-rw-r--r--addons/remap/RemapButton.gd7
-rw-r--r--addons/remap/package.json2
-rw-r--r--addons/remap/private/ActionIcon.gd5
4 files changed, 8 insertions, 7 deletions
diff --git a/addons/remap/ActionLabel.gd b/addons/remap/ActionLabel.gd
index 446540a..1b727a9 100644
--- a/addons/remap/ActionLabel.gd
+++ b/addons/remap/ActionLabel.gd
@@ -36,6 +36,7 @@ var name_label_bg := PanelContainer.new()
func _ready() -> void:
+ assert(font != null)
set_process(continuous_updating)
DirAccess.make_dir_absolute(SaveLoadUtils.dir)
SaveLoadUtils.load_action_to_inputmap(action)
diff --git a/addons/remap/RemapButton.gd b/addons/remap/RemapButton.gd
index 324f439..fe3be08 100644
--- a/addons/remap/RemapButton.gd
+++ b/addons/remap/RemapButton.gd
@@ -44,6 +44,7 @@ var button := Button.new()
var clear: Button
func _ready() -> void:
+ assert(font != null)
set_process(continuous_updating)
set_process_input(false)
custom_minimum_size = icon_size
@@ -55,10 +56,10 @@ func _ready() -> void:
clear.pressed.connect(clear_mappings)
clear.size_flags_vertical = SIZE_EXPAND_FILL
clear.custom_minimum_size = icon_size
- add_child(clear)
+ clear.add_theme_font_override("font", font)
+ clear.add_theme_font_size_override("font_size", font_size)
clear.visible = InputMap.action_get_events(action).size() > 0
- if font:
- clear.add_theme_font_override("font", font)
+ add_child(clear)
button.text = _name
button.custom_minimum_size = icon_size
button.size_flags_vertical = SIZE_EXPAND_FILL
diff --git a/addons/remap/package.json b/addons/remap/package.json
index 89dd732..74d9c01 100644
--- a/addons/remap/package.json
+++ b/addons/remap/package.json
@@ -1,6 +1,6 @@
{
"name": "@bendn/remap",
- "version": "4.1.0",
+ "version": "4.1.1",
"description": "godot input remapping",
"main": "InteractiveActionLabel.gd",
"scripts": {
diff --git a/addons/remap/private/ActionIcon.gd b/addons/remap/private/ActionIcon.gd
index 5df00bc..057ff12 100644
--- a/addons/remap/private/ActionIcon.gd
+++ b/addons/remap/private/ActionIcon.gd
@@ -12,6 +12,5 @@ func _init(text: String, min_size: Vector2, font: Font, font_size: int) -> void:
add_child(label)
label.custom_minimum_size = min_size
label.text = text
- if font:
- label.add_theme_font_override("font", font)
- label.add_theme_font_size_override("font_size", font_size)
+ label.add_theme_font_override("font", font)
+ label.add_theme_font_size_override("font_size", font_size)