From 7b66806dd3afb77da2e7c681b342b40d392f6ccc Mon Sep 17 00:00:00 2001 From: Eric M Date: Sun, 23 Oct 2022 17:08:47 +1000 Subject: Make InputEventAction as_text() return the text of the first valid event for the action. --- core/input/input_event.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'core/input') diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp index f421ecb22d..eb62367f3b 100644 --- a/core/input/input_event.cpp +++ b/core/input/input_event.cpp @@ -1408,7 +1408,18 @@ bool InputEventAction::action_match(const Ref &p_event, bool p_exact } String InputEventAction::as_text() const { - return vformat(RTR("Input Action %s was %s"), action, pressed ? "pressed" : "released"); + const List> *events = InputMap::get_singleton()->action_get_events(action); + if (!events) { + return String(); + } + + for (const Ref &E : *events) { + if (E.is_valid()) { + return E->as_text(); + } + } + + return String(); } String InputEventAction::to_string() { -- cgit v1.2.3