Skip to content

Commit

Permalink
GD-522: Fix shortcuts can't be changed anymore in GdUnit4 settings (#526
Browse files Browse the repository at this point in the history
)

# Why
The change shortcuts was broken and not able to change it when clicking
on the shortcut settings.

# What
- fixed by moving the shortcut capture scene to the parent and manage
the visibility differently
- fixes also to modulate on the label to have better visualization
animation
  • Loading branch information
MikeSchulze authored Jun 28, 2024
1 parent c76d349 commit 30481e9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 248 deletions.
5 changes: 3 additions & 2 deletions addons/gdUnit4/src/ui/settings/GdUnitInputCapture.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ var _input_event: InputEventKey

func _ready() -> void:
reset()
self_modulate = Color.WHITE
_tween = create_tween()
_tween.set_loops(-1)
_tween.tween_property(self, "modulate", Color(0, 0, 0, .1), 1.0).from_current().set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_IN)
_tween.set_loops()
_tween.tween_property(%Label, "self_modulate", Color(1, 1, 1, .8), 1.0).from_current().set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_IN_OUT)


func reset() -> void:
Expand Down
5 changes: 4 additions & 1 deletion addons/gdUnit4/src/ui/settings/GdUnitInputCapture.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[gd_scene load_steps=2 format=3]
[gd_scene load_steps=2 format=3 uid="uid://pmnkxrhglak5"]

[ext_resource type="Script" path="res://addons/gdUnit4/src/ui/settings/GdUnitInputCapture.gd" id="1_gki1u"]

[node name="GdUnitInputMapper" type="Control"]
modulate = Color(0.929099, 0.929099, 0.929099, 0.936189)
top_level = true
layout_mode = 3
anchors_preset = 15
Expand All @@ -16,6 +17,8 @@ script = ExtResource("1_gki1u")

[node name="Label" type="Label" parent="."]
unique_name_in_owner = true
self_modulate = Color(0.401913, 0.401913, 0.401913, 0.461723)
top_level = true
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
Expand Down
2 changes: 2 additions & 0 deletions addons/gdUnit4/src/ui/settings/GdUnitSettingsDialog.gd
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,13 @@ func _on_shortcut_change(input_button: Button, property: GdUnitProperty, reset_b
_input_capture.set_custom_minimum_size(_properties_shortcuts.get_size())
_input_capture.visible = true
_input_capture.show()
_properties_shortcuts.visible = false
set_process_input(false)
_input_capture.reset()
var input_event: InputEventKey = await _input_capture.input_completed
input_button.text = input_event.as_text()
_on_property_text_changed(to_keys(input_event), property, reset_btn)
_properties_shortcuts.visible = true
set_process_input(true)


Expand Down
264 changes: 21 additions & 243 deletions addons/gdUnit4/src/ui/settings/GdUnitSettingsDialog.tscn

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ config_version=5

config/name="gdUnit4"
config/tags=PackedStringArray("addon", "godot4", "testing")
config/features=PackedStringArray("4.3", "C#")
config/features=PackedStringArray("4.2")
config/icon="res://icon.png"

[audio]
Expand Down Expand Up @@ -40,7 +40,6 @@ ui/inspector/node_collapse=false
ui/toolbar/run_overall=true
ui/inspector/tree_sort_mode=1
report/godot/script_error=false
settings/test/test_discovery=true

[importer_defaults]

Expand Down

0 comments on commit 30481e9

Please sign in to comment.